pax_global_header00006660000000000000000000000064136407340310014513gustar00rootroot0000000000000052 comment=bc6cdc7c37e55960b527c5484fb403c9dea1710d go-cloudstack-2.9.0/000077500000000000000000000000001364073403100142625ustar00rootroot00000000000000go-cloudstack-2.9.0/.gitignore000066400000000000000000000004031364073403100162470ustar00rootroot00000000000000# Compiled Object files, Static and Dynamic libs (Shared Objects) *.o *.a *.so # Folders _obj _test # Architecture specific extensions/prefixes *.[568vq] [568vq].out *.cgo1.go *.cgo2.c _cgo_defun.c _cgo_gotypes.go _cgo_export.* _testmain.go *.exe *.test go-cloudstack-2.9.0/LICENSE000066400000000000000000000260741364073403100153000ustar00rootroot00000000000000Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. go-cloudstack-2.9.0/README.md000066400000000000000000000075351364073403100155530ustar00rootroot00000000000000go-cloudstack ============= A CloudStack API client enabling Go programs to interact with CloudStack in a simple and uniform way ## Status This package covers the complete CloudStack API and is well tested. Of course there will still be untested corner cases when you have over 400 API commands that you can use, but over all it's safe to use this package. To be able to find the API command you want, they are grouped by 'services' which match the grouping you can see/find on the [CloudStack API docs](http://cloudstack.apache.org/docs/api/apidocs-4.11/TOC_Root_Admin.html) website. ## Usage The cloudstack package is always generated against the latest stable CloudStack release (currently v4.11.x). Luckily the API doesn't change that much, and were it does we try to make sure the generated package is able handle both the old and the new case. Over time it will be impossible to support all version with just one package, but until now we seem to manage this pretty well. Please see the package documentation on [GoDocs](http://godoc.org/github.com/xanzy/go-cloudstack/cloudstack). ## Example ```go // Create a new API client cs := cloudstack.NewAsyncClient("https://cloudstack.company.com", "your-api-key", "your-api-secret", false) // Create a new parameter struct p := cs.VirtualMachine.NewDeployVirtualMachineParams("service-offering-id", "template-id", "zone-id") // Set the name name := "server-1" p.SetName(name) // Set the display name p.SetDisplayname("Test server 1") // Set any other options required by your setup in the same way // Create the new instance r, err := cs.VirtualMachine.DeployVirtualMachine(p) if err != nil { log.Fatalf("Error creating the new instance %s: %s", name, err) } fmt.Printf("UUID or the newly created machine: %s", r.ID) ``` ## Features Next to the API commands CloudStack itself offers, there are a few additional features/function that are helpful. For starters there are two clients, an normal one (created with `NewClient(...)`) and an async client (created with `NewAsyncClient(...)`). The async client has a buildin waiting/polling feature that waits for a configured amount of time (defaults to 300 seconds) on running async jobs. This is very helpfull if you do not want to continue with your program execution until the async job is done. There is also a function you can call manually (`GetAsyncJobResult(...)`) that does the same, but then as a seperate call after you started the async job. Another nice feature is the fact that for every API command you can create the needed parameter struct using a `New...Params` function, like for example `NewListTemplatesParams`. The advantage of using this functions to create a new parameter struct, is that these functions know what the required parameters are of ever API command, and they require you to supply these when creating the new struct. Every additional paramater can be set after creating the struct by using `SetName()` like functions. Last but not least there are a whole lot of helper function that will try to automatically find an UUID for you for a certain item (disk, template, virtualmachine, network...). This makes it much easier and faster to work with the API commands and in most cases you can just use then if you know the name instead of the UUID. ## ToDO I fully understand I need to document this all a little more/better and there should also be some tests added. ## Getting Help _Please try to see if [GoDocs](http://godoc.org/github.com/xanzy/go-cloudstack) can provide some answers first!_ * If you have an issue: report it on the [issue tracker](https://github.com/xanzy/go-cloudstack/issues) ## Author Sander van Harmelen () ## License Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at go-cloudstack-2.9.0/cloudstack/000077500000000000000000000000001364073403100164165ustar00rootroot00000000000000go-cloudstack-2.9.0/cloudstack/APIDiscoveryService.go000066400000000000000000000052511364073403100225720ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" ) type ListApisParams struct { p map[string]interface{} } func (p *ListApisParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } return u } func (p *ListApisParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } // You should always use this function to get a new ListApisParams instance, // as then you are sure you have configured all required params func (s *APIDiscoveryService) NewListApisParams() *ListApisParams { p := &ListApisParams{} p.p = make(map[string]interface{}) return p } // lists all available apis on the server, provided by the Api Discovery plugin func (s *APIDiscoveryService) ListApis(p *ListApisParams) (*ListApisResponse, error) { resp, err := s.cs.newRequest("listApis", p.toURLValues()) if err != nil { return nil, err } var r ListApisResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListApisResponse struct { Count int `json:"count"` Apis []*Api `json:"api"` } type Api struct { Description string `json:"description"` Isasync bool `json:"isasync"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Params []ApiParams `json:"params"` Related string `json:"related"` Response []ApiResponse `json:"response"` Since string `json:"since"` Type string `json:"type"` } type ApiResponse struct { Description string `json:"description"` Name string `json:"name"` Response []interface{} `json:"response"` Type string `json:"type"` } type ApiParams struct { Description string `json:"description"` Length int `json:"length"` Name string `json:"name"` Related string `json:"related"` Required bool `json:"required"` Since string `json:"since"` Type string `json:"type"` } go-cloudstack-2.9.0/cloudstack/AccountService.go000066400000000000000000002156611364073403100216750ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AddAccountToProjectParams struct { p map[string]interface{} } func (p *AddAccountToProjectParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["email"]; found { u.Set("email", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *AddAccountToProjectParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *AddAccountToProjectParams) SetEmail(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["email"] = v return } func (p *AddAccountToProjectParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new AddAccountToProjectParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewAddAccountToProjectParams(projectid string) *AddAccountToProjectParams { p := &AddAccountToProjectParams{} p.p = make(map[string]interface{}) p.p["projectid"] = projectid return p } // Adds account to a project func (s *AccountService) AddAccountToProject(p *AddAccountToProjectParams) (*AddAccountToProjectResponse, error) { resp, err := s.cs.newRequest("addAccountToProject", p.toURLValues()) if err != nil { return nil, err } var r AddAccountToProjectResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddAccountToProjectResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type CreateAccountParams struct { p map[string]interface{} } func (p *CreateAccountParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["accountdetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("accountdetails[%d].key", i), k) u.Set(fmt.Sprintf("accountdetails[%d].value", i), m[k]) } } if v, found := p.p["accountid"]; found { u.Set("accountid", v.(string)) } if v, found := p.p["accounttype"]; found { vv := strconv.Itoa(v.(int)) u.Set("accounttype", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["email"]; found { u.Set("email", v.(string)) } if v, found := p.p["firstname"]; found { u.Set("firstname", v.(string)) } if v, found := p.p["lastname"]; found { u.Set("lastname", v.(string)) } if v, found := p.p["networkdomain"]; found { u.Set("networkdomain", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["roleid"]; found { u.Set("roleid", v.(string)) } if v, found := p.p["timezone"]; found { u.Set("timezone", v.(string)) } if v, found := p.p["userid"]; found { u.Set("userid", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *CreateAccountParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateAccountParams) SetAccountdetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountdetails"] = v return } func (p *CreateAccountParams) SetAccountid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountid"] = v return } func (p *CreateAccountParams) SetAccounttype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accounttype"] = v return } func (p *CreateAccountParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateAccountParams) SetEmail(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["email"] = v return } func (p *CreateAccountParams) SetFirstname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["firstname"] = v return } func (p *CreateAccountParams) SetLastname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lastname"] = v return } func (p *CreateAccountParams) SetNetworkdomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdomain"] = v return } func (p *CreateAccountParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *CreateAccountParams) SetRoleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["roleid"] = v return } func (p *CreateAccountParams) SetTimezone(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["timezone"] = v return } func (p *CreateAccountParams) SetUserid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["userid"] = v return } func (p *CreateAccountParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new CreateAccountParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewCreateAccountParams(email string, firstname string, lastname string, password string, username string) *CreateAccountParams { p := &CreateAccountParams{} p.p = make(map[string]interface{}) p.p["email"] = email p.p["firstname"] = firstname p.p["lastname"] = lastname p.p["password"] = password p.p["username"] = username return p } // Creates an account func (s *AccountService) CreateAccount(p *CreateAccountParams) (*CreateAccountResponse, error) { resp, err := s.cs.newRequest("createAccount", p.toURLValues()) if err != nil { return nil, err } if resp, err = getRawValue(resp); err != nil { return nil, err } var r CreateAccountResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateAccountResponse struct { Accountdetails map[string]string `json:"accountdetails"` Accounttype int `json:"accounttype"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Defaultzoneid string `json:"defaultzoneid"` Domain string `json:"domain"` Domainid string `json:"domainid"` Groups []string `json:"groups"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` Iscleanuprequired bool `json:"iscleanuprequired"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Receivedbytes int64 `json:"receivedbytes"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Sentbytes int64 `json:"sentbytes"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` User []CreateAccountResponseUser `json:"user"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type CreateAccountResponseUser struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type DeleteAccountParams struct { p map[string]interface{} } func (p *DeleteAccountParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteAccountParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteAccountParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewDeleteAccountParams(id string) *DeleteAccountParams { p := &DeleteAccountParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a account, and all users associated with this account func (s *AccountService) DeleteAccount(p *DeleteAccountParams) (*DeleteAccountResponse, error) { resp, err := s.cs.newRequest("deleteAccount", p.toURLValues()) if err != nil { return nil, err } var r DeleteAccountResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteAccountResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteAccountFromProjectParams struct { p map[string]interface{} } func (p *DeleteAccountFromProjectParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *DeleteAccountFromProjectParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DeleteAccountFromProjectParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new DeleteAccountFromProjectParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewDeleteAccountFromProjectParams(account string, projectid string) *DeleteAccountFromProjectParams { p := &DeleteAccountFromProjectParams{} p.p = make(map[string]interface{}) p.p["account"] = account p.p["projectid"] = projectid return p } // Deletes account from the project func (s *AccountService) DeleteAccountFromProject(p *DeleteAccountFromProjectParams) (*DeleteAccountFromProjectResponse, error) { resp, err := s.cs.newRequest("deleteAccountFromProject", p.toURLValues()) if err != nil { return nil, err } var r DeleteAccountFromProjectResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteAccountFromProjectResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DisableAccountParams struct { p map[string]interface{} } func (p *DisableAccountParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["lock"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("lock", vv) } return u } func (p *DisableAccountParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DisableAccountParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DisableAccountParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *DisableAccountParams) SetLock(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lock"] = v return } // You should always use this function to get a new DisableAccountParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewDisableAccountParams(lock bool) *DisableAccountParams { p := &DisableAccountParams{} p.p = make(map[string]interface{}) p.p["lock"] = lock return p } // Disables an account func (s *AccountService) DisableAccount(p *DisableAccountParams) (*DisableAccountResponse, error) { resp, err := s.cs.newRequest("disableAccount", p.toURLValues()) if err != nil { return nil, err } var r DisableAccountResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DisableAccountResponse struct { Accountdetails map[string]string `json:"accountdetails"` Accounttype int `json:"accounttype"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Defaultzoneid string `json:"defaultzoneid"` Domain string `json:"domain"` Domainid string `json:"domainid"` Groups []string `json:"groups"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` Iscleanuprequired bool `json:"iscleanuprequired"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Receivedbytes int64 `json:"receivedbytes"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Sentbytes int64 `json:"sentbytes"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` User []DisableAccountResponseUser `json:"user"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type DisableAccountResponseUser struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type EnableAccountParams struct { p map[string]interface{} } func (p *EnableAccountParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *EnableAccountParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *EnableAccountParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *EnableAccountParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new EnableAccountParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewEnableAccountParams() *EnableAccountParams { p := &EnableAccountParams{} p.p = make(map[string]interface{}) return p } // Enables an account func (s *AccountService) EnableAccount(p *EnableAccountParams) (*EnableAccountResponse, error) { resp, err := s.cs.newRequest("enableAccount", p.toURLValues()) if err != nil { return nil, err } var r EnableAccountResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type EnableAccountResponse struct { Accountdetails map[string]string `json:"accountdetails"` Accounttype int `json:"accounttype"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Defaultzoneid string `json:"defaultzoneid"` Domain string `json:"domain"` Domainid string `json:"domainid"` Groups []string `json:"groups"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` Iscleanuprequired bool `json:"iscleanuprequired"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Receivedbytes int64 `json:"receivedbytes"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Sentbytes int64 `json:"sentbytes"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` User []EnableAccountResponseUser `json:"user"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type EnableAccountResponseUser struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type GetSolidFireAccountIdParams struct { p map[string]interface{} } func (p *GetSolidFireAccountIdParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["accountid"]; found { u.Set("accountid", v.(string)) } if v, found := p.p["storageid"]; found { u.Set("storageid", v.(string)) } return u } func (p *GetSolidFireAccountIdParams) SetAccountid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountid"] = v return } func (p *GetSolidFireAccountIdParams) SetStorageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storageid"] = v return } // You should always use this function to get a new GetSolidFireAccountIdParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewGetSolidFireAccountIdParams(accountid string, storageid string) *GetSolidFireAccountIdParams { p := &GetSolidFireAccountIdParams{} p.p = make(map[string]interface{}) p.p["accountid"] = accountid p.p["storageid"] = storageid return p } // Get SolidFire Account ID func (s *AccountService) GetSolidFireAccountId(p *GetSolidFireAccountIdParams) (*GetSolidFireAccountIdResponse, error) { resp, err := s.cs.newRequest("getSolidFireAccountId", p.toURLValues()) if err != nil { return nil, err } var r GetSolidFireAccountIdResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetSolidFireAccountIdResponse struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` SolidFireAccountId int64 `json:"solidFireAccountId"` } type ListAccountsParams struct { p map[string]interface{} } func (p *ListAccountsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["accounttype"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("accounttype", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["iscleanuprequired"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("iscleanuprequired", vv) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } return u } func (p *ListAccountsParams) SetAccounttype(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accounttype"] = v return } func (p *ListAccountsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListAccountsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListAccountsParams) SetIscleanuprequired(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iscleanuprequired"] = v return } func (p *ListAccountsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListAccountsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListAccountsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListAccountsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListAccountsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListAccountsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListAccountsParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } // You should always use this function to get a new ListAccountsParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewListAccountsParams() *ListAccountsParams { p := &ListAccountsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AccountService) GetAccountID(name string, opts ...OptionFunc) (string, int, error) { p := &ListAccountsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListAccounts(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Accounts[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Accounts { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AccountService) GetAccountByName(name string, opts ...OptionFunc) (*Account, int, error) { id, count, err := s.GetAccountID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetAccountByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AccountService) GetAccountByID(id string, opts ...OptionFunc) (*Account, int, error) { p := &ListAccountsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListAccounts(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Accounts[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Account UUID: %s!", id) } // Lists accounts and provides detailed account information for listed accounts func (s *AccountService) ListAccounts(p *ListAccountsParams) (*ListAccountsResponse, error) { resp, err := s.cs.newRequest("listAccounts", p.toURLValues()) if err != nil { return nil, err } var r ListAccountsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListAccountsResponse struct { Count int `json:"count"` Accounts []*Account `json:"account"` } type Account struct { Accountdetails map[string]string `json:"accountdetails"` Accounttype int `json:"accounttype"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Defaultzoneid string `json:"defaultzoneid"` Domain string `json:"domain"` Domainid string `json:"domainid"` Groups []string `json:"groups"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` Iscleanuprequired bool `json:"iscleanuprequired"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Receivedbytes int64 `json:"receivedbytes"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Sentbytes int64 `json:"sentbytes"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` User []AccountUser `json:"user"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type AccountUser struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type ListProjectAccountsParams struct { p map[string]interface{} } func (p *ListProjectAccountsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["role"]; found { u.Set("role", v.(string)) } return u } func (p *ListProjectAccountsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListProjectAccountsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListProjectAccountsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListProjectAccountsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListProjectAccountsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListProjectAccountsParams) SetRole(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["role"] = v return } // You should always use this function to get a new ListProjectAccountsParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewListProjectAccountsParams(projectid string) *ListProjectAccountsParams { p := &ListProjectAccountsParams{} p.p = make(map[string]interface{}) p.p["projectid"] = projectid return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AccountService) GetProjectAccountID(keyword string, projectid string, opts ...OptionFunc) (string, int, error) { p := &ListProjectAccountsParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword p.p["projectid"] = projectid for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListProjectAccounts(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.ProjectAccounts[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.ProjectAccounts { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // Lists project's accounts func (s *AccountService) ListProjectAccounts(p *ListProjectAccountsParams) (*ListProjectAccountsResponse, error) { resp, err := s.cs.newRequest("listProjectAccounts", p.toURLValues()) if err != nil { return nil, err } var r ListProjectAccountsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListProjectAccountsResponse struct { Count int `json:"count"` ProjectAccounts []*ProjectAccount `json:"projectaccount"` } type ProjectAccount struct { Account string `json:"account"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectaccountname string `json:"projectaccountname"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Tags []Tags `json:"tags"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type Tags struct { Account string `json:"account"` Customer string `json:"customer"` Domain string `json:"domain"` Domainid string `json:"domainid"` Key string `json:"key"` Project string `json:"project"` Projectid string `json:"projectid"` Resourceid string `json:"resourceid"` Resourcetype string `json:"resourcetype"` Value string `json:"value"` } type LockAccountParams struct { p map[string]interface{} } func (p *LockAccountParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } return u } func (p *LockAccountParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *LockAccountParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } // You should always use this function to get a new LockAccountParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewLockAccountParams(account string, domainid string) *LockAccountParams { p := &LockAccountParams{} p.p = make(map[string]interface{}) p.p["account"] = account p.p["domainid"] = domainid return p } // This deprecated function used to locks an account. Look for the API DisableAccount instead func (s *AccountService) LockAccount(p *LockAccountParams) (*LockAccountResponse, error) { resp, err := s.cs.newRequest("lockAccount", p.toURLValues()) if err != nil { return nil, err } var r LockAccountResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type LockAccountResponse struct { Accountdetails map[string]string `json:"accountdetails"` Accounttype int `json:"accounttype"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Defaultzoneid string `json:"defaultzoneid"` Domain string `json:"domain"` Domainid string `json:"domainid"` Groups []string `json:"groups"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` Iscleanuprequired bool `json:"iscleanuprequired"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Receivedbytes int64 `json:"receivedbytes"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Sentbytes int64 `json:"sentbytes"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` User []LockAccountResponseUser `json:"user"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type LockAccountResponseUser struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type MarkDefaultZoneForAccountParams struct { p map[string]interface{} } func (p *MarkDefaultZoneForAccountParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *MarkDefaultZoneForAccountParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *MarkDefaultZoneForAccountParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *MarkDefaultZoneForAccountParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new MarkDefaultZoneForAccountParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewMarkDefaultZoneForAccountParams(account string, domainid string, zoneid string) *MarkDefaultZoneForAccountParams { p := &MarkDefaultZoneForAccountParams{} p.p = make(map[string]interface{}) p.p["account"] = account p.p["domainid"] = domainid p.p["zoneid"] = zoneid return p } // Marks a default zone for this account func (s *AccountService) MarkDefaultZoneForAccount(p *MarkDefaultZoneForAccountParams) (*MarkDefaultZoneForAccountResponse, error) { resp, err := s.cs.newRequest("markDefaultZoneForAccount", p.toURLValues()) if err != nil { return nil, err } var r MarkDefaultZoneForAccountResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type MarkDefaultZoneForAccountResponse struct { Accountdetails map[string]string `json:"accountdetails"` Accounttype int `json:"accounttype"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Defaultzoneid string `json:"defaultzoneid"` Domain string `json:"domain"` Domainid string `json:"domainid"` Groups []string `json:"groups"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` Iscleanuprequired bool `json:"iscleanuprequired"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Receivedbytes int64 `json:"receivedbytes"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Sentbytes int64 `json:"sentbytes"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` User []MarkDefaultZoneForAccountResponseUser `json:"user"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type MarkDefaultZoneForAccountResponseUser struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type UpdateAccountParams struct { p map[string]interface{} } func (p *UpdateAccountParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["accountdetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("accountdetails[%d].key", i), k) u.Set(fmt.Sprintf("accountdetails[%d].value", i), m[k]) } } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["networkdomain"]; found { u.Set("networkdomain", v.(string)) } if v, found := p.p["newname"]; found { u.Set("newname", v.(string)) } if v, found := p.p["roleid"]; found { u.Set("roleid", v.(string)) } return u } func (p *UpdateAccountParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *UpdateAccountParams) SetAccountdetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountdetails"] = v return } func (p *UpdateAccountParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *UpdateAccountParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateAccountParams) SetNetworkdomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdomain"] = v return } func (p *UpdateAccountParams) SetNewname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["newname"] = v return } func (p *UpdateAccountParams) SetRoleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["roleid"] = v return } // You should always use this function to get a new UpdateAccountParams instance, // as then you are sure you have configured all required params func (s *AccountService) NewUpdateAccountParams() *UpdateAccountParams { p := &UpdateAccountParams{} p.p = make(map[string]interface{}) return p } // Updates account information for the authenticated user func (s *AccountService) UpdateAccount(p *UpdateAccountParams) (*UpdateAccountResponse, error) { resp, err := s.cs.newRequest("updateAccount", p.toURLValues()) if err != nil { return nil, err } var r UpdateAccountResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateAccountResponse struct { Accountdetails map[string]string `json:"accountdetails"` Accounttype int `json:"accounttype"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Defaultzoneid string `json:"defaultzoneid"` Domain string `json:"domain"` Domainid string `json:"domainid"` Groups []string `json:"groups"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` Iscleanuprequired bool `json:"iscleanuprequired"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Receivedbytes int64 `json:"receivedbytes"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Sentbytes int64 `json:"sentbytes"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` User []UpdateAccountResponseUser `json:"user"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type UpdateAccountResponseUser struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } go-cloudstack-2.9.0/cloudstack/AddressService.go000066400000000000000000000506251364073403100216630ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AssociateIpAddressParams struct { p map[string]interface{} } func (p *AssociateIpAddressParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["isportable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isportable", vv) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["regionid"]; found { vv := strconv.Itoa(v.(int)) u.Set("regionid", vv) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *AssociateIpAddressParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *AssociateIpAddressParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *AssociateIpAddressParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *AssociateIpAddressParams) SetIsportable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isportable"] = v return } func (p *AssociateIpAddressParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *AssociateIpAddressParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *AssociateIpAddressParams) SetRegionid(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["regionid"] = v return } func (p *AssociateIpAddressParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } func (p *AssociateIpAddressParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new AssociateIpAddressParams instance, // as then you are sure you have configured all required params func (s *AddressService) NewAssociateIpAddressParams() *AssociateIpAddressParams { p := &AssociateIpAddressParams{} p.p = make(map[string]interface{}) return p } // Acquires and associates a public IP to an account. Either of the parameters are required, i.e. either zoneId, or networkId, or vpcId func (s *AddressService) AssociateIpAddress(p *AssociateIpAddressParams) (*AssociateIpAddressResponse, error) { resp, err := s.cs.newRequest("associateIpAddress", p.toURLValues()) if err != nil { return nil, err } var r AssociateIpAddressResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AssociateIpAddressResponse struct { Account string `json:"account"` Allocated string `json:"allocated"` Associatednetworkid string `json:"associatednetworkid"` Associatednetworkname string `json:"associatednetworkname"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Isportable bool `json:"isportable"` Issourcenat bool `json:"issourcenat"` Isstaticnat bool `json:"isstaticnat"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Purpose string `json:"purpose"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualmachinedisplayname string `json:"virtualmachinedisplayname"` Virtualmachineid string `json:"virtualmachineid"` Virtualmachinename string `json:"virtualmachinename"` Vlanid string `json:"vlanid"` Vlanname string `json:"vlanname"` Vmipaddress string `json:"vmipaddress"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DisassociateIpAddressParams struct { p map[string]interface{} } func (p *DisassociateIpAddressParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DisassociateIpAddressParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DisassociateIpAddressParams instance, // as then you are sure you have configured all required params func (s *AddressService) NewDisassociateIpAddressParams(id string) *DisassociateIpAddressParams { p := &DisassociateIpAddressParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Disassociates an IP address from the account. func (s *AddressService) DisassociateIpAddress(p *DisassociateIpAddressParams) (*DisassociateIpAddressResponse, error) { resp, err := s.cs.newRequest("disassociateIpAddress", p.toURLValues()) if err != nil { return nil, err } var r DisassociateIpAddressResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DisassociateIpAddressResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListPublicIpAddressesParams struct { p map[string]interface{} } func (p *ListPublicIpAddressesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["allocatedonly"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("allocatedonly", vv) } if v, found := p.p["associatednetworkid"]; found { u.Set("associatednetworkid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["forloadbalancing"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forloadbalancing", vv) } if v, found := p.p["forvirtualnetwork"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forvirtualnetwork", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ipaddress"]; found { u.Set("ipaddress", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["issourcenat"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("issourcenat", vv) } if v, found := p.p["isstaticnat"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isstaticnat", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["vlanid"]; found { u.Set("vlanid", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListPublicIpAddressesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListPublicIpAddressesParams) SetAllocatedonly(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocatedonly"] = v return } func (p *ListPublicIpAddressesParams) SetAssociatednetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["associatednetworkid"] = v return } func (p *ListPublicIpAddressesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListPublicIpAddressesParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListPublicIpAddressesParams) SetForloadbalancing(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forloadbalancing"] = v return } func (p *ListPublicIpAddressesParams) SetForvirtualnetwork(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forvirtualnetwork"] = v return } func (p *ListPublicIpAddressesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListPublicIpAddressesParams) SetIpaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddress"] = v return } func (p *ListPublicIpAddressesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListPublicIpAddressesParams) SetIssourcenat(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["issourcenat"] = v return } func (p *ListPublicIpAddressesParams) SetIsstaticnat(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isstaticnat"] = v return } func (p *ListPublicIpAddressesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListPublicIpAddressesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListPublicIpAddressesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListPublicIpAddressesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListPublicIpAddressesParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *ListPublicIpAddressesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListPublicIpAddressesParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListPublicIpAddressesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListPublicIpAddressesParams) SetVlanid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlanid"] = v return } func (p *ListPublicIpAddressesParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } func (p *ListPublicIpAddressesParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListPublicIpAddressesParams instance, // as then you are sure you have configured all required params func (s *AddressService) NewListPublicIpAddressesParams() *ListPublicIpAddressesParams { p := &ListPublicIpAddressesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AddressService) GetPublicIpAddressByID(id string, opts ...OptionFunc) (*PublicIpAddress, int, error) { p := &ListPublicIpAddressesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListPublicIpAddresses(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.PublicIpAddresses[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for PublicIpAddress UUID: %s!", id) } // Lists all public ip addresses func (s *AddressService) ListPublicIpAddresses(p *ListPublicIpAddressesParams) (*ListPublicIpAddressesResponse, error) { resp, err := s.cs.newRequest("listPublicIpAddresses", p.toURLValues()) if err != nil { return nil, err } var r ListPublicIpAddressesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListPublicIpAddressesResponse struct { Count int `json:"count"` PublicIpAddresses []*PublicIpAddress `json:"publicipaddress"` } type PublicIpAddress struct { Account string `json:"account"` Allocated string `json:"allocated"` Associatednetworkid string `json:"associatednetworkid"` Associatednetworkname string `json:"associatednetworkname"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Isportable bool `json:"isportable"` Issourcenat bool `json:"issourcenat"` Isstaticnat bool `json:"isstaticnat"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Purpose string `json:"purpose"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualmachinedisplayname string `json:"virtualmachinedisplayname"` Virtualmachineid string `json:"virtualmachineid"` Virtualmachinename string `json:"virtualmachinename"` Vlanid string `json:"vlanid"` Vlanname string `json:"vlanname"` Vmipaddress string `json:"vmipaddress"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateIpAddressParams struct { p map[string]interface{} } func (p *UpdateIpAddressParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateIpAddressParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateIpAddressParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateIpAddressParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateIpAddressParams instance, // as then you are sure you have configured all required params func (s *AddressService) NewUpdateIpAddressParams(id string) *UpdateIpAddressParams { p := &UpdateIpAddressParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates an IP address func (s *AddressService) UpdateIpAddress(p *UpdateIpAddressParams) (*UpdateIpAddressResponse, error) { resp, err := s.cs.newRequest("updateIpAddress", p.toURLValues()) if err != nil { return nil, err } var r UpdateIpAddressResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateIpAddressResponse struct { Account string `json:"account"` Allocated string `json:"allocated"` Associatednetworkid string `json:"associatednetworkid"` Associatednetworkname string `json:"associatednetworkname"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Isportable bool `json:"isportable"` Issourcenat bool `json:"issourcenat"` Isstaticnat bool `json:"isstaticnat"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Purpose string `json:"purpose"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualmachinedisplayname string `json:"virtualmachinedisplayname"` Virtualmachineid string `json:"virtualmachineid"` Virtualmachinename string `json:"virtualmachinename"` Vlanid string `json:"vlanid"` Vlanname string `json:"vlanname"` Vmipaddress string `json:"vmipaddress"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/AffinityGroupService.go000066400000000000000000000632651364073403100230700ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateAffinityGroupParams struct { p map[string]interface{} } func (p *CreateAffinityGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *CreateAffinityGroupParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateAffinityGroupParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateAffinityGroupParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateAffinityGroupParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateAffinityGroupParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *CreateAffinityGroupParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new CreateAffinityGroupParams instance, // as then you are sure you have configured all required params func (s *AffinityGroupService) NewCreateAffinityGroupParams(name string, affinityGroupType string) *CreateAffinityGroupParams { p := &CreateAffinityGroupParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["type"] = affinityGroupType return p } // Creates an affinity/anti-affinity group func (s *AffinityGroupService) CreateAffinityGroup(p *CreateAffinityGroupParams) (*CreateAffinityGroupResponse, error) { resp, err := s.cs.newRequest("createAffinityGroup", p.toURLValues()) if err != nil { return nil, err } var r CreateAffinityGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateAffinityGroupResponse struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } type DeleteAffinityGroupParams struct { p map[string]interface{} } func (p *DeleteAffinityGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *DeleteAffinityGroupParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DeleteAffinityGroupParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DeleteAffinityGroupParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *DeleteAffinityGroupParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *DeleteAffinityGroupParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new DeleteAffinityGroupParams instance, // as then you are sure you have configured all required params func (s *AffinityGroupService) NewDeleteAffinityGroupParams() *DeleteAffinityGroupParams { p := &DeleteAffinityGroupParams{} p.p = make(map[string]interface{}) return p } // Deletes affinity group func (s *AffinityGroupService) DeleteAffinityGroup(p *DeleteAffinityGroupParams) (*DeleteAffinityGroupResponse, error) { resp, err := s.cs.newRequest("deleteAffinityGroup", p.toURLValues()) if err != nil { return nil, err } var r DeleteAffinityGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteAffinityGroupResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListAffinityGroupTypesParams struct { p map[string]interface{} } func (p *ListAffinityGroupTypesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListAffinityGroupTypesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListAffinityGroupTypesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListAffinityGroupTypesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListAffinityGroupTypesParams instance, // as then you are sure you have configured all required params func (s *AffinityGroupService) NewListAffinityGroupTypesParams() *ListAffinityGroupTypesParams { p := &ListAffinityGroupTypesParams{} p.p = make(map[string]interface{}) return p } // Lists affinity group types available func (s *AffinityGroupService) ListAffinityGroupTypes(p *ListAffinityGroupTypesParams) (*ListAffinityGroupTypesResponse, error) { resp, err := s.cs.newRequest("listAffinityGroupTypes", p.toURLValues()) if err != nil { return nil, err } var r ListAffinityGroupTypesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListAffinityGroupTypesResponse struct { Count int `json:"count"` AffinityGroupTypes []*AffinityGroupType `json:"affinitygrouptype"` } type AffinityGroupType struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Type string `json:"type"` } type ListAffinityGroupsParams struct { p map[string]interface{} } func (p *ListAffinityGroupsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *ListAffinityGroupsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListAffinityGroupsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListAffinityGroupsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListAffinityGroupsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListAffinityGroupsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListAffinityGroupsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListAffinityGroupsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListAffinityGroupsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListAffinityGroupsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListAffinityGroupsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListAffinityGroupsParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } func (p *ListAffinityGroupsParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new ListAffinityGroupsParams instance, // as then you are sure you have configured all required params func (s *AffinityGroupService) NewListAffinityGroupsParams() *ListAffinityGroupsParams { p := &ListAffinityGroupsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AffinityGroupService) GetAffinityGroupID(name string, opts ...OptionFunc) (string, int, error) { p := &ListAffinityGroupsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListAffinityGroups(p) if err != nil { return "", -1, err } // This is needed because of a bug with the listAffinityGroup call. It reports the // number of VirtualMachines in the groups as being the number of groups found. l.Count = len(l.AffinityGroups) if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.AffinityGroups[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.AffinityGroups { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AffinityGroupService) GetAffinityGroupByName(name string, opts ...OptionFunc) (*AffinityGroup, int, error) { id, count, err := s.GetAffinityGroupID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetAffinityGroupByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AffinityGroupService) GetAffinityGroupByID(id string, opts ...OptionFunc) (*AffinityGroup, int, error) { p := &ListAffinityGroupsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListAffinityGroups(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } // This is needed because of a bug with the listAffinityGroup call. It reports the // number of VirtualMachines in the groups as being the number of groups found. l.Count = len(l.AffinityGroups) if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.AffinityGroups[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for AffinityGroup UUID: %s!", id) } // Lists affinity groups func (s *AffinityGroupService) ListAffinityGroups(p *ListAffinityGroupsParams) (*ListAffinityGroupsResponse, error) { resp, err := s.cs.newRequest("listAffinityGroups", p.toURLValues()) if err != nil { return nil, err } var r ListAffinityGroupsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListAffinityGroupsResponse struct { Count int `json:"count"` AffinityGroups []*AffinityGroup `json:"affinitygroup"` } type AffinityGroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } type UpdateVMAffinityGroupParams struct { p map[string]interface{} } func (p *UpdateVMAffinityGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["affinitygroupids"]; found { vv := strings.Join(v.([]string), ",") u.Set("affinitygroupids", vv) } if v, found := p.p["affinitygroupnames"]; found { vv := strings.Join(v.([]string), ",") u.Set("affinitygroupnames", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateVMAffinityGroupParams) SetAffinitygroupids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["affinitygroupids"] = v return } func (p *UpdateVMAffinityGroupParams) SetAffinitygroupnames(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["affinitygroupnames"] = v return } func (p *UpdateVMAffinityGroupParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateVMAffinityGroupParams instance, // as then you are sure you have configured all required params func (s *AffinityGroupService) NewUpdateVMAffinityGroupParams(id string) *UpdateVMAffinityGroupParams { p := &UpdateVMAffinityGroupParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. func (s *AffinityGroupService) UpdateVMAffinityGroup(p *UpdateVMAffinityGroupParams) (*UpdateVMAffinityGroupResponse, error) { resp, err := s.cs.newRequest("updateVMAffinityGroup", p.toURLValues()) if err != nil { return nil, err } var r UpdateVMAffinityGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateVMAffinityGroupResponse struct { Account string `json:"account"` Affinitygroup []UpdateVMAffinityGroupResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []UpdateVMAffinityGroupResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateVMAffinityGroupResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []UpdateVMAffinityGroupResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []UpdateVMAffinityGroupResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type UpdateVMAffinityGroupResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type UpdateVMAffinityGroupResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *UpdateVMAffinityGroupResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateVMAffinityGroupResponse return json.Unmarshal(b, (*alias)(r)) } go-cloudstack-2.9.0/cloudstack/AlertService.go000066400000000000000000000304711364073403100213420ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type ArchiveAlertsParams struct { p map[string]interface{} } func (p *ArchiveAlertsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["enddate"]; found { u.Set("enddate", v.(string)) } if v, found := p.p["ids"]; found { vv := strings.Join(v.([]string), ",") u.Set("ids", vv) } if v, found := p.p["startdate"]; found { u.Set("startdate", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *ArchiveAlertsParams) SetEnddate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enddate"] = v return } func (p *ArchiveAlertsParams) SetIds(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ids"] = v return } func (p *ArchiveAlertsParams) SetStartdate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startdate"] = v return } func (p *ArchiveAlertsParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new ArchiveAlertsParams instance, // as then you are sure you have configured all required params func (s *AlertService) NewArchiveAlertsParams() *ArchiveAlertsParams { p := &ArchiveAlertsParams{} p.p = make(map[string]interface{}) return p } // Archive one or more alerts. func (s *AlertService) ArchiveAlerts(p *ArchiveAlertsParams) (*ArchiveAlertsResponse, error) { resp, err := s.cs.newRequest("archiveAlerts", p.toURLValues()) if err != nil { return nil, err } var r ArchiveAlertsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ArchiveAlertsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *ArchiveAlertsResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias ArchiveAlertsResponse return json.Unmarshal(b, (*alias)(r)) } type DeleteAlertsParams struct { p map[string]interface{} } func (p *DeleteAlertsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["enddate"]; found { u.Set("enddate", v.(string)) } if v, found := p.p["ids"]; found { vv := strings.Join(v.([]string), ",") u.Set("ids", vv) } if v, found := p.p["startdate"]; found { u.Set("startdate", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *DeleteAlertsParams) SetEnddate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enddate"] = v return } func (p *DeleteAlertsParams) SetIds(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ids"] = v return } func (p *DeleteAlertsParams) SetStartdate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startdate"] = v return } func (p *DeleteAlertsParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new DeleteAlertsParams instance, // as then you are sure you have configured all required params func (s *AlertService) NewDeleteAlertsParams() *DeleteAlertsParams { p := &DeleteAlertsParams{} p.p = make(map[string]interface{}) return p } // Delete one or more alerts. func (s *AlertService) DeleteAlerts(p *DeleteAlertsParams) (*DeleteAlertsResponse, error) { resp, err := s.cs.newRequest("deleteAlerts", p.toURLValues()) if err != nil { return nil, err } var r DeleteAlertsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteAlertsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteAlertsResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteAlertsResponse return json.Unmarshal(b, (*alias)(r)) } type GenerateAlertParams struct { p map[string]interface{} } func (p *GenerateAlertParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["type"]; found { vv := strconv.Itoa(v.(int)) u.Set("type", vv) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *GenerateAlertParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *GenerateAlertParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *GenerateAlertParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *GenerateAlertParams) SetType(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } func (p *GenerateAlertParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new GenerateAlertParams instance, // as then you are sure you have configured all required params func (s *AlertService) NewGenerateAlertParams(description string, name string, alertType int) *GenerateAlertParams { p := &GenerateAlertParams{} p.p = make(map[string]interface{}) p.p["description"] = description p.p["name"] = name p.p["type"] = alertType return p } // Generates an alert func (s *AlertService) GenerateAlert(p *GenerateAlertParams) (*GenerateAlertResponse, error) { resp, err := s.cs.newRequest("generateAlert", p.toURLValues()) if err != nil { return nil, err } var r GenerateAlertResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type GenerateAlertResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListAlertsParams struct { p map[string]interface{} } func (p *ListAlertsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *ListAlertsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListAlertsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListAlertsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListAlertsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListAlertsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListAlertsParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new ListAlertsParams instance, // as then you are sure you have configured all required params func (s *AlertService) NewListAlertsParams() *ListAlertsParams { p := &ListAlertsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AlertService) GetAlertID(name string, opts ...OptionFunc) (string, int, error) { p := &ListAlertsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListAlerts(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Alerts[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Alerts { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AlertService) GetAlertByName(name string, opts ...OptionFunc) (*Alert, int, error) { id, count, err := s.GetAlertID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetAlertByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AlertService) GetAlertByID(id string, opts ...OptionFunc) (*Alert, int, error) { p := &ListAlertsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListAlerts(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Alerts[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Alert UUID: %s!", id) } // Lists all alerts. func (s *AlertService) ListAlerts(p *ListAlertsParams) (*ListAlertsResponse, error) { resp, err := s.cs.newRequest("listAlerts", p.toURLValues()) if err != nil { return nil, err } var r ListAlertsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListAlertsResponse struct { Count int `json:"count"` Alerts []*Alert `json:"alert"` } type Alert struct { Description string `json:"description"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Sent string `json:"sent"` Type int `json:"type"` } go-cloudstack-2.9.0/cloudstack/AsyncjobService.go000066400000000000000000000142401364073403100220370ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" "time" ) type ListAsyncJobsParams struct { p map[string]interface{} } func (p *ListAsyncJobsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["startdate"]; found { u.Set("startdate", v.(string)) } return u } func (p *ListAsyncJobsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListAsyncJobsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListAsyncJobsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListAsyncJobsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListAsyncJobsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListAsyncJobsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListAsyncJobsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListAsyncJobsParams) SetStartdate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startdate"] = v return } // You should always use this function to get a new ListAsyncJobsParams instance, // as then you are sure you have configured all required params func (s *AsyncjobService) NewListAsyncJobsParams() *ListAsyncJobsParams { p := &ListAsyncJobsParams{} p.p = make(map[string]interface{}) return p } // Lists all pending asynchronous jobs for the account. func (s *AsyncjobService) ListAsyncJobs(p *ListAsyncJobsParams) (*ListAsyncJobsResponse, error) { resp, err := s.cs.newRequest("listAsyncJobs", p.toURLValues()) if err != nil { return nil, err } var r ListAsyncJobsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListAsyncJobsResponse struct { Count int `json:"count"` AsyncJobs []*AsyncJob `json:"asyncjobs"` } type AsyncJob struct { Accountid string `json:"accountid"` Cmd string `json:"cmd"` Completed string `json:"completed"` Created string `json:"created"` JobID string `json:"jobid"` Jobinstanceid string `json:"jobinstanceid"` Jobinstancetype string `json:"jobinstancetype"` Jobprocstatus int `json:"jobprocstatus"` Jobresult json.RawMessage `json:"jobresult"` Jobresultcode int `json:"jobresultcode"` Jobresulttype string `json:"jobresulttype"` Jobstatus int `json:"jobstatus"` Userid string `json:"userid"` } type QueryAsyncJobResultParams struct { p map[string]interface{} } func (p *QueryAsyncJobResultParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["jobid"]; found { u.Set("jobid", v.(string)) } return u } func (p *QueryAsyncJobResultParams) SetJobID(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["jobid"] = v return } // You should always use this function to get a new QueryAsyncJobResultParams instance, // as then you are sure you have configured all required params func (s *AsyncjobService) NewQueryAsyncJobResultParams(jobid string) *QueryAsyncJobResultParams { p := &QueryAsyncJobResultParams{} p.p = make(map[string]interface{}) p.p["jobid"] = jobid return p } // Retrieves the current status of asynchronous job. func (s *AsyncjobService) QueryAsyncJobResult(p *QueryAsyncJobResultParams) (*QueryAsyncJobResultResponse, error) { var resp json.RawMessage var err error // We should be able to retry on failure as this call is idempotent for i := 0; i < 3; i++ { resp, err = s.cs.newRequest("queryAsyncJobResult", p.toURLValues()) if err == nil { break } time.Sleep(500 * time.Millisecond) } if err != nil { return nil, err } var r QueryAsyncJobResultResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type QueryAsyncJobResultResponse struct { Accountid string `json:"accountid"` Cmd string `json:"cmd"` Completed string `json:"completed"` Created string `json:"created"` JobID string `json:"jobid"` Jobinstanceid string `json:"jobinstanceid"` Jobinstancetype string `json:"jobinstancetype"` Jobprocstatus int `json:"jobprocstatus"` Jobresult json.RawMessage `json:"jobresult"` Jobresultcode int `json:"jobresultcode"` Jobresulttype string `json:"jobresulttype"` Jobstatus int `json:"jobstatus"` Userid string `json:"userid"` } go-cloudstack-2.9.0/cloudstack/AuthenticationService.go000066400000000000000000000077761364073403100232660ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type LoginParams struct { p map[string]interface{} } func (p *LoginParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["domain"]; found { u.Set("domain", v.(string)) } if v, found := p.p["domainId"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("domainId", vv) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *LoginParams) SetDomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domain"] = v return } func (p *LoginParams) SetDomainId(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainId"] = v return } func (p *LoginParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *LoginParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new LoginParams instance, // as then you are sure you have configured all required params func (s *AuthenticationService) NewLoginParams(password string, username string) *LoginParams { p := &LoginParams{} p.p = make(map[string]interface{}) p.p["password"] = password p.p["username"] = username return p } // Logs a user into the CloudStack. A successful login attempt will generate a JSESSIONID cookie value that can be passed in subsequent Query command calls until the "logout" command has been issued or the session has expired. func (s *AuthenticationService) Login(p *LoginParams) (*LoginResponse, error) { resp, err := s.cs.newRequest("login", p.toURLValues()) if err != nil { return nil, err } var r LoginResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type LoginResponse struct { Account string `json:"account"` Domainid string `json:"domainid"` Firstname string `json:"firstname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Registered string `json:"registered"` Sessionkey string `json:"sessionkey"` Timeout int `json:"timeout"` Timezone string `json:"timezone"` Timezoneoffset string `json:"timezoneoffset"` Type string `json:"type"` Userid string `json:"userid"` Username string `json:"username"` } type LogoutParams struct { p map[string]interface{} } func (p *LogoutParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } return u } // You should always use this function to get a new LogoutParams instance, // as then you are sure you have configured all required params func (s *AuthenticationService) NewLogoutParams() *LogoutParams { p := &LogoutParams{} p.p = make(map[string]interface{}) return p } // Logs out the user func (s *AuthenticationService) Logout(p *LogoutParams) (*LogoutResponse, error) { resp, err := s.cs.newRequest("logout", p.toURLValues()) if err != nil { return nil, err } var r LogoutResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type LogoutResponse struct { Description string `json:"description"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } go-cloudstack-2.9.0/cloudstack/AutoScaleService.go000066400000000000000000002076611364073403100221620ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateAutoScalePolicyParams struct { p map[string]interface{} } func (p *CreateAutoScalePolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["action"]; found { u.Set("action", v.(string)) } if v, found := p.p["conditionids"]; found { vv := strings.Join(v.([]string), ",") u.Set("conditionids", vv) } if v, found := p.p["duration"]; found { vv := strconv.Itoa(v.(int)) u.Set("duration", vv) } if v, found := p.p["quiettime"]; found { vv := strconv.Itoa(v.(int)) u.Set("quiettime", vv) } return u } func (p *CreateAutoScalePolicyParams) SetAction(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["action"] = v return } func (p *CreateAutoScalePolicyParams) SetConditionids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["conditionids"] = v return } func (p *CreateAutoScalePolicyParams) SetDuration(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["duration"] = v return } func (p *CreateAutoScalePolicyParams) SetQuiettime(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["quiettime"] = v return } // You should always use this function to get a new CreateAutoScalePolicyParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewCreateAutoScalePolicyParams(action string, conditionids []string, duration int) *CreateAutoScalePolicyParams { p := &CreateAutoScalePolicyParams{} p.p = make(map[string]interface{}) p.p["action"] = action p.p["conditionids"] = conditionids p.p["duration"] = duration return p } // Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale vm group. func (s *AutoScaleService) CreateAutoScalePolicy(p *CreateAutoScalePolicyParams) (*CreateAutoScalePolicyResponse, error) { resp, err := s.cs.newRequest("createAutoScalePolicy", p.toURLValues()) if err != nil { return nil, err } var r CreateAutoScalePolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateAutoScalePolicyResponse struct { Account string `json:"account"` Action string `json:"action"` Conditions []string `json:"conditions"` Domain string `json:"domain"` Domainid string `json:"domainid"` Duration int `json:"duration"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` Quiettime int `json:"quiettime"` } type CreateAutoScaleVmGroupParams struct { p map[string]interface{} } func (p *CreateAutoScaleVmGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["interval"]; found { vv := strconv.Itoa(v.(int)) u.Set("interval", vv) } if v, found := p.p["lbruleid"]; found { u.Set("lbruleid", v.(string)) } if v, found := p.p["maxmembers"]; found { vv := strconv.Itoa(v.(int)) u.Set("maxmembers", vv) } if v, found := p.p["minmembers"]; found { vv := strconv.Itoa(v.(int)) u.Set("minmembers", vv) } if v, found := p.p["scaledownpolicyids"]; found { vv := strings.Join(v.([]string), ",") u.Set("scaledownpolicyids", vv) } if v, found := p.p["scaleuppolicyids"]; found { vv := strings.Join(v.([]string), ",") u.Set("scaleuppolicyids", vv) } if v, found := p.p["vmprofileid"]; found { u.Set("vmprofileid", v.(string)) } return u } func (p *CreateAutoScaleVmGroupParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateAutoScaleVmGroupParams) SetInterval(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["interval"] = v return } func (p *CreateAutoScaleVmGroupParams) SetLbruleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbruleid"] = v return } func (p *CreateAutoScaleVmGroupParams) SetMaxmembers(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxmembers"] = v return } func (p *CreateAutoScaleVmGroupParams) SetMinmembers(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["minmembers"] = v return } func (p *CreateAutoScaleVmGroupParams) SetScaledownpolicyids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["scaledownpolicyids"] = v return } func (p *CreateAutoScaleVmGroupParams) SetScaleuppolicyids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["scaleuppolicyids"] = v return } func (p *CreateAutoScaleVmGroupParams) SetVmprofileid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmprofileid"] = v return } // You should always use this function to get a new CreateAutoScaleVmGroupParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewCreateAutoScaleVmGroupParams(lbruleid string, maxmembers int, minmembers int, scaledownpolicyids []string, scaleuppolicyids []string, vmprofileid string) *CreateAutoScaleVmGroupParams { p := &CreateAutoScaleVmGroupParams{} p.p = make(map[string]interface{}) p.p["lbruleid"] = lbruleid p.p["maxmembers"] = maxmembers p.p["minmembers"] = minmembers p.p["scaledownpolicyids"] = scaledownpolicyids p.p["scaleuppolicyids"] = scaleuppolicyids p.p["vmprofileid"] = vmprofileid return p } // Creates and automatically starts a virtual machine based on a service offering, disk offering, and template. func (s *AutoScaleService) CreateAutoScaleVmGroup(p *CreateAutoScaleVmGroupParams) (*CreateAutoScaleVmGroupResponse, error) { resp, err := s.cs.newRequest("createAutoScaleVmGroup", p.toURLValues()) if err != nil { return nil, err } var r CreateAutoScaleVmGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateAutoScaleVmGroupResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Interval int `json:"interval"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Maxmembers int `json:"maxmembers"` Minmembers int `json:"minmembers"` Project string `json:"project"` Projectid string `json:"projectid"` Scaledownpolicies []string `json:"scaledownpolicies"` Scaleuppolicies []string `json:"scaleuppolicies"` State string `json:"state"` Vmprofileid string `json:"vmprofileid"` } type CreateAutoScaleVmProfileParams struct { p map[string]interface{} } func (p *CreateAutoScaleVmProfileParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["autoscaleuserid"]; found { u.Set("autoscaleuserid", v.(string)) } if v, found := p.p["counterparam"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("counterparam[%d].key", i), k) u.Set(fmt.Sprintf("counterparam[%d].value", i), m[k]) } } if v, found := p.p["destroyvmgraceperiod"]; found { vv := strconv.Itoa(v.(int)) u.Set("destroyvmgraceperiod", vv) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["otherdeployparams"]; found { u.Set("otherdeployparams", v.(string)) } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } if v, found := p.p["templateid"]; found { u.Set("templateid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreateAutoScaleVmProfileParams) SetAutoscaleuserid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["autoscaleuserid"] = v return } func (p *CreateAutoScaleVmProfileParams) SetCounterparam(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["counterparam"] = v return } func (p *CreateAutoScaleVmProfileParams) SetDestroyvmgraceperiod(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["destroyvmgraceperiod"] = v return } func (p *CreateAutoScaleVmProfileParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateAutoScaleVmProfileParams) SetOtherdeployparams(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["otherdeployparams"] = v return } func (p *CreateAutoScaleVmProfileParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } func (p *CreateAutoScaleVmProfileParams) SetTemplateid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templateid"] = v return } func (p *CreateAutoScaleVmProfileParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreateAutoScaleVmProfileParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewCreateAutoScaleVmProfileParams(serviceofferingid string, templateid string, zoneid string) *CreateAutoScaleVmProfileParams { p := &CreateAutoScaleVmProfileParams{} p.p = make(map[string]interface{}) p.p["serviceofferingid"] = serviceofferingid p.p["templateid"] = templateid p.p["zoneid"] = zoneid return p } // Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature. func (s *AutoScaleService) CreateAutoScaleVmProfile(p *CreateAutoScaleVmProfileParams) (*CreateAutoScaleVmProfileResponse, error) { resp, err := s.cs.newRequest("createAutoScaleVmProfile", p.toURLValues()) if err != nil { return nil, err } var r CreateAutoScaleVmProfileResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateAutoScaleVmProfileResponse struct { Account string `json:"account"` Autoscaleuserid string `json:"autoscaleuserid"` Destroyvmgraceperiod int `json:"destroyvmgraceperiod"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Otherdeployparams string `json:"otherdeployparams"` Project string `json:"project"` Projectid string `json:"projectid"` Serviceofferingid string `json:"serviceofferingid"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` } type CreateConditionParams struct { p map[string]interface{} } func (p *CreateConditionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["counterid"]; found { u.Set("counterid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["relationaloperator"]; found { u.Set("relationaloperator", v.(string)) } if v, found := p.p["threshold"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("threshold", vv) } return u } func (p *CreateConditionParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateConditionParams) SetCounterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["counterid"] = v return } func (p *CreateConditionParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateConditionParams) SetRelationaloperator(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["relationaloperator"] = v return } func (p *CreateConditionParams) SetThreshold(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["threshold"] = v return } // You should always use this function to get a new CreateConditionParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewCreateConditionParams(counterid string, relationaloperator string, threshold int64) *CreateConditionParams { p := &CreateConditionParams{} p.p = make(map[string]interface{}) p.p["counterid"] = counterid p.p["relationaloperator"] = relationaloperator p.p["threshold"] = threshold return p } // Creates a condition func (s *AutoScaleService) CreateCondition(p *CreateConditionParams) (*CreateConditionResponse, error) { resp, err := s.cs.newRequest("createCondition", p.toURLValues()) if err != nil { return nil, err } var r CreateConditionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateConditionResponse struct { Account string `json:"account"` Counter []string `json:"counter"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` Relationaloperator string `json:"relationaloperator"` Threshold int64 `json:"threshold"` Zoneid string `json:"zoneid"` } type CreateCounterParams struct { p map[string]interface{} } func (p *CreateCounterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["source"]; found { u.Set("source", v.(string)) } if v, found := p.p["value"]; found { u.Set("value", v.(string)) } return u } func (p *CreateCounterParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateCounterParams) SetSource(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["source"] = v return } func (p *CreateCounterParams) SetValue(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["value"] = v return } // You should always use this function to get a new CreateCounterParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewCreateCounterParams(name string, source string, value string) *CreateCounterParams { p := &CreateCounterParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["source"] = source p.p["value"] = value return p } // Adds metric counter func (s *AutoScaleService) CreateCounter(p *CreateCounterParams) (*CreateCounterResponse, error) { resp, err := s.cs.newRequest("createCounter", p.toURLValues()) if err != nil { return nil, err } var r CreateCounterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateCounterResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Source string `json:"source"` Value string `json:"value"` Zoneid string `json:"zoneid"` } type DeleteAutoScalePolicyParams struct { p map[string]interface{} } func (p *DeleteAutoScalePolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteAutoScalePolicyParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteAutoScalePolicyParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewDeleteAutoScalePolicyParams(id string) *DeleteAutoScalePolicyParams { p := &DeleteAutoScalePolicyParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a autoscale policy. func (s *AutoScaleService) DeleteAutoScalePolicy(p *DeleteAutoScalePolicyParams) (*DeleteAutoScalePolicyResponse, error) { resp, err := s.cs.newRequest("deleteAutoScalePolicy", p.toURLValues()) if err != nil { return nil, err } var r DeleteAutoScalePolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteAutoScalePolicyResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteAutoScaleVmGroupParams struct { p map[string]interface{} } func (p *DeleteAutoScaleVmGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteAutoScaleVmGroupParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteAutoScaleVmGroupParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewDeleteAutoScaleVmGroupParams(id string) *DeleteAutoScaleVmGroupParams { p := &DeleteAutoScaleVmGroupParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a autoscale vm group. func (s *AutoScaleService) DeleteAutoScaleVmGroup(p *DeleteAutoScaleVmGroupParams) (*DeleteAutoScaleVmGroupResponse, error) { resp, err := s.cs.newRequest("deleteAutoScaleVmGroup", p.toURLValues()) if err != nil { return nil, err } var r DeleteAutoScaleVmGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteAutoScaleVmGroupResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteAutoScaleVmProfileParams struct { p map[string]interface{} } func (p *DeleteAutoScaleVmProfileParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteAutoScaleVmProfileParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteAutoScaleVmProfileParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewDeleteAutoScaleVmProfileParams(id string) *DeleteAutoScaleVmProfileParams { p := &DeleteAutoScaleVmProfileParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a autoscale vm profile. func (s *AutoScaleService) DeleteAutoScaleVmProfile(p *DeleteAutoScaleVmProfileParams) (*DeleteAutoScaleVmProfileResponse, error) { resp, err := s.cs.newRequest("deleteAutoScaleVmProfile", p.toURLValues()) if err != nil { return nil, err } var r DeleteAutoScaleVmProfileResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteAutoScaleVmProfileResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteConditionParams struct { p map[string]interface{} } func (p *DeleteConditionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteConditionParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteConditionParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewDeleteConditionParams(id string) *DeleteConditionParams { p := &DeleteConditionParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Removes a condition func (s *AutoScaleService) DeleteCondition(p *DeleteConditionParams) (*DeleteConditionResponse, error) { resp, err := s.cs.newRequest("deleteCondition", p.toURLValues()) if err != nil { return nil, err } var r DeleteConditionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteConditionResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteCounterParams struct { p map[string]interface{} } func (p *DeleteCounterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteCounterParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteCounterParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewDeleteCounterParams(id string) *DeleteCounterParams { p := &DeleteCounterParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a counter func (s *AutoScaleService) DeleteCounter(p *DeleteCounterParams) (*DeleteCounterResponse, error) { resp, err := s.cs.newRequest("deleteCounter", p.toURLValues()) if err != nil { return nil, err } var r DeleteCounterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteCounterResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DisableAutoScaleVmGroupParams struct { p map[string]interface{} } func (p *DisableAutoScaleVmGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DisableAutoScaleVmGroupParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DisableAutoScaleVmGroupParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewDisableAutoScaleVmGroupParams(id string) *DisableAutoScaleVmGroupParams { p := &DisableAutoScaleVmGroupParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Disables an AutoScale Vm Group func (s *AutoScaleService) DisableAutoScaleVmGroup(p *DisableAutoScaleVmGroupParams) (*DisableAutoScaleVmGroupResponse, error) { resp, err := s.cs.newRequest("disableAutoScaleVmGroup", p.toURLValues()) if err != nil { return nil, err } var r DisableAutoScaleVmGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DisableAutoScaleVmGroupResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Interval int `json:"interval"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Maxmembers int `json:"maxmembers"` Minmembers int `json:"minmembers"` Project string `json:"project"` Projectid string `json:"projectid"` Scaledownpolicies []string `json:"scaledownpolicies"` Scaleuppolicies []string `json:"scaleuppolicies"` State string `json:"state"` Vmprofileid string `json:"vmprofileid"` } type EnableAutoScaleVmGroupParams struct { p map[string]interface{} } func (p *EnableAutoScaleVmGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *EnableAutoScaleVmGroupParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new EnableAutoScaleVmGroupParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewEnableAutoScaleVmGroupParams(id string) *EnableAutoScaleVmGroupParams { p := &EnableAutoScaleVmGroupParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Enables an AutoScale Vm Group func (s *AutoScaleService) EnableAutoScaleVmGroup(p *EnableAutoScaleVmGroupParams) (*EnableAutoScaleVmGroupResponse, error) { resp, err := s.cs.newRequest("enableAutoScaleVmGroup", p.toURLValues()) if err != nil { return nil, err } var r EnableAutoScaleVmGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type EnableAutoScaleVmGroupResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Interval int `json:"interval"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Maxmembers int `json:"maxmembers"` Minmembers int `json:"minmembers"` Project string `json:"project"` Projectid string `json:"projectid"` Scaledownpolicies []string `json:"scaledownpolicies"` Scaleuppolicies []string `json:"scaleuppolicies"` State string `json:"state"` Vmprofileid string `json:"vmprofileid"` } type ListAutoScalePoliciesParams struct { p map[string]interface{} } func (p *ListAutoScalePoliciesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["action"]; found { u.Set("action", v.(string)) } if v, found := p.p["conditionid"]; found { u.Set("conditionid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["vmgroupid"]; found { u.Set("vmgroupid", v.(string)) } return u } func (p *ListAutoScalePoliciesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListAutoScalePoliciesParams) SetAction(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["action"] = v return } func (p *ListAutoScalePoliciesParams) SetConditionid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["conditionid"] = v return } func (p *ListAutoScalePoliciesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListAutoScalePoliciesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListAutoScalePoliciesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListAutoScalePoliciesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListAutoScalePoliciesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListAutoScalePoliciesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListAutoScalePoliciesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListAutoScalePoliciesParams) SetVmgroupid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmgroupid"] = v return } // You should always use this function to get a new ListAutoScalePoliciesParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewListAutoScalePoliciesParams() *ListAutoScalePoliciesParams { p := &ListAutoScalePoliciesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AutoScaleService) GetAutoScalePolicyByID(id string, opts ...OptionFunc) (*AutoScalePolicy, int, error) { p := &ListAutoScalePoliciesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListAutoScalePolicies(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.AutoScalePolicies[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for AutoScalePolicy UUID: %s!", id) } // Lists autoscale policies. func (s *AutoScaleService) ListAutoScalePolicies(p *ListAutoScalePoliciesParams) (*ListAutoScalePoliciesResponse, error) { resp, err := s.cs.newRequest("listAutoScalePolicies", p.toURLValues()) if err != nil { return nil, err } var r ListAutoScalePoliciesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListAutoScalePoliciesResponse struct { Count int `json:"count"` AutoScalePolicies []*AutoScalePolicy `json:"autoscalepolicy"` } type AutoScalePolicy struct { Account string `json:"account"` Action string `json:"action"` Conditions []string `json:"conditions"` Domain string `json:"domain"` Domainid string `json:"domainid"` Duration int `json:"duration"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` Quiettime int `json:"quiettime"` } type ListAutoScaleVmGroupsParams struct { p map[string]interface{} } func (p *ListAutoScaleVmGroupsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["lbruleid"]; found { u.Set("lbruleid", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["policyid"]; found { u.Set("policyid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["vmprofileid"]; found { u.Set("vmprofileid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListAutoScaleVmGroupsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListAutoScaleVmGroupsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListAutoScaleVmGroupsParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListAutoScaleVmGroupsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListAutoScaleVmGroupsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListAutoScaleVmGroupsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListAutoScaleVmGroupsParams) SetLbruleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbruleid"] = v return } func (p *ListAutoScaleVmGroupsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListAutoScaleVmGroupsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListAutoScaleVmGroupsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListAutoScaleVmGroupsParams) SetPolicyid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["policyid"] = v return } func (p *ListAutoScaleVmGroupsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListAutoScaleVmGroupsParams) SetVmprofileid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmprofileid"] = v return } func (p *ListAutoScaleVmGroupsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListAutoScaleVmGroupsParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewListAutoScaleVmGroupsParams() *ListAutoScaleVmGroupsParams { p := &ListAutoScaleVmGroupsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AutoScaleService) GetAutoScaleVmGroupByID(id string, opts ...OptionFunc) (*AutoScaleVmGroup, int, error) { p := &ListAutoScaleVmGroupsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListAutoScaleVmGroups(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.AutoScaleVmGroups[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for AutoScaleVmGroup UUID: %s!", id) } // Lists autoscale vm groups. func (s *AutoScaleService) ListAutoScaleVmGroups(p *ListAutoScaleVmGroupsParams) (*ListAutoScaleVmGroupsResponse, error) { resp, err := s.cs.newRequest("listAutoScaleVmGroups", p.toURLValues()) if err != nil { return nil, err } var r ListAutoScaleVmGroupsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListAutoScaleVmGroupsResponse struct { Count int `json:"count"` AutoScaleVmGroups []*AutoScaleVmGroup `json:"autoscalevmgroup"` } type AutoScaleVmGroup struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Interval int `json:"interval"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Maxmembers int `json:"maxmembers"` Minmembers int `json:"minmembers"` Project string `json:"project"` Projectid string `json:"projectid"` Scaledownpolicies []string `json:"scaledownpolicies"` Scaleuppolicies []string `json:"scaleuppolicies"` State string `json:"state"` Vmprofileid string `json:"vmprofileid"` } type ListAutoScaleVmProfilesParams struct { p map[string]interface{} } func (p *ListAutoScaleVmProfilesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["otherdeployparams"]; found { u.Set("otherdeployparams", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } if v, found := p.p["templateid"]; found { u.Set("templateid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListAutoScaleVmProfilesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListAutoScaleVmProfilesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListAutoScaleVmProfilesParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListAutoScaleVmProfilesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListAutoScaleVmProfilesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListAutoScaleVmProfilesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListAutoScaleVmProfilesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListAutoScaleVmProfilesParams) SetOtherdeployparams(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["otherdeployparams"] = v return } func (p *ListAutoScaleVmProfilesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListAutoScaleVmProfilesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListAutoScaleVmProfilesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListAutoScaleVmProfilesParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } func (p *ListAutoScaleVmProfilesParams) SetTemplateid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templateid"] = v return } func (p *ListAutoScaleVmProfilesParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListAutoScaleVmProfilesParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewListAutoScaleVmProfilesParams() *ListAutoScaleVmProfilesParams { p := &ListAutoScaleVmProfilesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AutoScaleService) GetAutoScaleVmProfileByID(id string, opts ...OptionFunc) (*AutoScaleVmProfile, int, error) { p := &ListAutoScaleVmProfilesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListAutoScaleVmProfiles(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.AutoScaleVmProfiles[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for AutoScaleVmProfile UUID: %s!", id) } // Lists autoscale vm profiles. func (s *AutoScaleService) ListAutoScaleVmProfiles(p *ListAutoScaleVmProfilesParams) (*ListAutoScaleVmProfilesResponse, error) { resp, err := s.cs.newRequest("listAutoScaleVmProfiles", p.toURLValues()) if err != nil { return nil, err } var r ListAutoScaleVmProfilesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListAutoScaleVmProfilesResponse struct { Count int `json:"count"` AutoScaleVmProfiles []*AutoScaleVmProfile `json:"autoscalevmprofile"` } type AutoScaleVmProfile struct { Account string `json:"account"` Autoscaleuserid string `json:"autoscaleuserid"` Destroyvmgraceperiod int `json:"destroyvmgraceperiod"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Otherdeployparams string `json:"otherdeployparams"` Project string `json:"project"` Projectid string `json:"projectid"` Serviceofferingid string `json:"serviceofferingid"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` } type ListConditionsParams struct { p map[string]interface{} } func (p *ListConditionsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["counterid"]; found { u.Set("counterid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["policyid"]; found { u.Set("policyid", v.(string)) } return u } func (p *ListConditionsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListConditionsParams) SetCounterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["counterid"] = v return } func (p *ListConditionsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListConditionsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListConditionsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListConditionsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListConditionsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListConditionsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListConditionsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListConditionsParams) SetPolicyid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["policyid"] = v return } // You should always use this function to get a new ListConditionsParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewListConditionsParams() *ListConditionsParams { p := &ListConditionsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AutoScaleService) GetConditionByID(id string, opts ...OptionFunc) (*Condition, int, error) { p := &ListConditionsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListConditions(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Conditions[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Condition UUID: %s!", id) } // List Conditions for the specific user func (s *AutoScaleService) ListConditions(p *ListConditionsParams) (*ListConditionsResponse, error) { resp, err := s.cs.newRequest("listConditions", p.toURLValues()) if err != nil { return nil, err } var r ListConditionsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListConditionsResponse struct { Count int `json:"count"` Conditions []*Condition `json:"condition"` } type Condition struct { Account string `json:"account"` Counter []string `json:"counter"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` Relationaloperator string `json:"relationaloperator"` Threshold int64 `json:"threshold"` Zoneid string `json:"zoneid"` } type ListCountersParams struct { p map[string]interface{} } func (p *ListCountersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["source"]; found { u.Set("source", v.(string)) } return u } func (p *ListCountersParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListCountersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListCountersParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListCountersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListCountersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListCountersParams) SetSource(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["source"] = v return } // You should always use this function to get a new ListCountersParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewListCountersParams() *ListCountersParams { p := &ListCountersParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AutoScaleService) GetCounterID(name string, opts ...OptionFunc) (string, int, error) { p := &ListCountersParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListCounters(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Counters[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Counters { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AutoScaleService) GetCounterByName(name string, opts ...OptionFunc) (*Counter, int, error) { id, count, err := s.GetCounterID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetCounterByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *AutoScaleService) GetCounterByID(id string, opts ...OptionFunc) (*Counter, int, error) { p := &ListCountersParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListCounters(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Counters[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Counter UUID: %s!", id) } // List the counters func (s *AutoScaleService) ListCounters(p *ListCountersParams) (*ListCountersResponse, error) { resp, err := s.cs.newRequest("listCounters", p.toURLValues()) if err != nil { return nil, err } var r ListCountersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListCountersResponse struct { Count int `json:"count"` Counters []*Counter `json:"counter"` } type Counter struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Source string `json:"source"` Value string `json:"value"` Zoneid string `json:"zoneid"` } type UpdateAutoScalePolicyParams struct { p map[string]interface{} } func (p *UpdateAutoScalePolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["conditionids"]; found { vv := strings.Join(v.([]string), ",") u.Set("conditionids", vv) } if v, found := p.p["duration"]; found { vv := strconv.Itoa(v.(int)) u.Set("duration", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["quiettime"]; found { vv := strconv.Itoa(v.(int)) u.Set("quiettime", vv) } return u } func (p *UpdateAutoScalePolicyParams) SetConditionids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["conditionids"] = v return } func (p *UpdateAutoScalePolicyParams) SetDuration(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["duration"] = v return } func (p *UpdateAutoScalePolicyParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateAutoScalePolicyParams) SetQuiettime(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["quiettime"] = v return } // You should always use this function to get a new UpdateAutoScalePolicyParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewUpdateAutoScalePolicyParams(id string) *UpdateAutoScalePolicyParams { p := &UpdateAutoScalePolicyParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates an existing autoscale policy. func (s *AutoScaleService) UpdateAutoScalePolicy(p *UpdateAutoScalePolicyParams) (*UpdateAutoScalePolicyResponse, error) { resp, err := s.cs.newRequest("updateAutoScalePolicy", p.toURLValues()) if err != nil { return nil, err } var r UpdateAutoScalePolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateAutoScalePolicyResponse struct { Account string `json:"account"` Action string `json:"action"` Conditions []string `json:"conditions"` Domain string `json:"domain"` Domainid string `json:"domainid"` Duration int `json:"duration"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` Quiettime int `json:"quiettime"` } type UpdateAutoScaleVmGroupParams struct { p map[string]interface{} } func (p *UpdateAutoScaleVmGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["interval"]; found { vv := strconv.Itoa(v.(int)) u.Set("interval", vv) } if v, found := p.p["maxmembers"]; found { vv := strconv.Itoa(v.(int)) u.Set("maxmembers", vv) } if v, found := p.p["minmembers"]; found { vv := strconv.Itoa(v.(int)) u.Set("minmembers", vv) } if v, found := p.p["scaledownpolicyids"]; found { vv := strings.Join(v.([]string), ",") u.Set("scaledownpolicyids", vv) } if v, found := p.p["scaleuppolicyids"]; found { vv := strings.Join(v.([]string), ",") u.Set("scaleuppolicyids", vv) } return u } func (p *UpdateAutoScaleVmGroupParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateAutoScaleVmGroupParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateAutoScaleVmGroupParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateAutoScaleVmGroupParams) SetInterval(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["interval"] = v return } func (p *UpdateAutoScaleVmGroupParams) SetMaxmembers(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxmembers"] = v return } func (p *UpdateAutoScaleVmGroupParams) SetMinmembers(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["minmembers"] = v return } func (p *UpdateAutoScaleVmGroupParams) SetScaledownpolicyids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["scaledownpolicyids"] = v return } func (p *UpdateAutoScaleVmGroupParams) SetScaleuppolicyids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["scaleuppolicyids"] = v return } // You should always use this function to get a new UpdateAutoScaleVmGroupParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewUpdateAutoScaleVmGroupParams(id string) *UpdateAutoScaleVmGroupParams { p := &UpdateAutoScaleVmGroupParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates an existing autoscale vm group. func (s *AutoScaleService) UpdateAutoScaleVmGroup(p *UpdateAutoScaleVmGroupParams) (*UpdateAutoScaleVmGroupResponse, error) { resp, err := s.cs.newRequest("updateAutoScaleVmGroup", p.toURLValues()) if err != nil { return nil, err } var r UpdateAutoScaleVmGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateAutoScaleVmGroupResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Interval int `json:"interval"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Maxmembers int `json:"maxmembers"` Minmembers int `json:"minmembers"` Project string `json:"project"` Projectid string `json:"projectid"` Scaledownpolicies []string `json:"scaledownpolicies"` Scaleuppolicies []string `json:"scaleuppolicies"` State string `json:"state"` Vmprofileid string `json:"vmprofileid"` } type UpdateAutoScaleVmProfileParams struct { p map[string]interface{} } func (p *UpdateAutoScaleVmProfileParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["autoscaleuserid"]; found { u.Set("autoscaleuserid", v.(string)) } if v, found := p.p["counterparam"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("counterparam[%d].key", i), k) u.Set(fmt.Sprintf("counterparam[%d].value", i), m[k]) } } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["destroyvmgraceperiod"]; found { vv := strconv.Itoa(v.(int)) u.Set("destroyvmgraceperiod", vv) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["templateid"]; found { u.Set("templateid", v.(string)) } return u } func (p *UpdateAutoScaleVmProfileParams) SetAutoscaleuserid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["autoscaleuserid"] = v return } func (p *UpdateAutoScaleVmProfileParams) SetCounterparam(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["counterparam"] = v return } func (p *UpdateAutoScaleVmProfileParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateAutoScaleVmProfileParams) SetDestroyvmgraceperiod(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["destroyvmgraceperiod"] = v return } func (p *UpdateAutoScaleVmProfileParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateAutoScaleVmProfileParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateAutoScaleVmProfileParams) SetTemplateid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templateid"] = v return } // You should always use this function to get a new UpdateAutoScaleVmProfileParams instance, // as then you are sure you have configured all required params func (s *AutoScaleService) NewUpdateAutoScaleVmProfileParams(id string) *UpdateAutoScaleVmProfileParams { p := &UpdateAutoScaleVmProfileParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates an existing autoscale vm profile. func (s *AutoScaleService) UpdateAutoScaleVmProfile(p *UpdateAutoScaleVmProfileParams) (*UpdateAutoScaleVmProfileResponse, error) { resp, err := s.cs.newRequest("updateAutoScaleVmProfile", p.toURLValues()) if err != nil { return nil, err } var r UpdateAutoScaleVmProfileResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateAutoScaleVmProfileResponse struct { Account string `json:"account"` Autoscaleuserid string `json:"autoscaleuserid"` Destroyvmgraceperiod int `json:"destroyvmgraceperiod"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Otherdeployparams string `json:"otherdeployparams"` Project string `json:"project"` Projectid string `json:"projectid"` Serviceofferingid string `json:"serviceofferingid"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` } go-cloudstack-2.9.0/cloudstack/BaremetalService.go000066400000000000000000000605541364073403100221740ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type AddBaremetalDhcpParams struct { p map[string]interface{} } func (p *AddBaremetalDhcpParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["dhcpservertype"]; found { u.Set("dhcpservertype", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddBaremetalDhcpParams) SetDhcpservertype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dhcpservertype"] = v return } func (p *AddBaremetalDhcpParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddBaremetalDhcpParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddBaremetalDhcpParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddBaremetalDhcpParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddBaremetalDhcpParams instance, // as then you are sure you have configured all required params func (s *BaremetalService) NewAddBaremetalDhcpParams(dhcpservertype string, password string, physicalnetworkid string, url string, username string) *AddBaremetalDhcpParams { p := &AddBaremetalDhcpParams{} p.p = make(map[string]interface{}) p.p["dhcpservertype"] = dhcpservertype p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["url"] = url p.p["username"] = username return p } // adds a baremetal dhcp server func (s *BaremetalService) AddBaremetalDhcp(p *AddBaremetalDhcpParams) (*AddBaremetalDhcpResponse, error) { resp, err := s.cs.newRequest("addBaremetalDhcp", p.toURLValues()) if err != nil { return nil, err } var r AddBaremetalDhcpResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddBaremetalDhcpResponse struct { Dhcpservertype string `json:"dhcpservertype"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Physicalnetworkid string `json:"physicalnetworkid"` Provider string `json:"provider"` Url string `json:"url"` } type AddBaremetalPxeKickStartServerParams struct { p map[string]interface{} } func (p *AddBaremetalPxeKickStartServerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["pxeservertype"]; found { u.Set("pxeservertype", v.(string)) } if v, found := p.p["tftpdir"]; found { u.Set("tftpdir", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddBaremetalPxeKickStartServerParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddBaremetalPxeKickStartServerParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddBaremetalPxeKickStartServerParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *AddBaremetalPxeKickStartServerParams) SetPxeservertype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pxeservertype"] = v return } func (p *AddBaremetalPxeKickStartServerParams) SetTftpdir(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tftpdir"] = v return } func (p *AddBaremetalPxeKickStartServerParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddBaremetalPxeKickStartServerParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddBaremetalPxeKickStartServerParams instance, // as then you are sure you have configured all required params func (s *BaremetalService) NewAddBaremetalPxeKickStartServerParams(password string, physicalnetworkid string, pxeservertype string, tftpdir string, url string, username string) *AddBaremetalPxeKickStartServerParams { p := &AddBaremetalPxeKickStartServerParams{} p.p = make(map[string]interface{}) p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["pxeservertype"] = pxeservertype p.p["tftpdir"] = tftpdir p.p["url"] = url p.p["username"] = username return p } // add a baremetal pxe server func (s *BaremetalService) AddBaremetalPxeKickStartServer(p *AddBaremetalPxeKickStartServerParams) (*AddBaremetalPxeKickStartServerResponse, error) { resp, err := s.cs.newRequest("addBaremetalPxeKickStartServer", p.toURLValues()) if err != nil { return nil, err } var r AddBaremetalPxeKickStartServerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddBaremetalPxeKickStartServerResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Physicalnetworkid string `json:"physicalnetworkid"` Provider string `json:"provider"` Tftpdir string `json:"tftpdir"` Url string `json:"url"` } type AddBaremetalPxePingServerParams struct { p map[string]interface{} } func (p *AddBaremetalPxePingServerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["pingcifspassword"]; found { u.Set("pingcifspassword", v.(string)) } if v, found := p.p["pingcifsusername"]; found { u.Set("pingcifsusername", v.(string)) } if v, found := p.p["pingdir"]; found { u.Set("pingdir", v.(string)) } if v, found := p.p["pingstorageserverip"]; found { u.Set("pingstorageserverip", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["pxeservertype"]; found { u.Set("pxeservertype", v.(string)) } if v, found := p.p["tftpdir"]; found { u.Set("tftpdir", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddBaremetalPxePingServerParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddBaremetalPxePingServerParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddBaremetalPxePingServerParams) SetPingcifspassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pingcifspassword"] = v return } func (p *AddBaremetalPxePingServerParams) SetPingcifsusername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pingcifsusername"] = v return } func (p *AddBaremetalPxePingServerParams) SetPingdir(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pingdir"] = v return } func (p *AddBaremetalPxePingServerParams) SetPingstorageserverip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pingstorageserverip"] = v return } func (p *AddBaremetalPxePingServerParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *AddBaremetalPxePingServerParams) SetPxeservertype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pxeservertype"] = v return } func (p *AddBaremetalPxePingServerParams) SetTftpdir(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tftpdir"] = v return } func (p *AddBaremetalPxePingServerParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddBaremetalPxePingServerParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddBaremetalPxePingServerParams instance, // as then you are sure you have configured all required params func (s *BaremetalService) NewAddBaremetalPxePingServerParams(password string, physicalnetworkid string, pingdir string, pingstorageserverip string, pxeservertype string, tftpdir string, url string, username string) *AddBaremetalPxePingServerParams { p := &AddBaremetalPxePingServerParams{} p.p = make(map[string]interface{}) p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["pingdir"] = pingdir p.p["pingstorageserverip"] = pingstorageserverip p.p["pxeservertype"] = pxeservertype p.p["tftpdir"] = tftpdir p.p["url"] = url p.p["username"] = username return p } // add a baremetal ping pxe server func (s *BaremetalService) AddBaremetalPxePingServer(p *AddBaremetalPxePingServerParams) (*AddBaremetalPxePingServerResponse, error) { resp, err := s.cs.newRequest("addBaremetalPxePingServer", p.toURLValues()) if err != nil { return nil, err } var r AddBaremetalPxePingServerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddBaremetalPxePingServerResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Physicalnetworkid string `json:"physicalnetworkid"` Pingdir string `json:"pingdir"` Pingstorageserverip string `json:"pingstorageserverip"` Provider string `json:"provider"` Tftpdir string `json:"tftpdir"` Url string `json:"url"` } type AddBaremetalRctParams struct { p map[string]interface{} } func (p *AddBaremetalRctParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["baremetalrcturl"]; found { u.Set("baremetalrcturl", v.(string)) } return u } func (p *AddBaremetalRctParams) SetBaremetalrcturl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["baremetalrcturl"] = v return } // You should always use this function to get a new AddBaremetalRctParams instance, // as then you are sure you have configured all required params func (s *BaremetalService) NewAddBaremetalRctParams(baremetalrcturl string) *AddBaremetalRctParams { p := &AddBaremetalRctParams{} p.p = make(map[string]interface{}) p.p["baremetalrcturl"] = baremetalrcturl return p } // adds baremetal rack configuration text func (s *BaremetalService) AddBaremetalRct(p *AddBaremetalRctParams) (*AddBaremetalRctResponse, error) { resp, err := s.cs.newRequest("addBaremetalRct", p.toURLValues()) if err != nil { return nil, err } var r AddBaremetalRctResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddBaremetalRctResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Url string `json:"url"` } type DeleteBaremetalRctParams struct { p map[string]interface{} } func (p *DeleteBaremetalRctParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteBaremetalRctParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteBaremetalRctParams instance, // as then you are sure you have configured all required params func (s *BaremetalService) NewDeleteBaremetalRctParams(id string) *DeleteBaremetalRctParams { p := &DeleteBaremetalRctParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // deletes baremetal rack configuration text func (s *BaremetalService) DeleteBaremetalRct(p *DeleteBaremetalRctParams) (*DeleteBaremetalRctResponse, error) { resp, err := s.cs.newRequest("deleteBaremetalRct", p.toURLValues()) if err != nil { return nil, err } var r DeleteBaremetalRctResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteBaremetalRctResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListBaremetalDhcpParams struct { p map[string]interface{} } func (p *ListBaremetalDhcpParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["dhcpservertype"]; found { u.Set("dhcpservertype", v.(string)) } if v, found := p.p["id"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("id", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } return u } func (p *ListBaremetalDhcpParams) SetDhcpservertype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dhcpservertype"] = v return } func (p *ListBaremetalDhcpParams) SetId(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListBaremetalDhcpParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListBaremetalDhcpParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListBaremetalDhcpParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListBaremetalDhcpParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } // You should always use this function to get a new ListBaremetalDhcpParams instance, // as then you are sure you have configured all required params func (s *BaremetalService) NewListBaremetalDhcpParams(physicalnetworkid string) *ListBaremetalDhcpParams { p := &ListBaremetalDhcpParams{} p.p = make(map[string]interface{}) p.p["physicalnetworkid"] = physicalnetworkid return p } // list baremetal dhcp servers func (s *BaremetalService) ListBaremetalDhcp(p *ListBaremetalDhcpParams) (*ListBaremetalDhcpResponse, error) { resp, err := s.cs.newRequest("listBaremetalDhcp", p.toURLValues()) if err != nil { return nil, err } var r ListBaremetalDhcpResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListBaremetalDhcpResponse struct { Count int `json:"count"` BaremetalDhcp []*BaremetalDhcp `json:"baremetaldhcp"` } type BaremetalDhcp struct { Dhcpservertype string `json:"dhcpservertype"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Physicalnetworkid string `json:"physicalnetworkid"` Provider string `json:"provider"` Url string `json:"url"` } type ListBaremetalPxeServersParams struct { p map[string]interface{} } func (p *ListBaremetalPxeServersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("id", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } return u } func (p *ListBaremetalPxeServersParams) SetId(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListBaremetalPxeServersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListBaremetalPxeServersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListBaremetalPxeServersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListBaremetalPxeServersParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } // You should always use this function to get a new ListBaremetalPxeServersParams instance, // as then you are sure you have configured all required params func (s *BaremetalService) NewListBaremetalPxeServersParams(physicalnetworkid string) *ListBaremetalPxeServersParams { p := &ListBaremetalPxeServersParams{} p.p = make(map[string]interface{}) p.p["physicalnetworkid"] = physicalnetworkid return p } // list baremetal pxe server func (s *BaremetalService) ListBaremetalPxeServers(p *ListBaremetalPxeServersParams) (*ListBaremetalPxeServersResponse, error) { resp, err := s.cs.newRequest("listBaremetalPxeServers", p.toURLValues()) if err != nil { return nil, err } var r ListBaremetalPxeServersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListBaremetalPxeServersResponse struct { Count int `json:"count"` BaremetalPxeServers []*BaremetalPxeServer `json:"baremetalpxeserver"` } type BaremetalPxeServer struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Physicalnetworkid string `json:"physicalnetworkid"` Provider string `json:"provider"` Url string `json:"url"` } type ListBaremetalRctParams struct { p map[string]interface{} } func (p *ListBaremetalRctParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListBaremetalRctParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListBaremetalRctParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListBaremetalRctParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListBaremetalRctParams instance, // as then you are sure you have configured all required params func (s *BaremetalService) NewListBaremetalRctParams() *ListBaremetalRctParams { p := &ListBaremetalRctParams{} p.p = make(map[string]interface{}) return p } // list baremetal rack configuration func (s *BaremetalService) ListBaremetalRct(p *ListBaremetalRctParams) (*ListBaremetalRctResponse, error) { resp, err := s.cs.newRequest("listBaremetalRct", p.toURLValues()) if err != nil { return nil, err } var r ListBaremetalRctResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListBaremetalRctResponse struct { Count int `json:"count"` BaremetalRct []*BaremetalRct `json:"baremetalrct"` } type BaremetalRct struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Url string `json:"url"` } type NotifyBaremetalProvisionDoneParams struct { p map[string]interface{} } func (p *NotifyBaremetalProvisionDoneParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["mac"]; found { u.Set("mac", v.(string)) } return u } func (p *NotifyBaremetalProvisionDoneParams) SetMac(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["mac"] = v return } // You should always use this function to get a new NotifyBaremetalProvisionDoneParams instance, // as then you are sure you have configured all required params func (s *BaremetalService) NewNotifyBaremetalProvisionDoneParams(mac string) *NotifyBaremetalProvisionDoneParams { p := &NotifyBaremetalProvisionDoneParams{} p.p = make(map[string]interface{}) p.p["mac"] = mac return p } // Notify provision has been done on a host. This api is for baremetal virtual router service, not for end user func (s *BaremetalService) NotifyBaremetalProvisionDone(p *NotifyBaremetalProvisionDoneParams) (*NotifyBaremetalProvisionDoneResponse, error) { resp, err := s.cs.newRequest("notifyBaremetalProvisionDone", p.toURLValues()) if err != nil { return nil, err } var r NotifyBaremetalProvisionDoneResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type NotifyBaremetalProvisionDoneResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } go-cloudstack-2.9.0/cloudstack/BigSwitchBCFService.go000066400000000000000000000206051364073403100224670ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type AddBigSwitchBcfDeviceParams struct { p map[string]interface{} } func (p *AddBigSwitchBcfDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostname"]; found { u.Set("hostname", v.(string)) } if v, found := p.p["nat"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("nat", vv) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddBigSwitchBcfDeviceParams) SetHostname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostname"] = v return } func (p *AddBigSwitchBcfDeviceParams) SetNat(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nat"] = v return } func (p *AddBigSwitchBcfDeviceParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddBigSwitchBcfDeviceParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddBigSwitchBcfDeviceParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddBigSwitchBcfDeviceParams instance, // as then you are sure you have configured all required params func (s *BigSwitchBCFService) NewAddBigSwitchBcfDeviceParams(hostname string, nat bool, password string, physicalnetworkid string, username string) *AddBigSwitchBcfDeviceParams { p := &AddBigSwitchBcfDeviceParams{} p.p = make(map[string]interface{}) p.p["hostname"] = hostname p.p["nat"] = nat p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["username"] = username return p } // Adds a BigSwitch BCF Controller device func (s *BigSwitchBCFService) AddBigSwitchBcfDevice(p *AddBigSwitchBcfDeviceParams) (*AddBigSwitchBcfDeviceResponse, error) { resp, err := s.cs.newRequest("addBigSwitchBcfDevice", p.toURLValues()) if err != nil { return nil, err } var r AddBigSwitchBcfDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddBigSwitchBcfDeviceResponse struct { Bcfdeviceid string `json:"bcfdeviceid"` Bigswitchdevicename string `json:"bigswitchdevicename"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nat bool `json:"nat"` Password string `json:"password"` Physicalnetworkid string `json:"physicalnetworkid"` Provider string `json:"provider"` Username string `json:"username"` } type DeleteBigSwitchBcfDeviceParams struct { p map[string]interface{} } func (p *DeleteBigSwitchBcfDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["bcfdeviceid"]; found { u.Set("bcfdeviceid", v.(string)) } return u } func (p *DeleteBigSwitchBcfDeviceParams) SetBcfdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bcfdeviceid"] = v return } // You should always use this function to get a new DeleteBigSwitchBcfDeviceParams instance, // as then you are sure you have configured all required params func (s *BigSwitchBCFService) NewDeleteBigSwitchBcfDeviceParams(bcfdeviceid string) *DeleteBigSwitchBcfDeviceParams { p := &DeleteBigSwitchBcfDeviceParams{} p.p = make(map[string]interface{}) p.p["bcfdeviceid"] = bcfdeviceid return p } // delete a BigSwitch BCF Controller device func (s *BigSwitchBCFService) DeleteBigSwitchBcfDevice(p *DeleteBigSwitchBcfDeviceParams) (*DeleteBigSwitchBcfDeviceResponse, error) { resp, err := s.cs.newRequest("deleteBigSwitchBcfDevice", p.toURLValues()) if err != nil { return nil, err } var r DeleteBigSwitchBcfDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteBigSwitchBcfDeviceResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListBigSwitchBcfDevicesParams struct { p map[string]interface{} } func (p *ListBigSwitchBcfDevicesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["bcfdeviceid"]; found { u.Set("bcfdeviceid", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } return u } func (p *ListBigSwitchBcfDevicesParams) SetBcfdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bcfdeviceid"] = v return } func (p *ListBigSwitchBcfDevicesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListBigSwitchBcfDevicesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListBigSwitchBcfDevicesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListBigSwitchBcfDevicesParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } // You should always use this function to get a new ListBigSwitchBcfDevicesParams instance, // as then you are sure you have configured all required params func (s *BigSwitchBCFService) NewListBigSwitchBcfDevicesParams() *ListBigSwitchBcfDevicesParams { p := &ListBigSwitchBcfDevicesParams{} p.p = make(map[string]interface{}) return p } // Lists BigSwitch BCF Controller devices func (s *BigSwitchBCFService) ListBigSwitchBcfDevices(p *ListBigSwitchBcfDevicesParams) (*ListBigSwitchBcfDevicesResponse, error) { resp, err := s.cs.newRequest("listBigSwitchBcfDevices", p.toURLValues()) if err != nil { return nil, err } var r ListBigSwitchBcfDevicesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListBigSwitchBcfDevicesResponse struct { Count int `json:"count"` BigSwitchBcfDevices []*BigSwitchBcfDevice `json:"bigswitchbcfdevice"` } type BigSwitchBcfDevice struct { Bcfdeviceid string `json:"bcfdeviceid"` Bigswitchdevicename string `json:"bigswitchdevicename"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nat bool `json:"nat"` Password string `json:"password"` Physicalnetworkid string `json:"physicalnetworkid"` Provider string `json:"provider"` Username string `json:"username"` } go-cloudstack-2.9.0/cloudstack/BrocadeVCSService.go000066400000000000000000000400401364073403100221770ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" ) type AddBrocadeVcsDeviceParams struct { p map[string]interface{} } func (p *AddBrocadeVcsDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostname"]; found { u.Set("hostname", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddBrocadeVcsDeviceParams) SetHostname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostname"] = v return } func (p *AddBrocadeVcsDeviceParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddBrocadeVcsDeviceParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddBrocadeVcsDeviceParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddBrocadeVcsDeviceParams instance, // as then you are sure you have configured all required params func (s *BrocadeVCSService) NewAddBrocadeVcsDeviceParams(hostname string, password string, physicalnetworkid string, username string) *AddBrocadeVcsDeviceParams { p := &AddBrocadeVcsDeviceParams{} p.p = make(map[string]interface{}) p.p["hostname"] = hostname p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["username"] = username return p } // Adds a Brocade VCS Switch func (s *BrocadeVCSService) AddBrocadeVcsDevice(p *AddBrocadeVcsDeviceParams) (*AddBrocadeVcsDeviceResponse, error) { resp, err := s.cs.newRequest("addBrocadeVcsDevice", p.toURLValues()) if err != nil { return nil, err } var r AddBrocadeVcsDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddBrocadeVcsDeviceResponse struct { Brocadedevicename string `json:"brocadedevicename"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Physicalnetworkid string `json:"physicalnetworkid"` Provider string `json:"provider"` Vcsdeviceid string `json:"vcsdeviceid"` } type DeleteBrocadeVcsDeviceParams struct { p map[string]interface{} } func (p *DeleteBrocadeVcsDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["vcsdeviceid"]; found { u.Set("vcsdeviceid", v.(string)) } return u } func (p *DeleteBrocadeVcsDeviceParams) SetVcsdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vcsdeviceid"] = v return } // You should always use this function to get a new DeleteBrocadeVcsDeviceParams instance, // as then you are sure you have configured all required params func (s *BrocadeVCSService) NewDeleteBrocadeVcsDeviceParams(vcsdeviceid string) *DeleteBrocadeVcsDeviceParams { p := &DeleteBrocadeVcsDeviceParams{} p.p = make(map[string]interface{}) p.p["vcsdeviceid"] = vcsdeviceid return p } // delete a Brocade VCS Switch func (s *BrocadeVCSService) DeleteBrocadeVcsDevice(p *DeleteBrocadeVcsDeviceParams) (*DeleteBrocadeVcsDeviceResponse, error) { resp, err := s.cs.newRequest("deleteBrocadeVcsDevice", p.toURLValues()) if err != nil { return nil, err } var r DeleteBrocadeVcsDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteBrocadeVcsDeviceResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListBrocadeVcsDeviceNetworksParams struct { p map[string]interface{} } func (p *ListBrocadeVcsDeviceNetworksParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["vcsdeviceid"]; found { u.Set("vcsdeviceid", v.(string)) } return u } func (p *ListBrocadeVcsDeviceNetworksParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListBrocadeVcsDeviceNetworksParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListBrocadeVcsDeviceNetworksParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListBrocadeVcsDeviceNetworksParams) SetVcsdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vcsdeviceid"] = v return } // You should always use this function to get a new ListBrocadeVcsDeviceNetworksParams instance, // as then you are sure you have configured all required params func (s *BrocadeVCSService) NewListBrocadeVcsDeviceNetworksParams(vcsdeviceid string) *ListBrocadeVcsDeviceNetworksParams { p := &ListBrocadeVcsDeviceNetworksParams{} p.p = make(map[string]interface{}) p.p["vcsdeviceid"] = vcsdeviceid return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *BrocadeVCSService) GetBrocadeVcsDeviceNetworkID(keyword string, vcsdeviceid string, opts ...OptionFunc) (string, int, error) { p := &ListBrocadeVcsDeviceNetworksParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword p.p["vcsdeviceid"] = vcsdeviceid for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListBrocadeVcsDeviceNetworks(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.BrocadeVcsDeviceNetworks[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.BrocadeVcsDeviceNetworks { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // lists network that are using a brocade vcs switch func (s *BrocadeVCSService) ListBrocadeVcsDeviceNetworks(p *ListBrocadeVcsDeviceNetworksParams) (*ListBrocadeVcsDeviceNetworksResponse, error) { resp, err := s.cs.newRequest("listBrocadeVcsDeviceNetworks", p.toURLValues()) if err != nil { return nil, err } var r ListBrocadeVcsDeviceNetworksResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListBrocadeVcsDeviceNetworksResponse struct { Count int `json:"count"` BrocadeVcsDeviceNetworks []*BrocadeVcsDeviceNetwork `json:"brocadevcsdevicenetwork"` } type BrocadeVcsDeviceNetwork struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []BrocadeVcsDeviceNetworkService `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type BrocadeVcsDeviceNetworkService struct { Capability []BrocadeVcsDeviceNetworkServiceCapability `json:"capability"` Name string `json:"name"` Provider []BrocadeVcsDeviceNetworkServiceProvider `json:"provider"` } type BrocadeVcsDeviceNetworkServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type BrocadeVcsDeviceNetworkServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type ListBrocadeVcsDevicesParams struct { p map[string]interface{} } func (p *ListBrocadeVcsDevicesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["vcsdeviceid"]; found { u.Set("vcsdeviceid", v.(string)) } return u } func (p *ListBrocadeVcsDevicesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListBrocadeVcsDevicesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListBrocadeVcsDevicesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListBrocadeVcsDevicesParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *ListBrocadeVcsDevicesParams) SetVcsdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vcsdeviceid"] = v return } // You should always use this function to get a new ListBrocadeVcsDevicesParams instance, // as then you are sure you have configured all required params func (s *BrocadeVCSService) NewListBrocadeVcsDevicesParams() *ListBrocadeVcsDevicesParams { p := &ListBrocadeVcsDevicesParams{} p.p = make(map[string]interface{}) return p } // Lists Brocade VCS Switches func (s *BrocadeVCSService) ListBrocadeVcsDevices(p *ListBrocadeVcsDevicesParams) (*ListBrocadeVcsDevicesResponse, error) { resp, err := s.cs.newRequest("listBrocadeVcsDevices", p.toURLValues()) if err != nil { return nil, err } var r ListBrocadeVcsDevicesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListBrocadeVcsDevicesResponse struct { Count int `json:"count"` BrocadeVcsDevices []*BrocadeVcsDevice `json:"brocadevcsdevice"` } type BrocadeVcsDevice struct { Brocadedevicename string `json:"brocadedevicename"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Physicalnetworkid string `json:"physicalnetworkid"` Provider string `json:"provider"` Vcsdeviceid string `json:"vcsdeviceid"` } go-cloudstack-2.9.0/cloudstack/CertificateService.go000066400000000000000000000071071364073403100225150ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type UploadCustomCertificateParams struct { p map[string]interface{} } func (p *UploadCustomCertificateParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["certificate"]; found { u.Set("certificate", v.(string)) } if v, found := p.p["domainsuffix"]; found { u.Set("domainsuffix", v.(string)) } if v, found := p.p["id"]; found { vv := strconv.Itoa(v.(int)) u.Set("id", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["privatekey"]; found { u.Set("privatekey", v.(string)) } return u } func (p *UploadCustomCertificateParams) SetCertificate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["certificate"] = v return } func (p *UploadCustomCertificateParams) SetDomainsuffix(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainsuffix"] = v return } func (p *UploadCustomCertificateParams) SetId(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UploadCustomCertificateParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UploadCustomCertificateParams) SetPrivatekey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["privatekey"] = v return } // You should always use this function to get a new UploadCustomCertificateParams instance, // as then you are sure you have configured all required params func (s *CertificateService) NewUploadCustomCertificateParams(certificate string, domainsuffix string) *UploadCustomCertificateParams { p := &UploadCustomCertificateParams{} p.p = make(map[string]interface{}) p.p["certificate"] = certificate p.p["domainsuffix"] = domainsuffix return p } // Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself. func (s *CertificateService) UploadCustomCertificate(p *UploadCustomCertificateParams) (*UploadCustomCertificateResponse, error) { resp, err := s.cs.newRequest("uploadCustomCertificate", p.toURLValues()) if err != nil { return nil, err } var r UploadCustomCertificateResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UploadCustomCertificateResponse struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Message string `json:"message"` } go-cloudstack-2.9.0/cloudstack/CloudIdentifierService.go000066400000000000000000000040361364073403100233420ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" ) type GetCloudIdentifierParams struct { p map[string]interface{} } func (p *GetCloudIdentifierParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["userid"]; found { u.Set("userid", v.(string)) } return u } func (p *GetCloudIdentifierParams) SetUserid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["userid"] = v return } // You should always use this function to get a new GetCloudIdentifierParams instance, // as then you are sure you have configured all required params func (s *CloudIdentifierService) NewGetCloudIdentifierParams(userid string) *GetCloudIdentifierParams { p := &GetCloudIdentifierParams{} p.p = make(map[string]interface{}) p.p["userid"] = userid return p } // Retrieves a cloud identifier. func (s *CloudIdentifierService) GetCloudIdentifier(p *GetCloudIdentifierParams) (*GetCloudIdentifierResponse, error) { resp, err := s.cs.newRequest("getCloudIdentifier", p.toURLValues()) if err != nil { return nil, err } var r GetCloudIdentifierResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetCloudIdentifierResponse struct { Cloudidentifier string `json:"cloudidentifier"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Signature string `json:"signature"` Userid string `json:"userid"` } go-cloudstack-2.9.0/cloudstack/ClusterService.go000066400000000000000000001003331364073403100217070ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AddClusterParams struct { p map[string]interface{} } func (p *AddClusterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["clustername"]; found { u.Set("clustername", v.(string)) } if v, found := p.p["clustertype"]; found { u.Set("clustertype", v.(string)) } if v, found := p.p["guestvswitchname"]; found { u.Set("guestvswitchname", v.(string)) } if v, found := p.p["guestvswitchtype"]; found { u.Set("guestvswitchtype", v.(string)) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["ovm3cluster"]; found { u.Set("ovm3cluster", v.(string)) } if v, found := p.p["ovm3pool"]; found { u.Set("ovm3pool", v.(string)) } if v, found := p.p["ovm3vip"]; found { u.Set("ovm3vip", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["publicvswitchname"]; found { u.Set("publicvswitchname", v.(string)) } if v, found := p.p["publicvswitchtype"]; found { u.Set("publicvswitchtype", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } if v, found := p.p["vsmipaddress"]; found { u.Set("vsmipaddress", v.(string)) } if v, found := p.p["vsmpassword"]; found { u.Set("vsmpassword", v.(string)) } if v, found := p.p["vsmusername"]; found { u.Set("vsmusername", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *AddClusterParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *AddClusterParams) SetClustername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clustername"] = v return } func (p *AddClusterParams) SetClustertype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clustertype"] = v return } func (p *AddClusterParams) SetGuestvswitchname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["guestvswitchname"] = v return } func (p *AddClusterParams) SetGuestvswitchtype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["guestvswitchtype"] = v return } func (p *AddClusterParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *AddClusterParams) SetOvm3cluster(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ovm3cluster"] = v return } func (p *AddClusterParams) SetOvm3pool(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ovm3pool"] = v return } func (p *AddClusterParams) SetOvm3vip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ovm3vip"] = v return } func (p *AddClusterParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddClusterParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *AddClusterParams) SetPublicvswitchname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publicvswitchname"] = v return } func (p *AddClusterParams) SetPublicvswitchtype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publicvswitchtype"] = v return } func (p *AddClusterParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddClusterParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } func (p *AddClusterParams) SetVsmipaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vsmipaddress"] = v return } func (p *AddClusterParams) SetVsmpassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vsmpassword"] = v return } func (p *AddClusterParams) SetVsmusername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vsmusername"] = v return } func (p *AddClusterParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new AddClusterParams instance, // as then you are sure you have configured all required params func (s *ClusterService) NewAddClusterParams(clustername string, clustertype string, hypervisor string, podid string, zoneid string) *AddClusterParams { p := &AddClusterParams{} p.p = make(map[string]interface{}) p.p["clustername"] = clustername p.p["clustertype"] = clustertype p.p["hypervisor"] = hypervisor p.p["podid"] = podid p.p["zoneid"] = zoneid return p } // Adds a new cluster func (s *ClusterService) AddCluster(p *AddClusterParams) (*AddClusterResponse, error) { resp, err := s.cs.newRequest("addCluster", p.toURLValues()) if err != nil { return nil, err } var r AddClusterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddClusterResponse struct { Allocationstate string `json:"allocationstate"` Capacity []AddClusterResponseCapacity `json:"capacity"` Clustertype string `json:"clustertype"` Cpuovercommitratio string `json:"cpuovercommitratio"` Hypervisortype string `json:"hypervisortype"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Managedstate string `json:"managedstate"` Memoryovercommitratio string `json:"memoryovercommitratio"` Name string `json:"name"` Ovm3vip string `json:"ovm3vip"` Podid string `json:"podid"` Podname string `json:"podname"` Resourcedetails map[string]string `json:"resourcedetails"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type AddClusterResponseCapacity struct { Capacityallocated int64 `json:"capacityallocated"` Capacitytotal int64 `json:"capacitytotal"` Capacityused int64 `json:"capacityused"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Name string `json:"name"` Percentused string `json:"percentused"` Podid string `json:"podid"` Podname string `json:"podname"` Type int `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DedicateClusterParams struct { p map[string]interface{} } func (p *DedicateClusterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } return u } func (p *DedicateClusterParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DedicateClusterParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *DedicateClusterParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } // You should always use this function to get a new DedicateClusterParams instance, // as then you are sure you have configured all required params func (s *ClusterService) NewDedicateClusterParams(clusterid string, domainid string) *DedicateClusterParams { p := &DedicateClusterParams{} p.p = make(map[string]interface{}) p.p["clusterid"] = clusterid p.p["domainid"] = domainid return p } // Dedicate an existing cluster func (s *ClusterService) DedicateCluster(p *DedicateClusterParams) (*DedicateClusterResponse, error) { resp, err := s.cs.newRequest("dedicateCluster", p.toURLValues()) if err != nil { return nil, err } var r DedicateClusterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DedicateClusterResponse struct { Accountid string `json:"accountid"` Affinitygroupid string `json:"affinitygroupid"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } type DeleteClusterParams struct { p map[string]interface{} } func (p *DeleteClusterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteClusterParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteClusterParams instance, // as then you are sure you have configured all required params func (s *ClusterService) NewDeleteClusterParams(id string) *DeleteClusterParams { p := &DeleteClusterParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a cluster. func (s *ClusterService) DeleteCluster(p *DeleteClusterParams) (*DeleteClusterResponse, error) { resp, err := s.cs.newRequest("deleteCluster", p.toURLValues()) if err != nil { return nil, err } var r DeleteClusterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteClusterResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteClusterResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteClusterResponse return json.Unmarshal(b, (*alias)(r)) } type DisableOutOfBandManagementForClusterParams struct { p map[string]interface{} } func (p *DisableOutOfBandManagementForClusterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } return u } func (p *DisableOutOfBandManagementForClusterParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } // You should always use this function to get a new DisableOutOfBandManagementForClusterParams instance, // as then you are sure you have configured all required params func (s *ClusterService) NewDisableOutOfBandManagementForClusterParams(clusterid string) *DisableOutOfBandManagementForClusterParams { p := &DisableOutOfBandManagementForClusterParams{} p.p = make(map[string]interface{}) p.p["clusterid"] = clusterid return p } // Disables out-of-band management for a cluster func (s *ClusterService) DisableOutOfBandManagementForCluster(p *DisableOutOfBandManagementForClusterParams) (*DisableOutOfBandManagementForClusterResponse, error) { resp, err := s.cs.newRequest("disableOutOfBandManagementForCluster", p.toURLValues()) if err != nil { return nil, err } var r DisableOutOfBandManagementForClusterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DisableOutOfBandManagementForClusterResponse struct { Action string `json:"action"` Address string `json:"address"` Description string `json:"description"` Driver string `json:"driver"` Enabled bool `json:"enabled"` Hostid string `json:"hostid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Password string `json:"password"` Port string `json:"port"` Powerstate string `json:"powerstate"` Status bool `json:"status"` Username string `json:"username"` } type EnableOutOfBandManagementForClusterParams struct { p map[string]interface{} } func (p *EnableOutOfBandManagementForClusterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } return u } func (p *EnableOutOfBandManagementForClusterParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } // You should always use this function to get a new EnableOutOfBandManagementForClusterParams instance, // as then you are sure you have configured all required params func (s *ClusterService) NewEnableOutOfBandManagementForClusterParams(clusterid string) *EnableOutOfBandManagementForClusterParams { p := &EnableOutOfBandManagementForClusterParams{} p.p = make(map[string]interface{}) p.p["clusterid"] = clusterid return p } // Enables out-of-band management for a cluster func (s *ClusterService) EnableOutOfBandManagementForCluster(p *EnableOutOfBandManagementForClusterParams) (*EnableOutOfBandManagementForClusterResponse, error) { resp, err := s.cs.newRequest("enableOutOfBandManagementForCluster", p.toURLValues()) if err != nil { return nil, err } var r EnableOutOfBandManagementForClusterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type EnableOutOfBandManagementForClusterResponse struct { Action string `json:"action"` Address string `json:"address"` Description string `json:"description"` Driver string `json:"driver"` Enabled bool `json:"enabled"` Hostid string `json:"hostid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Password string `json:"password"` Port string `json:"port"` Powerstate string `json:"powerstate"` Status bool `json:"status"` Username string `json:"username"` } type ListClustersParams struct { p map[string]interface{} } func (p *ListClustersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["clustertype"]; found { u.Set("clustertype", v.(string)) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["managedstate"]; found { u.Set("managedstate", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["showcapacities"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("showcapacities", vv) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListClustersParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *ListClustersParams) SetClustertype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clustertype"] = v return } func (p *ListClustersParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *ListClustersParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListClustersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListClustersParams) SetManagedstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["managedstate"] = v return } func (p *ListClustersParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListClustersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListClustersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListClustersParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListClustersParams) SetShowcapacities(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["showcapacities"] = v return } func (p *ListClustersParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListClustersParams instance, // as then you are sure you have configured all required params func (s *ClusterService) NewListClustersParams() *ListClustersParams { p := &ListClustersParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ClusterService) GetClusterID(name string, opts ...OptionFunc) (string, int, error) { p := &ListClustersParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListClusters(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Clusters[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Clusters { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ClusterService) GetClusterByName(name string, opts ...OptionFunc) (*Cluster, int, error) { id, count, err := s.GetClusterID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetClusterByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ClusterService) GetClusterByID(id string, opts ...OptionFunc) (*Cluster, int, error) { p := &ListClustersParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListClusters(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Clusters[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Cluster UUID: %s!", id) } // Lists clusters. func (s *ClusterService) ListClusters(p *ListClustersParams) (*ListClustersResponse, error) { resp, err := s.cs.newRequest("listClusters", p.toURLValues()) if err != nil { return nil, err } var r ListClustersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListClustersResponse struct { Count int `json:"count"` Clusters []*Cluster `json:"cluster"` } type Cluster struct { Allocationstate string `json:"allocationstate"` Capacity []ClusterCapacity `json:"capacity"` Clustertype string `json:"clustertype"` Cpuovercommitratio string `json:"cpuovercommitratio"` Hypervisortype string `json:"hypervisortype"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Managedstate string `json:"managedstate"` Memoryovercommitratio string `json:"memoryovercommitratio"` Name string `json:"name"` Ovm3vip string `json:"ovm3vip"` Podid string `json:"podid"` Podname string `json:"podname"` Resourcedetails map[string]string `json:"resourcedetails"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ClusterCapacity struct { Capacityallocated int64 `json:"capacityallocated"` Capacitytotal int64 `json:"capacitytotal"` Capacityused int64 `json:"capacityused"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Name string `json:"name"` Percentused string `json:"percentused"` Podid string `json:"podid"` Podname string `json:"podname"` Type int `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListDedicatedClustersParams struct { p map[string]interface{} } func (p *ListDedicatedClustersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["affinitygroupid"]; found { u.Set("affinitygroupid", v.(string)) } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListDedicatedClustersParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListDedicatedClustersParams) SetAffinitygroupid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["affinitygroupid"] = v return } func (p *ListDedicatedClustersParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *ListDedicatedClustersParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListDedicatedClustersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListDedicatedClustersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListDedicatedClustersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListDedicatedClustersParams instance, // as then you are sure you have configured all required params func (s *ClusterService) NewListDedicatedClustersParams() *ListDedicatedClustersParams { p := &ListDedicatedClustersParams{} p.p = make(map[string]interface{}) return p } // Lists dedicated clusters. func (s *ClusterService) ListDedicatedClusters(p *ListDedicatedClustersParams) (*ListDedicatedClustersResponse, error) { resp, err := s.cs.newRequest("listDedicatedClusters", p.toURLValues()) if err != nil { return nil, err } var r ListDedicatedClustersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListDedicatedClustersResponse struct { Count int `json:"count"` DedicatedClusters []*DedicatedCluster `json:"dedicatedcluster"` } type DedicatedCluster struct { Accountid string `json:"accountid"` Affinitygroupid string `json:"affinitygroupid"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } type ReleaseDedicatedClusterParams struct { p map[string]interface{} } func (p *ReleaseDedicatedClusterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } return u } func (p *ReleaseDedicatedClusterParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } // You should always use this function to get a new ReleaseDedicatedClusterParams instance, // as then you are sure you have configured all required params func (s *ClusterService) NewReleaseDedicatedClusterParams(clusterid string) *ReleaseDedicatedClusterParams { p := &ReleaseDedicatedClusterParams{} p.p = make(map[string]interface{}) p.p["clusterid"] = clusterid return p } // Release the dedication for cluster func (s *ClusterService) ReleaseDedicatedCluster(p *ReleaseDedicatedClusterParams) (*ReleaseDedicatedClusterResponse, error) { resp, err := s.cs.newRequest("releaseDedicatedCluster", p.toURLValues()) if err != nil { return nil, err } var r ReleaseDedicatedClusterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ReleaseDedicatedClusterResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type UpdateClusterParams struct { p map[string]interface{} } func (p *UpdateClusterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["clustername"]; found { u.Set("clustername", v.(string)) } if v, found := p.p["clustertype"]; found { u.Set("clustertype", v.(string)) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["managedstate"]; found { u.Set("managedstate", v.(string)) } return u } func (p *UpdateClusterParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *UpdateClusterParams) SetClustername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clustername"] = v return } func (p *UpdateClusterParams) SetClustertype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clustertype"] = v return } func (p *UpdateClusterParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *UpdateClusterParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateClusterParams) SetManagedstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["managedstate"] = v return } // You should always use this function to get a new UpdateClusterParams instance, // as then you are sure you have configured all required params func (s *ClusterService) NewUpdateClusterParams(id string) *UpdateClusterParams { p := &UpdateClusterParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates an existing cluster func (s *ClusterService) UpdateCluster(p *UpdateClusterParams) (*UpdateClusterResponse, error) { resp, err := s.cs.newRequest("updateCluster", p.toURLValues()) if err != nil { return nil, err } var r UpdateClusterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateClusterResponse struct { Allocationstate string `json:"allocationstate"` Capacity []UpdateClusterResponseCapacity `json:"capacity"` Clustertype string `json:"clustertype"` Cpuovercommitratio string `json:"cpuovercommitratio"` Hypervisortype string `json:"hypervisortype"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Managedstate string `json:"managedstate"` Memoryovercommitratio string `json:"memoryovercommitratio"` Name string `json:"name"` Ovm3vip string `json:"ovm3vip"` Podid string `json:"podid"` Podname string `json:"podname"` Resourcedetails map[string]string `json:"resourcedetails"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateClusterResponseCapacity struct { Capacityallocated int64 `json:"capacityallocated"` Capacitytotal int64 `json:"capacitytotal"` Capacityused int64 `json:"capacityused"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Name string `json:"name"` Percentused string `json:"percentused"` Podid string `json:"podid"` Podname string `json:"podname"` Type int `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/ConfigurationService.go000066400000000000000000000266141364073403100231060ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type ListCapabilitiesParams struct { p map[string]interface{} } func (p *ListCapabilitiesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } return u } // You should always use this function to get a new ListCapabilitiesParams instance, // as then you are sure you have configured all required params func (s *ConfigurationService) NewListCapabilitiesParams() *ListCapabilitiesParams { p := &ListCapabilitiesParams{} p.p = make(map[string]interface{}) return p } // Lists capabilities func (s *ConfigurationService) ListCapabilities(p *ListCapabilitiesParams) (*ListCapabilitiesResponse, error) { resp, err := s.cs.newRequest("listCapabilities", p.toURLValues()) if err != nil { return nil, err } var r ListCapabilitiesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListCapabilitiesResponse struct { Count int `json:"count"` Capabilities []*Capability `json:"capability"` } type Capability struct { Allowusercreateprojects bool `json:"allowusercreateprojects"` Allowuserexpungerecovervm bool `json:"allowuserexpungerecovervm"` Allowuserviewdestroyedvm bool `json:"allowuserviewdestroyedvm"` Apilimitinterval int `json:"apilimitinterval"` Apilimitmax int `json:"apilimitmax"` Cloudstackversion string `json:"cloudstackversion"` Customdiskofferingmaxsize int64 `json:"customdiskofferingmaxsize"` Customdiskofferingminsize int64 `json:"customdiskofferingminsize"` Dynamicrolesenabled bool `json:"dynamicrolesenabled"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Kvmsnapshotenabled bool `json:"kvmsnapshotenabled"` Projectinviterequired bool `json:"projectinviterequired"` Regionsecondaryenabled bool `json:"regionsecondaryenabled"` Securitygroupsenabled bool `json:"securitygroupsenabled"` SupportELB string `json:"supportELB"` Userpublictemplateenabled bool `json:"userpublictemplateenabled"` } type ListConfigurationsParams struct { p map[string]interface{} } func (p *ListConfigurationsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["accountid"]; found { u.Set("accountid", v.(string)) } if v, found := p.p["category"]; found { u.Set("category", v.(string)) } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["imagestoreuuid"]; found { u.Set("imagestoreuuid", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["storageid"]; found { u.Set("storageid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListConfigurationsParams) SetAccountid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountid"] = v return } func (p *ListConfigurationsParams) SetCategory(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["category"] = v return } func (p *ListConfigurationsParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *ListConfigurationsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListConfigurationsParams) SetImagestoreuuid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["imagestoreuuid"] = v return } func (p *ListConfigurationsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListConfigurationsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListConfigurationsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListConfigurationsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListConfigurationsParams) SetStorageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storageid"] = v return } func (p *ListConfigurationsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListConfigurationsParams instance, // as then you are sure you have configured all required params func (s *ConfigurationService) NewListConfigurationsParams() *ListConfigurationsParams { p := &ListConfigurationsParams{} p.p = make(map[string]interface{}) return p } // Lists all configurations. func (s *ConfigurationService) ListConfigurations(p *ListConfigurationsParams) (*ListConfigurationsResponse, error) { resp, err := s.cs.newRequest("listConfigurations", p.toURLValues()) if err != nil { return nil, err } var r ListConfigurationsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListConfigurationsResponse struct { Count int `json:"count"` Configurations []*Configuration `json:"configuration"` } type Configuration struct { Category string `json:"category"` Description string `json:"description"` Id int64 `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Scope string `json:"scope"` Value string `json:"value"` } type ListDeploymentPlannersParams struct { p map[string]interface{} } func (p *ListDeploymentPlannersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListDeploymentPlannersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListDeploymentPlannersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListDeploymentPlannersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListDeploymentPlannersParams instance, // as then you are sure you have configured all required params func (s *ConfigurationService) NewListDeploymentPlannersParams() *ListDeploymentPlannersParams { p := &ListDeploymentPlannersParams{} p.p = make(map[string]interface{}) return p } // Lists all DeploymentPlanners available. func (s *ConfigurationService) ListDeploymentPlanners(p *ListDeploymentPlannersParams) (*ListDeploymentPlannersResponse, error) { resp, err := s.cs.newRequest("listDeploymentPlanners", p.toURLValues()) if err != nil { return nil, err } var r ListDeploymentPlannersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListDeploymentPlannersResponse struct { Count int `json:"count"` DeploymentPlanners []*DeploymentPlanner `json:"deploymentplanner"` } type DeploymentPlanner struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` } type UpdateConfigurationParams struct { p map[string]interface{} } func (p *UpdateConfigurationParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["accountid"]; found { u.Set("accountid", v.(string)) } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["imagestoreuuid"]; found { u.Set("imagestoreuuid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["storageid"]; found { u.Set("storageid", v.(string)) } if v, found := p.p["value"]; found { u.Set("value", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *UpdateConfigurationParams) SetAccountid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountid"] = v return } func (p *UpdateConfigurationParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *UpdateConfigurationParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *UpdateConfigurationParams) SetImagestoreuuid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["imagestoreuuid"] = v return } func (p *UpdateConfigurationParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateConfigurationParams) SetStorageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storageid"] = v return } func (p *UpdateConfigurationParams) SetValue(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["value"] = v return } func (p *UpdateConfigurationParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new UpdateConfigurationParams instance, // as then you are sure you have configured all required params func (s *ConfigurationService) NewUpdateConfigurationParams(name string) *UpdateConfigurationParams { p := &UpdateConfigurationParams{} p.p = make(map[string]interface{}) p.p["name"] = name return p } // Updates a configuration. func (s *ConfigurationService) UpdateConfiguration(p *UpdateConfigurationParams) (*UpdateConfigurationResponse, error) { resp, err := s.cs.newRequest("updateConfiguration", p.toURLValues()) if err != nil { return nil, err } var r UpdateConfigurationResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateConfigurationResponse struct { Category string `json:"category"` Description string `json:"description"` Id int64 `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Scope string `json:"scope"` Value string `json:"value"` } go-cloudstack-2.9.0/cloudstack/CustomService.go000066400000000000000000000032151364073403100215410ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CustomServiceParams struct { p map[string]interface{} } func (p *CustomServiceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } for k, v := range p.p { switch t := v.(type) { case bool: u.Set(k, strconv.FormatBool(t)) case int: u.Set(k, strconv.Itoa(t)) case int64: vv := strconv.FormatInt(t, 10) u.Set(k, vv) case string: u.Set(k, t) case []string: u.Set(k, strings.Join(t, ", ")) case map[string]string: i := 0 for kk, vv := range t { u.Set(fmt.Sprintf("%s[%d].%s", k, i, kk), vv) i++ } } } return u } func (p *CustomServiceParams) SetParam(param string, v interface{}) { if p.p == nil { p.p = make(map[string]interface{}) } p.p[param] = v return } func (s *CustomService) CustomRequest(api string, p *CustomServiceParams, result interface{}) error { resp, err := s.cs.newRequest(api, p.toURLValues()) if err != nil { return err } return json.Unmarshal(resp, result) } go-cloudstack-2.9.0/cloudstack/DiskOfferingService.go000066400000000000000000000552061364073403100226500ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateDiskOfferingParams struct { p map[string]interface{} } func (p *CreateDiskOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["bytesreadrate"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("bytesreadrate", vv) } if v, found := p.p["bytesreadratemax"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("bytesreadratemax", vv) } if v, found := p.p["bytesreadratemaxlength"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("bytesreadratemaxlength", vv) } if v, found := p.p["byteswriterate"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("byteswriterate", vv) } if v, found := p.p["byteswriteratemax"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("byteswriteratemax", vv) } if v, found := p.p["byteswriteratemaxlength"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("byteswriteratemaxlength", vv) } if v, found := p.p["customized"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("customized", vv) } if v, found := p.p["customizediops"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("customizediops", vv) } if v, found := p.p["disksize"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("disksize", vv) } if v, found := p.p["displayoffering"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displayoffering", vv) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["hypervisorsnapshotreserve"]; found { vv := strconv.Itoa(v.(int)) u.Set("hypervisorsnapshotreserve", vv) } if v, found := p.p["iopsreadrate"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopsreadrate", vv) } if v, found := p.p["iopsreadratemax"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopsreadratemax", vv) } if v, found := p.p["iopsreadratemaxlength"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopsreadratemaxlength", vv) } if v, found := p.p["iopswriterate"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopswriterate", vv) } if v, found := p.p["iopswriteratemax"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopswriteratemax", vv) } if v, found := p.p["iopswriteratemaxlength"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopswriteratemaxlength", vv) } if v, found := p.p["maxiops"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("maxiops", vv) } if v, found := p.p["miniops"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("miniops", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["provisioningtype"]; found { u.Set("provisioningtype", v.(string)) } if v, found := p.p["storagetype"]; found { u.Set("storagetype", v.(string)) } if v, found := p.p["tags"]; found { u.Set("tags", v.(string)) } return u } func (p *CreateDiskOfferingParams) SetBytesreadrate(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bytesreadrate"] = v return } func (p *CreateDiskOfferingParams) SetBytesreadratemax(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bytesreadratemax"] = v return } func (p *CreateDiskOfferingParams) SetBytesreadratemaxlength(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bytesreadratemaxlength"] = v return } func (p *CreateDiskOfferingParams) SetByteswriterate(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["byteswriterate"] = v return } func (p *CreateDiskOfferingParams) SetByteswriteratemax(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["byteswriteratemax"] = v return } func (p *CreateDiskOfferingParams) SetByteswriteratemaxlength(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["byteswriteratemaxlength"] = v return } func (p *CreateDiskOfferingParams) SetCustomized(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customized"] = v return } func (p *CreateDiskOfferingParams) SetCustomizediops(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customizediops"] = v return } func (p *CreateDiskOfferingParams) SetDisksize(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["disksize"] = v return } func (p *CreateDiskOfferingParams) SetDisplayoffering(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displayoffering"] = v return } func (p *CreateDiskOfferingParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *CreateDiskOfferingParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateDiskOfferingParams) SetHypervisorsnapshotreserve(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisorsnapshotreserve"] = v return } func (p *CreateDiskOfferingParams) SetIopsreadrate(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopsreadrate"] = v return } func (p *CreateDiskOfferingParams) SetIopsreadratemax(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopsreadratemax"] = v return } func (p *CreateDiskOfferingParams) SetIopsreadratemaxlength(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopsreadratemaxlength"] = v return } func (p *CreateDiskOfferingParams) SetIopswriterate(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopswriterate"] = v return } func (p *CreateDiskOfferingParams) SetIopswriteratemax(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopswriteratemax"] = v return } func (p *CreateDiskOfferingParams) SetIopswriteratemaxlength(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopswriteratemaxlength"] = v return } func (p *CreateDiskOfferingParams) SetMaxiops(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxiops"] = v return } func (p *CreateDiskOfferingParams) SetMiniops(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["miniops"] = v return } func (p *CreateDiskOfferingParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateDiskOfferingParams) SetProvisioningtype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["provisioningtype"] = v return } func (p *CreateDiskOfferingParams) SetStoragetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storagetype"] = v return } func (p *CreateDiskOfferingParams) SetTags(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new CreateDiskOfferingParams instance, // as then you are sure you have configured all required params func (s *DiskOfferingService) NewCreateDiskOfferingParams(displaytext string, name string) *CreateDiskOfferingParams { p := &CreateDiskOfferingParams{} p.p = make(map[string]interface{}) p.p["displaytext"] = displaytext p.p["name"] = name return p } // Creates a disk offering. func (s *DiskOfferingService) CreateDiskOffering(p *CreateDiskOfferingParams) (*CreateDiskOfferingResponse, error) { resp, err := s.cs.newRequest("createDiskOffering", p.toURLValues()) if err != nil { return nil, err } var r CreateDiskOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateDiskOfferingResponse struct { CacheMode string `json:"cacheMode"` Created string `json:"created"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesReadRateMax int64 `json:"diskBytesReadRateMax"` DiskBytesReadRateMaxLength int64 `json:"diskBytesReadRateMaxLength"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskBytesWriteRateMax int64 `json:"diskBytesWriteRateMax"` DiskBytesWriteRateMaxLength int64 `json:"diskBytesWriteRateMaxLength"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsReadRateMax int64 `json:"diskIopsReadRateMax"` DiskIopsReadRateMaxLength int64 `json:"diskIopsReadRateMaxLength"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` DiskIopsWriteRateMax int64 `json:"diskIopsWriteRateMax"` DiskIopsWriteRateMaxLength int64 `json:"diskIopsWriteRateMaxLength"` Disksize int64 `json:"disksize"` Displayoffering bool `json:"displayoffering"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"` Id string `json:"id"` Iscustomized bool `json:"iscustomized"` Iscustomizediops bool `json:"iscustomizediops"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Provisioningtype string `json:"provisioningtype"` Storagetype string `json:"storagetype"` Tags string `json:"tags"` } type DeleteDiskOfferingParams struct { p map[string]interface{} } func (p *DeleteDiskOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteDiskOfferingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteDiskOfferingParams instance, // as then you are sure you have configured all required params func (s *DiskOfferingService) NewDeleteDiskOfferingParams(id string) *DeleteDiskOfferingParams { p := &DeleteDiskOfferingParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a disk offering. func (s *DiskOfferingService) DeleteDiskOffering(p *DeleteDiskOfferingParams) (*DeleteDiskOfferingResponse, error) { resp, err := s.cs.newRequest("deleteDiskOffering", p.toURLValues()) if err != nil { return nil, err } var r DeleteDiskOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteDiskOfferingResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteDiskOfferingResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteDiskOfferingResponse return json.Unmarshal(b, (*alias)(r)) } type ListDiskOfferingsParams struct { p map[string]interface{} } func (p *ListDiskOfferingsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListDiskOfferingsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListDiskOfferingsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListDiskOfferingsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListDiskOfferingsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListDiskOfferingsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListDiskOfferingsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListDiskOfferingsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListDiskOfferingsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListDiskOfferingsParams instance, // as then you are sure you have configured all required params func (s *DiskOfferingService) NewListDiskOfferingsParams() *ListDiskOfferingsParams { p := &ListDiskOfferingsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *DiskOfferingService) GetDiskOfferingID(name string, opts ...OptionFunc) (string, int, error) { p := &ListDiskOfferingsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListDiskOfferings(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.DiskOfferings[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.DiskOfferings { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *DiskOfferingService) GetDiskOfferingByName(name string, opts ...OptionFunc) (*DiskOffering, int, error) { id, count, err := s.GetDiskOfferingID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetDiskOfferingByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *DiskOfferingService) GetDiskOfferingByID(id string, opts ...OptionFunc) (*DiskOffering, int, error) { p := &ListDiskOfferingsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListDiskOfferings(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.DiskOfferings[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for DiskOffering UUID: %s!", id) } // Lists all available disk offerings. func (s *DiskOfferingService) ListDiskOfferings(p *ListDiskOfferingsParams) (*ListDiskOfferingsResponse, error) { resp, err := s.cs.newRequest("listDiskOfferings", p.toURLValues()) if err != nil { return nil, err } var r ListDiskOfferingsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListDiskOfferingsResponse struct { Count int `json:"count"` DiskOfferings []*DiskOffering `json:"diskoffering"` } type DiskOffering struct { CacheMode string `json:"cacheMode"` Created string `json:"created"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesReadRateMax int64 `json:"diskBytesReadRateMax"` DiskBytesReadRateMaxLength int64 `json:"diskBytesReadRateMaxLength"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskBytesWriteRateMax int64 `json:"diskBytesWriteRateMax"` DiskBytesWriteRateMaxLength int64 `json:"diskBytesWriteRateMaxLength"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsReadRateMax int64 `json:"diskIopsReadRateMax"` DiskIopsReadRateMaxLength int64 `json:"diskIopsReadRateMaxLength"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` DiskIopsWriteRateMax int64 `json:"diskIopsWriteRateMax"` DiskIopsWriteRateMaxLength int64 `json:"diskIopsWriteRateMaxLength"` Disksize int64 `json:"disksize"` Displayoffering bool `json:"displayoffering"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"` Id string `json:"id"` Iscustomized bool `json:"iscustomized"` Iscustomizediops bool `json:"iscustomizediops"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Provisioningtype string `json:"provisioningtype"` Storagetype string `json:"storagetype"` Tags string `json:"tags"` } type UpdateDiskOfferingParams struct { p map[string]interface{} } func (p *UpdateDiskOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["displayoffering"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displayoffering", vv) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["sortkey"]; found { vv := strconv.Itoa(v.(int)) u.Set("sortkey", vv) } return u } func (p *UpdateDiskOfferingParams) SetDisplayoffering(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displayoffering"] = v return } func (p *UpdateDiskOfferingParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *UpdateDiskOfferingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateDiskOfferingParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateDiskOfferingParams) SetSortkey(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sortkey"] = v return } // You should always use this function to get a new UpdateDiskOfferingParams instance, // as then you are sure you have configured all required params func (s *DiskOfferingService) NewUpdateDiskOfferingParams(id string) *UpdateDiskOfferingParams { p := &UpdateDiskOfferingParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a disk offering. func (s *DiskOfferingService) UpdateDiskOffering(p *UpdateDiskOfferingParams) (*UpdateDiskOfferingResponse, error) { resp, err := s.cs.newRequest("updateDiskOffering", p.toURLValues()) if err != nil { return nil, err } var r UpdateDiskOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateDiskOfferingResponse struct { CacheMode string `json:"cacheMode"` Created string `json:"created"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesReadRateMax int64 `json:"diskBytesReadRateMax"` DiskBytesReadRateMaxLength int64 `json:"diskBytesReadRateMaxLength"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskBytesWriteRateMax int64 `json:"diskBytesWriteRateMax"` DiskBytesWriteRateMaxLength int64 `json:"diskBytesWriteRateMaxLength"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsReadRateMax int64 `json:"diskIopsReadRateMax"` DiskIopsReadRateMaxLength int64 `json:"diskIopsReadRateMaxLength"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` DiskIopsWriteRateMax int64 `json:"diskIopsWriteRateMax"` DiskIopsWriteRateMaxLength int64 `json:"diskIopsWriteRateMaxLength"` Disksize int64 `json:"disksize"` Displayoffering bool `json:"displayoffering"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"` Id string `json:"id"` Iscustomized bool `json:"iscustomized"` Iscustomizediops bool `json:"iscustomizediops"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Provisioningtype string `json:"provisioningtype"` Storagetype string `json:"storagetype"` Tags string `json:"tags"` } go-cloudstack-2.9.0/cloudstack/DomainService.go000066400000000000000000000632751364073403100215120ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateDomainParams struct { p map[string]interface{} } func (p *CreateDomainParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkdomain"]; found { u.Set("networkdomain", v.(string)) } if v, found := p.p["parentdomainid"]; found { u.Set("parentdomainid", v.(string)) } return u } func (p *CreateDomainParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateDomainParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateDomainParams) SetNetworkdomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdomain"] = v return } func (p *CreateDomainParams) SetParentdomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["parentdomainid"] = v return } // You should always use this function to get a new CreateDomainParams instance, // as then you are sure you have configured all required params func (s *DomainService) NewCreateDomainParams(name string) *CreateDomainParams { p := &CreateDomainParams{} p.p = make(map[string]interface{}) p.p["name"] = name return p } // Creates a domain func (s *DomainService) CreateDomain(p *CreateDomainParams) (*CreateDomainResponse, error) { resp, err := s.cs.newRequest("createDomain", p.toURLValues()) if err != nil { return nil, err } var r CreateDomainResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateDomainResponse struct { Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Haschild bool `json:"haschild"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Level int `json:"level"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Parentdomainid string `json:"parentdomainid"` Parentdomainname string `json:"parentdomainname"` Path string `json:"path"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type DeleteDomainParams struct { p map[string]interface{} } func (p *DeleteDomainParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["cleanup"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("cleanup", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteDomainParams) SetCleanup(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cleanup"] = v return } func (p *DeleteDomainParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteDomainParams instance, // as then you are sure you have configured all required params func (s *DomainService) NewDeleteDomainParams(id string) *DeleteDomainParams { p := &DeleteDomainParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a specified domain func (s *DomainService) DeleteDomain(p *DeleteDomainParams) (*DeleteDomainResponse, error) { resp, err := s.cs.newRequest("deleteDomain", p.toURLValues()) if err != nil { return nil, err } var r DeleteDomainResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteDomainResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListDomainChildrenParams struct { p map[string]interface{} } func (p *ListDomainChildrenParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListDomainChildrenParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListDomainChildrenParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListDomainChildrenParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListDomainChildrenParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListDomainChildrenParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListDomainChildrenParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListDomainChildrenParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListDomainChildrenParams instance, // as then you are sure you have configured all required params func (s *DomainService) NewListDomainChildrenParams() *ListDomainChildrenParams { p := &ListDomainChildrenParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *DomainService) GetDomainChildrenID(name string, opts ...OptionFunc) (string, int, error) { p := &ListDomainChildrenParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListDomainChildren(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.DomainChildren[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.DomainChildren { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *DomainService) GetDomainChildrenByName(name string, opts ...OptionFunc) (*DomainChildren, int, error) { id, count, err := s.GetDomainChildrenID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetDomainChildrenByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *DomainService) GetDomainChildrenByID(id string, opts ...OptionFunc) (*DomainChildren, int, error) { p := &ListDomainChildrenParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListDomainChildren(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.DomainChildren[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for DomainChildren UUID: %s!", id) } // Lists all children domains belonging to a specified domain func (s *DomainService) ListDomainChildren(p *ListDomainChildrenParams) (*ListDomainChildrenResponse, error) { resp, err := s.cs.newRequest("listDomainChildren", p.toURLValues()) if err != nil { return nil, err } var r ListDomainChildrenResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListDomainChildrenResponse struct { Count int `json:"count"` DomainChildren []*DomainChildren `json:"domainchildren"` } type DomainChildren struct { Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Haschild bool `json:"haschild"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Level int `json:"level"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Parentdomainid string `json:"parentdomainid"` Parentdomainname string `json:"parentdomainname"` Path string `json:"path"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type ListDomainsParams struct { p map[string]interface{} } func (p *ListDomainsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { vv := strings.Join(v.([]string), ",") u.Set("details", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["level"]; found { vv := strconv.Itoa(v.(int)) u.Set("level", vv) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListDomainsParams) SetDetails(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *ListDomainsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListDomainsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListDomainsParams) SetLevel(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["level"] = v return } func (p *ListDomainsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListDomainsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListDomainsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListDomainsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListDomainsParams instance, // as then you are sure you have configured all required params func (s *DomainService) NewListDomainsParams() *ListDomainsParams { p := &ListDomainsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *DomainService) GetDomainID(name string, opts ...OptionFunc) (string, int, error) { p := &ListDomainsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListDomains(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Domains[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Domains { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *DomainService) GetDomainByName(name string, opts ...OptionFunc) (*Domain, int, error) { id, count, err := s.GetDomainID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetDomainByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *DomainService) GetDomainByID(id string, opts ...OptionFunc) (*Domain, int, error) { p := &ListDomainsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListDomains(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Domains[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Domain UUID: %s!", id) } // Lists domains and provides detailed information for listed domains func (s *DomainService) ListDomains(p *ListDomainsParams) (*ListDomainsResponse, error) { resp, err := s.cs.newRequest("listDomains", p.toURLValues()) if err != nil { return nil, err } var r ListDomainsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListDomainsResponse struct { Count int `json:"count"` Domains []*Domain `json:"domain"` } type Domain struct { Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Haschild bool `json:"haschild"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Level int `json:"level"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Parentdomainid string `json:"parentdomainid"` Parentdomainname string `json:"parentdomainname"` Path string `json:"path"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type UpdateDomainParams struct { p map[string]interface{} } func (p *UpdateDomainParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkdomain"]; found { u.Set("networkdomain", v.(string)) } return u } func (p *UpdateDomainParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateDomainParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateDomainParams) SetNetworkdomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdomain"] = v return } // You should always use this function to get a new UpdateDomainParams instance, // as then you are sure you have configured all required params func (s *DomainService) NewUpdateDomainParams(id string) *UpdateDomainParams { p := &UpdateDomainParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a domain with a new name func (s *DomainService) UpdateDomain(p *UpdateDomainParams) (*UpdateDomainResponse, error) { resp, err := s.cs.newRequest("updateDomain", p.toURLValues()) if err != nil { return nil, err } var r UpdateDomainResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateDomainResponse struct { Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Haschild bool `json:"haschild"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Level int `json:"level"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Parentdomainid string `json:"parentdomainid"` Parentdomainname string `json:"parentdomainname"` Path string `json:"path"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } go-cloudstack-2.9.0/cloudstack/EventService.go000066400000000000000000000303711364073403100213530ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type ArchiveEventsParams struct { p map[string]interface{} } func (p *ArchiveEventsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["enddate"]; found { u.Set("enddate", v.(string)) } if v, found := p.p["ids"]; found { vv := strings.Join(v.([]string), ",") u.Set("ids", vv) } if v, found := p.p["startdate"]; found { u.Set("startdate", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *ArchiveEventsParams) SetEnddate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enddate"] = v return } func (p *ArchiveEventsParams) SetIds(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ids"] = v return } func (p *ArchiveEventsParams) SetStartdate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startdate"] = v return } func (p *ArchiveEventsParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new ArchiveEventsParams instance, // as then you are sure you have configured all required params func (s *EventService) NewArchiveEventsParams() *ArchiveEventsParams { p := &ArchiveEventsParams{} p.p = make(map[string]interface{}) return p } // Archive one or more events. func (s *EventService) ArchiveEvents(p *ArchiveEventsParams) (*ArchiveEventsResponse, error) { resp, err := s.cs.newRequest("archiveEvents", p.toURLValues()) if err != nil { return nil, err } var r ArchiveEventsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ArchiveEventsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *ArchiveEventsResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias ArchiveEventsResponse return json.Unmarshal(b, (*alias)(r)) } type DeleteEventsParams struct { p map[string]interface{} } func (p *DeleteEventsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["enddate"]; found { u.Set("enddate", v.(string)) } if v, found := p.p["ids"]; found { vv := strings.Join(v.([]string), ",") u.Set("ids", vv) } if v, found := p.p["startdate"]; found { u.Set("startdate", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *DeleteEventsParams) SetEnddate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enddate"] = v return } func (p *DeleteEventsParams) SetIds(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ids"] = v return } func (p *DeleteEventsParams) SetStartdate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startdate"] = v return } func (p *DeleteEventsParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new DeleteEventsParams instance, // as then you are sure you have configured all required params func (s *EventService) NewDeleteEventsParams() *DeleteEventsParams { p := &DeleteEventsParams{} p.p = make(map[string]interface{}) return p } // Delete one or more events. func (s *EventService) DeleteEvents(p *DeleteEventsParams) (*DeleteEventsResponse, error) { resp, err := s.cs.newRequest("deleteEvents", p.toURLValues()) if err != nil { return nil, err } var r DeleteEventsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteEventsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteEventsResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteEventsResponse return json.Unmarshal(b, (*alias)(r)) } type ListEventTypesParams struct { p map[string]interface{} } func (p *ListEventTypesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } return u } // You should always use this function to get a new ListEventTypesParams instance, // as then you are sure you have configured all required params func (s *EventService) NewListEventTypesParams() *ListEventTypesParams { p := &ListEventTypesParams{} p.p = make(map[string]interface{}) return p } // List Event Types func (s *EventService) ListEventTypes(p *ListEventTypesParams) (*ListEventTypesResponse, error) { resp, err := s.cs.newRequest("listEventTypes", p.toURLValues()) if err != nil { return nil, err } var r ListEventTypesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListEventTypesResponse struct { Count int `json:"count"` EventTypes []*EventType `json:"eventtype"` } type EventType struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` } type ListEventsParams struct { p map[string]interface{} } func (p *ListEventsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["duration"]; found { vv := strconv.Itoa(v.(int)) u.Set("duration", vv) } if v, found := p.p["enddate"]; found { u.Set("enddate", v.(string)) } if v, found := p.p["entrytime"]; found { vv := strconv.Itoa(v.(int)) u.Set("entrytime", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["level"]; found { u.Set("level", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["startdate"]; found { u.Set("startdate", v.(string)) } if v, found := p.p["startid"]; found { u.Set("startid", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *ListEventsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListEventsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListEventsParams) SetDuration(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["duration"] = v return } func (p *ListEventsParams) SetEnddate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enddate"] = v return } func (p *ListEventsParams) SetEntrytime(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["entrytime"] = v return } func (p *ListEventsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListEventsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListEventsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListEventsParams) SetLevel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["level"] = v return } func (p *ListEventsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListEventsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListEventsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListEventsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListEventsParams) SetStartdate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startdate"] = v return } func (p *ListEventsParams) SetStartid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startid"] = v return } func (p *ListEventsParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new ListEventsParams instance, // as then you are sure you have configured all required params func (s *EventService) NewListEventsParams() *ListEventsParams { p := &ListEventsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *EventService) GetEventByID(id string, opts ...OptionFunc) (*Event, int, error) { p := &ListEventsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListEvents(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Events[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Event UUID: %s!", id) } // A command to list events. func (s *EventService) ListEvents(p *ListEventsParams) (*ListEventsResponse, error) { resp, err := s.cs.newRequest("listEvents", p.toURLValues()) if err != nil { return nil, err } var r ListEventsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListEventsResponse struct { Count int `json:"count"` Events []*Event `json:"event"` } type Event struct { Account string `json:"account"` Created string `json:"created"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Level string `json:"level"` Parentid string `json:"parentid"` Project string `json:"project"` Projectid string `json:"projectid"` State string `json:"state"` Type string `json:"type"` Username string `json:"username"` } go-cloudstack-2.9.0/cloudstack/ExtFirewallService.go000066400000000000000000000011571364073403100225200ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack go-cloudstack-2.9.0/cloudstack/ExtLoadBalancerService.go000066400000000000000000000011571364073403100232620ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack go-cloudstack-2.9.0/cloudstack/ExternalDeviceService.go000066400000000000000000000011571364073403100231740ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack go-cloudstack-2.9.0/cloudstack/FirewallService.go000066400000000000000000001711641364073403100220450ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) // Helper function for maintaining backwards compatibility func convertFirewallServiceResponse(b []byte) ([]byte, error) { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return nil, err } if _, ok := raw["firewallrule"]; ok { return convertFirewallServiceListResponse(b) } for _, k := range []string{"endport", "startport"} { if sVal, ok := raw[k].(string); ok { iVal, err := strconv.Atoi(sVal) if err != nil { return nil, err } raw[k] = iVal } } return json.Marshal(raw) } // Helper function for maintaining backwards compatibility func convertFirewallServiceListResponse(b []byte) ([]byte, error) { var rawList struct { Count int `json:"count"` FirewallRules []map[string]interface{} `json:"firewallrule"` } if err := json.Unmarshal(b, &rawList); err != nil { return nil, err } for _, r := range rawList.FirewallRules { for _, k := range []string{"endport", "startport"} { if sVal, ok := r[k].(string); ok { iVal, err := strconv.Atoi(sVal) if err != nil { return nil, err } r[k] = iVal } } } return json.Marshal(rawList) } type AddPaloAltoFirewallParams struct { p map[string]interface{} } func (p *AddPaloAltoFirewallParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["networkdevicetype"]; found { u.Set("networkdevicetype", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddPaloAltoFirewallParams) SetNetworkdevicetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdevicetype"] = v return } func (p *AddPaloAltoFirewallParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddPaloAltoFirewallParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddPaloAltoFirewallParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddPaloAltoFirewallParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddPaloAltoFirewallParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewAddPaloAltoFirewallParams(networkdevicetype string, password string, physicalnetworkid string, url string, username string) *AddPaloAltoFirewallParams { p := &AddPaloAltoFirewallParams{} p.p = make(map[string]interface{}) p.p["networkdevicetype"] = networkdevicetype p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["url"] = url p.p["username"] = username return p } // Adds a Palo Alto firewall device func (s *FirewallService) AddPaloAltoFirewall(p *AddPaloAltoFirewallParams) (*AddPaloAltoFirewallResponse, error) { resp, err := s.cs.newRequest("addPaloAltoFirewall", p.toURLValues()) if err != nil { return nil, err } var r AddPaloAltoFirewallResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddPaloAltoFirewallResponse struct { Fwdevicecapacity int64 `json:"fwdevicecapacity"` Fwdeviceid string `json:"fwdeviceid"` Fwdevicename string `json:"fwdevicename"` Fwdevicestate string `json:"fwdevicestate"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Numretries string `json:"numretries"` Physicalnetworkid string `json:"physicalnetworkid"` Privateinterface string `json:"privateinterface"` Privatezone string `json:"privatezone"` Provider string `json:"provider"` Publicinterface string `json:"publicinterface"` Publiczone string `json:"publiczone"` Timeout string `json:"timeout"` Usageinterface string `json:"usageinterface"` Username string `json:"username"` Zoneid string `json:"zoneid"` } type ConfigurePaloAltoFirewallParams struct { p map[string]interface{} } func (p *ConfigurePaloAltoFirewallParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fwdevicecapacity"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("fwdevicecapacity", vv) } if v, found := p.p["fwdeviceid"]; found { u.Set("fwdeviceid", v.(string)) } return u } func (p *ConfigurePaloAltoFirewallParams) SetFwdevicecapacity(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fwdevicecapacity"] = v return } func (p *ConfigurePaloAltoFirewallParams) SetFwdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fwdeviceid"] = v return } // You should always use this function to get a new ConfigurePaloAltoFirewallParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewConfigurePaloAltoFirewallParams(fwdeviceid string) *ConfigurePaloAltoFirewallParams { p := &ConfigurePaloAltoFirewallParams{} p.p = make(map[string]interface{}) p.p["fwdeviceid"] = fwdeviceid return p } // Configures a Palo Alto firewall device func (s *FirewallService) ConfigurePaloAltoFirewall(p *ConfigurePaloAltoFirewallParams) (*PaloAltoFirewallResponse, error) { resp, err := s.cs.newRequest("configurePaloAltoFirewall", p.toURLValues()) if err != nil { return nil, err } var r PaloAltoFirewallResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type PaloAltoFirewallResponse struct { Fwdevicecapacity int64 `json:"fwdevicecapacity"` Fwdeviceid string `json:"fwdeviceid"` Fwdevicename string `json:"fwdevicename"` Fwdevicestate string `json:"fwdevicestate"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Numretries string `json:"numretries"` Physicalnetworkid string `json:"physicalnetworkid"` Privateinterface string `json:"privateinterface"` Privatezone string `json:"privatezone"` Provider string `json:"provider"` Publicinterface string `json:"publicinterface"` Publiczone string `json:"publiczone"` Timeout string `json:"timeout"` Usageinterface string `json:"usageinterface"` Username string `json:"username"` Zoneid string `json:"zoneid"` } type CreateEgressFirewallRuleParams struct { p map[string]interface{} } func (p *CreateEgressFirewallRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["cidrlist"]; found { vv := strings.Join(v.([]string), ",") u.Set("cidrlist", vv) } if v, found := p.p["destcidrlist"]; found { vv := strings.Join(v.([]string), ",") u.Set("destcidrlist", vv) } if v, found := p.p["endport"]; found { vv := strconv.Itoa(v.(int)) u.Set("endport", vv) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["icmpcode"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmpcode", vv) } if v, found := p.p["icmptype"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmptype", vv) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["startport"]; found { vv := strconv.Itoa(v.(int)) u.Set("startport", vv) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *CreateEgressFirewallRuleParams) SetCidrlist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *CreateEgressFirewallRuleParams) SetDestcidrlist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["destcidrlist"] = v return } func (p *CreateEgressFirewallRuleParams) SetEndport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endport"] = v return } func (p *CreateEgressFirewallRuleParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateEgressFirewallRuleParams) SetIcmpcode(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmpcode"] = v return } func (p *CreateEgressFirewallRuleParams) SetIcmptype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmptype"] = v return } func (p *CreateEgressFirewallRuleParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *CreateEgressFirewallRuleParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *CreateEgressFirewallRuleParams) SetStartport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startport"] = v return } func (p *CreateEgressFirewallRuleParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new CreateEgressFirewallRuleParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewCreateEgressFirewallRuleParams(networkid string, protocol string) *CreateEgressFirewallRuleParams { p := &CreateEgressFirewallRuleParams{} p.p = make(map[string]interface{}) p.p["networkid"] = networkid p.p["protocol"] = protocol return p } // Creates a egress firewall rule for a given network func (s *FirewallService) CreateEgressFirewallRule(p *CreateEgressFirewallRuleParams) (*CreateEgressFirewallRuleResponse, error) { resp, err := s.cs.newRequest("createEgressFirewallRule", p.toURLValues()) if err != nil { return nil, err } var r CreateEgressFirewallRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateEgressFirewallRuleResponse struct { Cidrlist string `json:"cidrlist"` Destcidrlist string `json:"destcidrlist"` Endport int `json:"endport"` Fordisplay bool `json:"fordisplay"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Protocol string `json:"protocol"` Startport int `json:"startport"` State string `json:"state"` Tags []Tags `json:"tags"` } type CreateFirewallRuleParams struct { p map[string]interface{} } func (p *CreateFirewallRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["cidrlist"]; found { vv := strings.Join(v.([]string), ",") u.Set("cidrlist", vv) } if v, found := p.p["endport"]; found { vv := strconv.Itoa(v.(int)) u.Set("endport", vv) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["icmpcode"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmpcode", vv) } if v, found := p.p["icmptype"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmptype", vv) } if v, found := p.p["ipaddressid"]; found { u.Set("ipaddressid", v.(string)) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["startport"]; found { vv := strconv.Itoa(v.(int)) u.Set("startport", vv) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *CreateFirewallRuleParams) SetCidrlist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *CreateFirewallRuleParams) SetEndport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endport"] = v return } func (p *CreateFirewallRuleParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateFirewallRuleParams) SetIcmpcode(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmpcode"] = v return } func (p *CreateFirewallRuleParams) SetIcmptype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmptype"] = v return } func (p *CreateFirewallRuleParams) SetIpaddressid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddressid"] = v return } func (p *CreateFirewallRuleParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *CreateFirewallRuleParams) SetStartport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startport"] = v return } func (p *CreateFirewallRuleParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new CreateFirewallRuleParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewCreateFirewallRuleParams(ipaddressid string, protocol string) *CreateFirewallRuleParams { p := &CreateFirewallRuleParams{} p.p = make(map[string]interface{}) p.p["ipaddressid"] = ipaddressid p.p["protocol"] = protocol return p } // Creates a firewall rule for a given IP address func (s *FirewallService) CreateFirewallRule(p *CreateFirewallRuleParams) (*CreateFirewallRuleResponse, error) { resp, err := s.cs.newRequest("createFirewallRule", p.toURLValues()) if err != nil { return nil, err } var r CreateFirewallRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateFirewallRuleResponse struct { Cidrlist string `json:"cidrlist"` Destcidrlist string `json:"destcidrlist"` Endport int `json:"endport"` Fordisplay bool `json:"fordisplay"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Protocol string `json:"protocol"` Startport int `json:"startport"` State string `json:"state"` Tags []Tags `json:"tags"` } type CreatePortForwardingRuleParams struct { p map[string]interface{} } func (p *CreatePortForwardingRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["cidrlist"]; found { vv := strings.Join(v.([]string), ",") u.Set("cidrlist", vv) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["ipaddressid"]; found { u.Set("ipaddressid", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["openfirewall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("openfirewall", vv) } if v, found := p.p["privateendport"]; found { vv := strconv.Itoa(v.(int)) u.Set("privateendport", vv) } if v, found := p.p["privateport"]; found { vv := strconv.Itoa(v.(int)) u.Set("privateport", vv) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["publicendport"]; found { vv := strconv.Itoa(v.(int)) u.Set("publicendport", vv) } if v, found := p.p["publicport"]; found { vv := strconv.Itoa(v.(int)) u.Set("publicport", vv) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } if v, found := p.p["vmguestip"]; found { u.Set("vmguestip", v.(string)) } return u } func (p *CreatePortForwardingRuleParams) SetCidrlist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *CreatePortForwardingRuleParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreatePortForwardingRuleParams) SetIpaddressid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddressid"] = v return } func (p *CreatePortForwardingRuleParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *CreatePortForwardingRuleParams) SetOpenfirewall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["openfirewall"] = v return } func (p *CreatePortForwardingRuleParams) SetPrivateendport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["privateendport"] = v return } func (p *CreatePortForwardingRuleParams) SetPrivateport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["privateport"] = v return } func (p *CreatePortForwardingRuleParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *CreatePortForwardingRuleParams) SetPublicendport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publicendport"] = v return } func (p *CreatePortForwardingRuleParams) SetPublicport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publicport"] = v return } func (p *CreatePortForwardingRuleParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } func (p *CreatePortForwardingRuleParams) SetVmguestip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmguestip"] = v return } // You should always use this function to get a new CreatePortForwardingRuleParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewCreatePortForwardingRuleParams(ipaddressid string, privateport int, protocol string, publicport int, virtualmachineid string) *CreatePortForwardingRuleParams { p := &CreatePortForwardingRuleParams{} p.p = make(map[string]interface{}) p.p["ipaddressid"] = ipaddressid p.p["privateport"] = privateport p.p["protocol"] = protocol p.p["publicport"] = publicport p.p["virtualmachineid"] = virtualmachineid return p } // Creates a port forwarding rule func (s *FirewallService) CreatePortForwardingRule(p *CreatePortForwardingRuleParams) (*CreatePortForwardingRuleResponse, error) { resp, err := s.cs.newRequest("createPortForwardingRule", p.toURLValues()) if err != nil { return nil, err } var r CreatePortForwardingRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreatePortForwardingRuleResponse struct { Cidrlist string `json:"cidrlist"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Privateendport string `json:"privateendport"` Privateport string `json:"privateport"` Protocol string `json:"protocol"` Publicendport string `json:"publicendport"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualmachinedisplayname string `json:"virtualmachinedisplayname"` Virtualmachineid string `json:"virtualmachineid"` Virtualmachinename string `json:"virtualmachinename"` Vmguestip string `json:"vmguestip"` } type DeleteEgressFirewallRuleParams struct { p map[string]interface{} } func (p *DeleteEgressFirewallRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteEgressFirewallRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteEgressFirewallRuleParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewDeleteEgressFirewallRuleParams(id string) *DeleteEgressFirewallRuleParams { p := &DeleteEgressFirewallRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes an egress firewall rule func (s *FirewallService) DeleteEgressFirewallRule(p *DeleteEgressFirewallRuleParams) (*DeleteEgressFirewallRuleResponse, error) { resp, err := s.cs.newRequest("deleteEgressFirewallRule", p.toURLValues()) if err != nil { return nil, err } var r DeleteEgressFirewallRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteEgressFirewallRuleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteFirewallRuleParams struct { p map[string]interface{} } func (p *DeleteFirewallRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteFirewallRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteFirewallRuleParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewDeleteFirewallRuleParams(id string) *DeleteFirewallRuleParams { p := &DeleteFirewallRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a firewall rule func (s *FirewallService) DeleteFirewallRule(p *DeleteFirewallRuleParams) (*DeleteFirewallRuleResponse, error) { resp, err := s.cs.newRequest("deleteFirewallRule", p.toURLValues()) if err != nil { return nil, err } var r DeleteFirewallRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteFirewallRuleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeletePaloAltoFirewallParams struct { p map[string]interface{} } func (p *DeletePaloAltoFirewallParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fwdeviceid"]; found { u.Set("fwdeviceid", v.(string)) } return u } func (p *DeletePaloAltoFirewallParams) SetFwdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fwdeviceid"] = v return } // You should always use this function to get a new DeletePaloAltoFirewallParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewDeletePaloAltoFirewallParams(fwdeviceid string) *DeletePaloAltoFirewallParams { p := &DeletePaloAltoFirewallParams{} p.p = make(map[string]interface{}) p.p["fwdeviceid"] = fwdeviceid return p } // delete a Palo Alto firewall device func (s *FirewallService) DeletePaloAltoFirewall(p *DeletePaloAltoFirewallParams) (*DeletePaloAltoFirewallResponse, error) { resp, err := s.cs.newRequest("deletePaloAltoFirewall", p.toURLValues()) if err != nil { return nil, err } var r DeletePaloAltoFirewallResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeletePaloAltoFirewallResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeletePortForwardingRuleParams struct { p map[string]interface{} } func (p *DeletePortForwardingRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeletePortForwardingRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeletePortForwardingRuleParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewDeletePortForwardingRuleParams(id string) *DeletePortForwardingRuleParams { p := &DeletePortForwardingRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a port forwarding rule func (s *FirewallService) DeletePortForwardingRule(p *DeletePortForwardingRuleParams) (*DeletePortForwardingRuleResponse, error) { resp, err := s.cs.newRequest("deletePortForwardingRule", p.toURLValues()) if err != nil { return nil, err } var r DeletePortForwardingRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeletePortForwardingRuleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListEgressFirewallRulesParams struct { p map[string]interface{} } func (p *ListEgressFirewallRulesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ipaddressid"]; found { u.Set("ipaddressid", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } return u } func (p *ListEgressFirewallRulesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListEgressFirewallRulesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListEgressFirewallRulesParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListEgressFirewallRulesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListEgressFirewallRulesParams) SetIpaddressid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddressid"] = v return } func (p *ListEgressFirewallRulesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListEgressFirewallRulesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListEgressFirewallRulesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListEgressFirewallRulesParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListEgressFirewallRulesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListEgressFirewallRulesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListEgressFirewallRulesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListEgressFirewallRulesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new ListEgressFirewallRulesParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewListEgressFirewallRulesParams() *ListEgressFirewallRulesParams { p := &ListEgressFirewallRulesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *FirewallService) GetEgressFirewallRuleByID(id string, opts ...OptionFunc) (*EgressFirewallRule, int, error) { p := &ListEgressFirewallRulesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListEgressFirewallRules(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.EgressFirewallRules[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for EgressFirewallRule UUID: %s!", id) } // Lists all egress firewall rules for network ID. func (s *FirewallService) ListEgressFirewallRules(p *ListEgressFirewallRulesParams) (*ListEgressFirewallRulesResponse, error) { resp, err := s.cs.newRequest("listEgressFirewallRules", p.toURLValues()) if err != nil { return nil, err } resp, err = convertFirewallServiceResponse(resp) if err != nil { return nil, err } var r ListEgressFirewallRulesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListEgressFirewallRulesResponse struct { Count int `json:"count"` EgressFirewallRules []*EgressFirewallRule `json:"firewallrule"` } type EgressFirewallRule struct { Cidrlist string `json:"cidrlist"` Destcidrlist string `json:"destcidrlist"` Endport int `json:"endport"` Fordisplay bool `json:"fordisplay"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Protocol string `json:"protocol"` Startport int `json:"startport"` State string `json:"state"` Tags []Tags `json:"tags"` } type ListFirewallRulesParams struct { p map[string]interface{} } func (p *ListFirewallRulesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ipaddressid"]; found { u.Set("ipaddressid", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } return u } func (p *ListFirewallRulesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListFirewallRulesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListFirewallRulesParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListFirewallRulesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListFirewallRulesParams) SetIpaddressid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddressid"] = v return } func (p *ListFirewallRulesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListFirewallRulesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListFirewallRulesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListFirewallRulesParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListFirewallRulesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListFirewallRulesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListFirewallRulesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListFirewallRulesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new ListFirewallRulesParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewListFirewallRulesParams() *ListFirewallRulesParams { p := &ListFirewallRulesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *FirewallService) GetFirewallRuleByID(id string, opts ...OptionFunc) (*FirewallRule, int, error) { p := &ListFirewallRulesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListFirewallRules(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.FirewallRules[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for FirewallRule UUID: %s!", id) } // Lists all firewall rules for an IP address. func (s *FirewallService) ListFirewallRules(p *ListFirewallRulesParams) (*ListFirewallRulesResponse, error) { resp, err := s.cs.newRequest("listFirewallRules", p.toURLValues()) if err != nil { return nil, err } resp, err = convertFirewallServiceResponse(resp) if err != nil { return nil, err } var r ListFirewallRulesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListFirewallRulesResponse struct { Count int `json:"count"` FirewallRules []*FirewallRule `json:"firewallrule"` } type FirewallRule struct { Cidrlist string `json:"cidrlist"` Destcidrlist string `json:"destcidrlist"` Endport int `json:"endport"` Fordisplay bool `json:"fordisplay"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Protocol string `json:"protocol"` Startport int `json:"startport"` State string `json:"state"` Tags []Tags `json:"tags"` } type ListPaloAltoFirewallsParams struct { p map[string]interface{} } func (p *ListPaloAltoFirewallsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fwdeviceid"]; found { u.Set("fwdeviceid", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } return u } func (p *ListPaloAltoFirewallsParams) SetFwdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fwdeviceid"] = v return } func (p *ListPaloAltoFirewallsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListPaloAltoFirewallsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListPaloAltoFirewallsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListPaloAltoFirewallsParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } // You should always use this function to get a new ListPaloAltoFirewallsParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewListPaloAltoFirewallsParams() *ListPaloAltoFirewallsParams { p := &ListPaloAltoFirewallsParams{} p.p = make(map[string]interface{}) return p } // lists Palo Alto firewall devices in a physical network func (s *FirewallService) ListPaloAltoFirewalls(p *ListPaloAltoFirewallsParams) (*ListPaloAltoFirewallsResponse, error) { resp, err := s.cs.newRequest("listPaloAltoFirewalls", p.toURLValues()) if err != nil { return nil, err } resp, err = convertFirewallServiceResponse(resp) if err != nil { return nil, err } var r ListPaloAltoFirewallsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListPaloAltoFirewallsResponse struct { Count int `json:"count"` PaloAltoFirewalls []*PaloAltoFirewall `json:"paloaltofirewall"` } type PaloAltoFirewall struct { Fwdevicecapacity int64 `json:"fwdevicecapacity"` Fwdeviceid string `json:"fwdeviceid"` Fwdevicename string `json:"fwdevicename"` Fwdevicestate string `json:"fwdevicestate"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Numretries string `json:"numretries"` Physicalnetworkid string `json:"physicalnetworkid"` Privateinterface string `json:"privateinterface"` Privatezone string `json:"privatezone"` Provider string `json:"provider"` Publicinterface string `json:"publicinterface"` Publiczone string `json:"publiczone"` Timeout string `json:"timeout"` Usageinterface string `json:"usageinterface"` Username string `json:"username"` Zoneid string `json:"zoneid"` } type ListPortForwardingRulesParams struct { p map[string]interface{} } func (p *ListPortForwardingRulesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ipaddressid"]; found { u.Set("ipaddressid", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } return u } func (p *ListPortForwardingRulesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListPortForwardingRulesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListPortForwardingRulesParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListPortForwardingRulesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListPortForwardingRulesParams) SetIpaddressid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddressid"] = v return } func (p *ListPortForwardingRulesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListPortForwardingRulesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListPortForwardingRulesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListPortForwardingRulesParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListPortForwardingRulesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListPortForwardingRulesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListPortForwardingRulesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListPortForwardingRulesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new ListPortForwardingRulesParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewListPortForwardingRulesParams() *ListPortForwardingRulesParams { p := &ListPortForwardingRulesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *FirewallService) GetPortForwardingRuleByID(id string, opts ...OptionFunc) (*PortForwardingRule, int, error) { p := &ListPortForwardingRulesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListPortForwardingRules(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.PortForwardingRules[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for PortForwardingRule UUID: %s!", id) } // Lists all port forwarding rules for an IP address. func (s *FirewallService) ListPortForwardingRules(p *ListPortForwardingRulesParams) (*ListPortForwardingRulesResponse, error) { resp, err := s.cs.newRequest("listPortForwardingRules", p.toURLValues()) if err != nil { return nil, err } resp, err = convertFirewallServiceResponse(resp) if err != nil { return nil, err } var r ListPortForwardingRulesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListPortForwardingRulesResponse struct { Count int `json:"count"` PortForwardingRules []*PortForwardingRule `json:"portforwardingrule"` } type PortForwardingRule struct { Cidrlist string `json:"cidrlist"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Privateendport string `json:"privateendport"` Privateport string `json:"privateport"` Protocol string `json:"protocol"` Publicendport string `json:"publicendport"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualmachinedisplayname string `json:"virtualmachinedisplayname"` Virtualmachineid string `json:"virtualmachineid"` Virtualmachinename string `json:"virtualmachinename"` Vmguestip string `json:"vmguestip"` } type UpdateEgressFirewallRuleParams struct { p map[string]interface{} } func (p *UpdateEgressFirewallRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateEgressFirewallRuleParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateEgressFirewallRuleParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateEgressFirewallRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateEgressFirewallRuleParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewUpdateEgressFirewallRuleParams(id string) *UpdateEgressFirewallRuleParams { p := &UpdateEgressFirewallRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates egress firewall rule func (s *FirewallService) UpdateEgressFirewallRule(p *UpdateEgressFirewallRuleParams) (*UpdateEgressFirewallRuleResponse, error) { resp, err := s.cs.newRequest("updateEgressFirewallRule", p.toURLValues()) if err != nil { return nil, err } var r UpdateEgressFirewallRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateEgressFirewallRuleResponse struct { Cidrlist string `json:"cidrlist"` Destcidrlist string `json:"destcidrlist"` Endport int `json:"endport"` Fordisplay bool `json:"fordisplay"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Protocol string `json:"protocol"` Startport int `json:"startport"` State string `json:"state"` Tags []Tags `json:"tags"` } type UpdateFirewallRuleParams struct { p map[string]interface{} } func (p *UpdateFirewallRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateFirewallRuleParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateFirewallRuleParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateFirewallRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateFirewallRuleParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewUpdateFirewallRuleParams(id string) *UpdateFirewallRuleParams { p := &UpdateFirewallRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates firewall rule func (s *FirewallService) UpdateFirewallRule(p *UpdateFirewallRuleParams) (*UpdateFirewallRuleResponse, error) { resp, err := s.cs.newRequest("updateFirewallRule", p.toURLValues()) if err != nil { return nil, err } var r UpdateFirewallRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateFirewallRuleResponse struct { Cidrlist string `json:"cidrlist"` Destcidrlist string `json:"destcidrlist"` Endport int `json:"endport"` Fordisplay bool `json:"fordisplay"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Protocol string `json:"protocol"` Startport int `json:"startport"` State string `json:"state"` Tags []Tags `json:"tags"` } type UpdatePortForwardingRuleParams struct { p map[string]interface{} } func (p *UpdatePortForwardingRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["privateendport"]; found { vv := strconv.Itoa(v.(int)) u.Set("privateendport", vv) } if v, found := p.p["privateport"]; found { vv := strconv.Itoa(v.(int)) u.Set("privateport", vv) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } if v, found := p.p["vmguestip"]; found { u.Set("vmguestip", v.(string)) } return u } func (p *UpdatePortForwardingRuleParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdatePortForwardingRuleParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdatePortForwardingRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdatePortForwardingRuleParams) SetPrivateendport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["privateendport"] = v return } func (p *UpdatePortForwardingRuleParams) SetPrivateport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["privateport"] = v return } func (p *UpdatePortForwardingRuleParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } func (p *UpdatePortForwardingRuleParams) SetVmguestip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmguestip"] = v return } // You should always use this function to get a new UpdatePortForwardingRuleParams instance, // as then you are sure you have configured all required params func (s *FirewallService) NewUpdatePortForwardingRuleParams(id string) *UpdatePortForwardingRuleParams { p := &UpdatePortForwardingRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a port forwarding rule. Only the private port and the virtual machine can be updated. func (s *FirewallService) UpdatePortForwardingRule(p *UpdatePortForwardingRuleParams) (*UpdatePortForwardingRuleResponse, error) { resp, err := s.cs.newRequest("updatePortForwardingRule", p.toURLValues()) if err != nil { return nil, err } var r UpdatePortForwardingRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } b, err = convertFirewallServiceResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdatePortForwardingRuleResponse struct { Cidrlist string `json:"cidrlist"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Privateendport string `json:"privateendport"` Privateport string `json:"privateport"` Protocol string `json:"protocol"` Publicendport string `json:"publicendport"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualmachinedisplayname string `json:"virtualmachinedisplayname"` Virtualmachineid string `json:"virtualmachineid"` Virtualmachinename string `json:"virtualmachinename"` Vmguestip string `json:"vmguestip"` } go-cloudstack-2.9.0/cloudstack/GuestOSService.go000066400000000000000000000671661364073403100216370ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AddGuestOsParams struct { p map[string]interface{} } func (p *AddGuestOsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].key", i), k) u.Set(fmt.Sprintf("details[%d].value", i), m[k]) } } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["oscategoryid"]; found { u.Set("oscategoryid", v.(string)) } if v, found := p.p["osdisplayname"]; found { u.Set("osdisplayname", v.(string)) } return u } func (p *AddGuestOsParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *AddGuestOsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *AddGuestOsParams) SetOscategoryid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["oscategoryid"] = v return } func (p *AddGuestOsParams) SetOsdisplayname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["osdisplayname"] = v return } // You should always use this function to get a new AddGuestOsParams instance, // as then you are sure you have configured all required params func (s *GuestOSService) NewAddGuestOsParams(details map[string]string, oscategoryid string, osdisplayname string) *AddGuestOsParams { p := &AddGuestOsParams{} p.p = make(map[string]interface{}) p.p["details"] = details p.p["oscategoryid"] = oscategoryid p.p["osdisplayname"] = osdisplayname return p } // Add a new guest OS type func (s *GuestOSService) AddGuestOs(p *AddGuestOsParams) (*AddGuestOsResponse, error) { resp, err := s.cs.newRequest("addGuestOs", p.toURLValues()) if err != nil { return nil, err } var r AddGuestOsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddGuestOsResponse struct { Description string `json:"description"` Id string `json:"id"` Isuserdefined bool `json:"isuserdefined"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Oscategoryid string `json:"oscategoryid"` } type AddGuestOsMappingParams struct { p map[string]interface{} } func (p *AddGuestOsMappingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["hypervisorversion"]; found { u.Set("hypervisorversion", v.(string)) } if v, found := p.p["osdisplayname"]; found { u.Set("osdisplayname", v.(string)) } if v, found := p.p["osnameforhypervisor"]; found { u.Set("osnameforhypervisor", v.(string)) } if v, found := p.p["ostypeid"]; found { u.Set("ostypeid", v.(string)) } return u } func (p *AddGuestOsMappingParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *AddGuestOsMappingParams) SetHypervisorversion(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisorversion"] = v return } func (p *AddGuestOsMappingParams) SetOsdisplayname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["osdisplayname"] = v return } func (p *AddGuestOsMappingParams) SetOsnameforhypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["osnameforhypervisor"] = v return } func (p *AddGuestOsMappingParams) SetOstypeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ostypeid"] = v return } // You should always use this function to get a new AddGuestOsMappingParams instance, // as then you are sure you have configured all required params func (s *GuestOSService) NewAddGuestOsMappingParams(hypervisor string, hypervisorversion string, osnameforhypervisor string) *AddGuestOsMappingParams { p := &AddGuestOsMappingParams{} p.p = make(map[string]interface{}) p.p["hypervisor"] = hypervisor p.p["hypervisorversion"] = hypervisorversion p.p["osnameforhypervisor"] = osnameforhypervisor return p } // Adds a guest OS name to hypervisor OS name mapping func (s *GuestOSService) AddGuestOsMapping(p *AddGuestOsMappingParams) (*AddGuestOsMappingResponse, error) { resp, err := s.cs.newRequest("addGuestOsMapping", p.toURLValues()) if err != nil { return nil, err } var r AddGuestOsMappingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddGuestOsMappingResponse struct { Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Isuserdefined string `json:"isuserdefined"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Osdisplayname string `json:"osdisplayname"` Osnameforhypervisor string `json:"osnameforhypervisor"` Ostypeid string `json:"ostypeid"` } func (r *AddGuestOsMappingResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias AddGuestOsMappingResponse return json.Unmarshal(b, (*alias)(r)) } type ListGuestOsMappingParams struct { p map[string]interface{} } func (p *ListGuestOsMappingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["hypervisorversion"]; found { u.Set("hypervisorversion", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["ostypeid"]; found { u.Set("ostypeid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListGuestOsMappingParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *ListGuestOsMappingParams) SetHypervisorversion(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisorversion"] = v return } func (p *ListGuestOsMappingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListGuestOsMappingParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListGuestOsMappingParams) SetOstypeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ostypeid"] = v return } func (p *ListGuestOsMappingParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListGuestOsMappingParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListGuestOsMappingParams instance, // as then you are sure you have configured all required params func (s *GuestOSService) NewListGuestOsMappingParams() *ListGuestOsMappingParams { p := &ListGuestOsMappingParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *GuestOSService) GetGuestOsMappingByID(id string, opts ...OptionFunc) (*GuestOsMapping, int, error) { p := &ListGuestOsMappingParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListGuestOsMapping(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.GuestOsMapping[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for GuestOsMapping UUID: %s!", id) } // Lists all available OS mappings for given hypervisor func (s *GuestOSService) ListGuestOsMapping(p *ListGuestOsMappingParams) (*ListGuestOsMappingResponse, error) { resp, err := s.cs.newRequest("listGuestOsMapping", p.toURLValues()) if err != nil { return nil, err } var r ListGuestOsMappingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListGuestOsMappingResponse struct { Count int `json:"count"` GuestOsMapping []*GuestOsMapping `json:"guestosmapping"` } type GuestOsMapping struct { Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Isuserdefined string `json:"isuserdefined"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Osdisplayname string `json:"osdisplayname"` Osnameforhypervisor string `json:"osnameforhypervisor"` Ostypeid string `json:"ostypeid"` } func (r *GuestOsMapping) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias GuestOsMapping return json.Unmarshal(b, (*alias)(r)) } type ListOsCategoriesParams struct { p map[string]interface{} } func (p *ListOsCategoriesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListOsCategoriesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListOsCategoriesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListOsCategoriesParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListOsCategoriesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListOsCategoriesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListOsCategoriesParams instance, // as then you are sure you have configured all required params func (s *GuestOSService) NewListOsCategoriesParams() *ListOsCategoriesParams { p := &ListOsCategoriesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *GuestOSService) GetOsCategoryID(name string, opts ...OptionFunc) (string, int, error) { p := &ListOsCategoriesParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListOsCategories(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.OsCategories[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.OsCategories { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *GuestOSService) GetOsCategoryByName(name string, opts ...OptionFunc) (*OsCategory, int, error) { id, count, err := s.GetOsCategoryID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetOsCategoryByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *GuestOSService) GetOsCategoryByID(id string, opts ...OptionFunc) (*OsCategory, int, error) { p := &ListOsCategoriesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListOsCategories(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.OsCategories[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for OsCategory UUID: %s!", id) } // Lists all supported OS categories for this cloud. func (s *GuestOSService) ListOsCategories(p *ListOsCategoriesParams) (*ListOsCategoriesResponse, error) { resp, err := s.cs.newRequest("listOsCategories", p.toURLValues()) if err != nil { return nil, err } var r ListOsCategoriesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListOsCategoriesResponse struct { Count int `json:"count"` OsCategories []*OsCategory `json:"oscategory"` } type OsCategory struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` } type ListOsTypesParams struct { p map[string]interface{} } func (p *ListOsTypesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["oscategoryid"]; found { u.Set("oscategoryid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListOsTypesParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *ListOsTypesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListOsTypesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListOsTypesParams) SetOscategoryid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["oscategoryid"] = v return } func (p *ListOsTypesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListOsTypesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListOsTypesParams instance, // as then you are sure you have configured all required params func (s *GuestOSService) NewListOsTypesParams() *ListOsTypesParams { p := &ListOsTypesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *GuestOSService) GetOsTypeByID(id string, opts ...OptionFunc) (*OsType, int, error) { p := &ListOsTypesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListOsTypes(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.OsTypes[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for OsType UUID: %s!", id) } // Lists all supported OS types for this cloud. func (s *GuestOSService) ListOsTypes(p *ListOsTypesParams) (*ListOsTypesResponse, error) { resp, err := s.cs.newRequest("listOsTypes", p.toURLValues()) if err != nil { return nil, err } var r ListOsTypesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListOsTypesResponse struct { Count int `json:"count"` OsTypes []*OsType `json:"ostype"` } type OsType struct { Description string `json:"description"` Id string `json:"id"` Isuserdefined bool `json:"isuserdefined"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Oscategoryid string `json:"oscategoryid"` } type RemoveGuestOsParams struct { p map[string]interface{} } func (p *RemoveGuestOsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RemoveGuestOsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RemoveGuestOsParams instance, // as then you are sure you have configured all required params func (s *GuestOSService) NewRemoveGuestOsParams(id string) *RemoveGuestOsParams { p := &RemoveGuestOsParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Removes a Guest OS from listing. func (s *GuestOSService) RemoveGuestOs(p *RemoveGuestOsParams) (*RemoveGuestOsResponse, error) { resp, err := s.cs.newRequest("removeGuestOs", p.toURLValues()) if err != nil { return nil, err } var r RemoveGuestOsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RemoveGuestOsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type RemoveGuestOsMappingParams struct { p map[string]interface{} } func (p *RemoveGuestOsMappingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RemoveGuestOsMappingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RemoveGuestOsMappingParams instance, // as then you are sure you have configured all required params func (s *GuestOSService) NewRemoveGuestOsMappingParams(id string) *RemoveGuestOsMappingParams { p := &RemoveGuestOsMappingParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Removes a Guest OS Mapping. func (s *GuestOSService) RemoveGuestOsMapping(p *RemoveGuestOsMappingParams) (*RemoveGuestOsMappingResponse, error) { resp, err := s.cs.newRequest("removeGuestOsMapping", p.toURLValues()) if err != nil { return nil, err } var r RemoveGuestOsMappingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RemoveGuestOsMappingResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type UpdateGuestOsParams struct { p map[string]interface{} } func (p *UpdateGuestOsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].key", i), k) u.Set(fmt.Sprintf("details[%d].value", i), m[k]) } } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["osdisplayname"]; found { u.Set("osdisplayname", v.(string)) } return u } func (p *UpdateGuestOsParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *UpdateGuestOsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateGuestOsParams) SetOsdisplayname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["osdisplayname"] = v return } // You should always use this function to get a new UpdateGuestOsParams instance, // as then you are sure you have configured all required params func (s *GuestOSService) NewUpdateGuestOsParams(details map[string]string, id string, osdisplayname string) *UpdateGuestOsParams { p := &UpdateGuestOsParams{} p.p = make(map[string]interface{}) p.p["details"] = details p.p["id"] = id p.p["osdisplayname"] = osdisplayname return p } // Updates the information about Guest OS func (s *GuestOSService) UpdateGuestOs(p *UpdateGuestOsParams) (*UpdateGuestOsResponse, error) { resp, err := s.cs.newRequest("updateGuestOs", p.toURLValues()) if err != nil { return nil, err } var r UpdateGuestOsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateGuestOsResponse struct { Description string `json:"description"` Id string `json:"id"` Isuserdefined bool `json:"isuserdefined"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Oscategoryid string `json:"oscategoryid"` } type UpdateGuestOsMappingParams struct { p map[string]interface{} } func (p *UpdateGuestOsMappingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["osnameforhypervisor"]; found { u.Set("osnameforhypervisor", v.(string)) } return u } func (p *UpdateGuestOsMappingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateGuestOsMappingParams) SetOsnameforhypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["osnameforhypervisor"] = v return } // You should always use this function to get a new UpdateGuestOsMappingParams instance, // as then you are sure you have configured all required params func (s *GuestOSService) NewUpdateGuestOsMappingParams(id string, osnameforhypervisor string) *UpdateGuestOsMappingParams { p := &UpdateGuestOsMappingParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["osnameforhypervisor"] = osnameforhypervisor return p } // Updates the information about Guest OS to Hypervisor specific name mapping func (s *GuestOSService) UpdateGuestOsMapping(p *UpdateGuestOsMappingParams) (*UpdateGuestOsMappingResponse, error) { resp, err := s.cs.newRequest("updateGuestOsMapping", p.toURLValues()) if err != nil { return nil, err } var r UpdateGuestOsMappingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateGuestOsMappingResponse struct { Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Isuserdefined string `json:"isuserdefined"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Osdisplayname string `json:"osdisplayname"` Osnameforhypervisor string `json:"osnameforhypervisor"` Ostypeid string `json:"ostypeid"` } func (r *UpdateGuestOsMappingResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateGuestOsMappingResponse return json.Unmarshal(b, (*alias)(r)) } go-cloudstack-2.9.0/cloudstack/HostService.go000066400000000000000000002507201364073403100212110ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AddBaremetalHostParams struct { p map[string]interface{} } func (p *AddBaremetalHostParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["clustername"]; found { u.Set("clustername", v.(string)) } if v, found := p.p["hosttags"]; found { vv := strings.Join(v.([]string), ",") u.Set("hosttags", vv) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["ipaddress"]; found { u.Set("ipaddress", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *AddBaremetalHostParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *AddBaremetalHostParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *AddBaremetalHostParams) SetClustername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clustername"] = v return } func (p *AddBaremetalHostParams) SetHosttags(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hosttags"] = v return } func (p *AddBaremetalHostParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *AddBaremetalHostParams) SetIpaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddress"] = v return } func (p *AddBaremetalHostParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddBaremetalHostParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *AddBaremetalHostParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddBaremetalHostParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } func (p *AddBaremetalHostParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new AddBaremetalHostParams instance, // as then you are sure you have configured all required params func (s *HostService) NewAddBaremetalHostParams(hypervisor string, password string, podid string, url string, username string, zoneid string) *AddBaremetalHostParams { p := &AddBaremetalHostParams{} p.p = make(map[string]interface{}) p.p["hypervisor"] = hypervisor p.p["password"] = password p.p["podid"] = podid p.p["url"] = url p.p["username"] = username p.p["zoneid"] = zoneid return p } // add a baremetal host func (s *HostService) AddBaremetalHost(p *AddBaremetalHostParams) (*AddBaremetalHostResponse, error) { resp, err := s.cs.newRequest("addBaremetalHost", p.toURLValues()) if err != nil { return nil, err } var r AddBaremetalHostResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddBaremetalHostResponse struct { Annotation string `json:"annotation"` Averageload int64 `json:"averageload"` Capabilities string `json:"capabilities"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Clustertype string `json:"clustertype"` Cpuallocated string `json:"cpuallocated"` Cpunumber int `json:"cpunumber"` Cpusockets int `json:"cpusockets"` Cpuspeed int64 `json:"cpuspeed"` Cpuused string `json:"cpuused"` Cpuwithoverprovisioning string `json:"cpuwithoverprovisioning"` Created string `json:"created"` Details map[string]string `json:"details"` Disconnected string `json:"disconnected"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Events string `json:"events"` Gpugroup []AddBaremetalHostResponseGpugroup `json:"gpugroup"` Hahost bool `json:"hahost"` Hasenoughcapacity bool `json:"hasenoughcapacity"` Hostha string `json:"hostha"` Hosttags string `json:"hosttags"` Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Islocalstorageactive bool `json:"islocalstorageactive"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastannotated string `json:"lastannotated"` Lastpinged string `json:"lastpinged"` Managementserverid int64 `json:"managementserverid"` Memoryallocated int64 `json:"memoryallocated"` Memorytotal int64 `json:"memorytotal"` Memoryused int64 `json:"memoryused"` Memorywithoverprovisioning string `json:"memorywithoverprovisioning"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Oscategoryid string `json:"oscategoryid"` Oscategoryname string `json:"oscategoryname"` Outofbandmanagement OutOfBandManagementResponse `json:"outofbandmanagement"` Podid string `json:"podid"` Podname string `json:"podname"` Removed string `json:"removed"` Resourcestate string `json:"resourcestate"` State string `json:"state"` Suitableformigration bool `json:"suitableformigration"` Type string `json:"type"` Username string `json:"username"` Version string `json:"version"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type AddBaremetalHostResponseGpugroup struct { Gpugroupname string `json:"gpugroupname"` Vgpu []AddBaremetalHostResponseGpugroupVgpu `json:"vgpu"` } type AddBaremetalHostResponseGpugroupVgpu struct { Maxcapacity int64 `json:"maxcapacity"` Maxheads int64 `json:"maxheads"` Maxresolutionx int64 `json:"maxresolutionx"` Maxresolutiony int64 `json:"maxresolutiony"` Maxvgpuperpgpu int64 `json:"maxvgpuperpgpu"` Remainingcapacity int64 `json:"remainingcapacity"` Vgputype string `json:"vgputype"` Videoram int64 `json:"videoram"` } type AddGloboDnsHostParams struct { p map[string]interface{} } func (p *AddGloboDnsHostParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddGloboDnsHostParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddGloboDnsHostParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddGloboDnsHostParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddGloboDnsHostParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddGloboDnsHostParams instance, // as then you are sure you have configured all required params func (s *HostService) NewAddGloboDnsHostParams(password string, physicalnetworkid string, url string, username string) *AddGloboDnsHostParams { p := &AddGloboDnsHostParams{} p.p = make(map[string]interface{}) p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["url"] = url p.p["username"] = username return p } // Adds the GloboDNS external host func (s *HostService) AddGloboDnsHost(p *AddGloboDnsHostParams) (*AddGloboDnsHostResponse, error) { resp, err := s.cs.newRequest("addGloboDnsHost", p.toURLValues()) if err != nil { return nil, err } var r AddGloboDnsHostResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddGloboDnsHostResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type AddHostParams struct { p map[string]interface{} } func (p *AddHostParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["clustername"]; found { u.Set("clustername", v.(string)) } if v, found := p.p["hosttags"]; found { vv := strings.Join(v.([]string), ",") u.Set("hosttags", vv) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *AddHostParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *AddHostParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *AddHostParams) SetClustername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clustername"] = v return } func (p *AddHostParams) SetHosttags(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hosttags"] = v return } func (p *AddHostParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *AddHostParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddHostParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *AddHostParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddHostParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } func (p *AddHostParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new AddHostParams instance, // as then you are sure you have configured all required params func (s *HostService) NewAddHostParams(hypervisor string, password string, podid string, url string, username string, zoneid string) *AddHostParams { p := &AddHostParams{} p.p = make(map[string]interface{}) p.p["hypervisor"] = hypervisor p.p["password"] = password p.p["podid"] = podid p.p["url"] = url p.p["username"] = username p.p["zoneid"] = zoneid return p } // Adds a new host. func (s *HostService) AddHost(p *AddHostParams) (*AddHostResponse, error) { resp, err := s.cs.newRequest("addHost", p.toURLValues()) if err != nil { return nil, err } var r AddHostResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddHostResponse struct { Annotation string `json:"annotation"` Averageload int64 `json:"averageload"` Capabilities string `json:"capabilities"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Clustertype string `json:"clustertype"` Cpuallocated string `json:"cpuallocated"` Cpunumber int `json:"cpunumber"` Cpusockets int `json:"cpusockets"` Cpuspeed int64 `json:"cpuspeed"` Cpuused string `json:"cpuused"` Cpuwithoverprovisioning string `json:"cpuwithoverprovisioning"` Created string `json:"created"` Details map[string]string `json:"details"` Disconnected string `json:"disconnected"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Events string `json:"events"` Gpugroup []AddHostResponseGpugroup `json:"gpugroup"` Hahost bool `json:"hahost"` Hasenoughcapacity bool `json:"hasenoughcapacity"` Hostha string `json:"hostha"` Hosttags string `json:"hosttags"` Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Islocalstorageactive bool `json:"islocalstorageactive"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastannotated string `json:"lastannotated"` Lastpinged string `json:"lastpinged"` Managementserverid int64 `json:"managementserverid"` Memoryallocated int64 `json:"memoryallocated"` Memorytotal int64 `json:"memorytotal"` Memoryused int64 `json:"memoryused"` Memorywithoverprovisioning string `json:"memorywithoverprovisioning"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Oscategoryid string `json:"oscategoryid"` Oscategoryname string `json:"oscategoryname"` Outofbandmanagement OutOfBandManagementResponse `json:"outofbandmanagement"` Podid string `json:"podid"` Podname string `json:"podname"` Removed string `json:"removed"` Resourcestate string `json:"resourcestate"` State string `json:"state"` Suitableformigration bool `json:"suitableformigration"` Type string `json:"type"` Username string `json:"username"` Version string `json:"version"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type AddHostResponseGpugroup struct { Gpugroupname string `json:"gpugroupname"` Vgpu []AddHostResponseGpugroupVgpu `json:"vgpu"` } type AddHostResponseGpugroupVgpu struct { Maxcapacity int64 `json:"maxcapacity"` Maxheads int64 `json:"maxheads"` Maxresolutionx int64 `json:"maxresolutionx"` Maxresolutiony int64 `json:"maxresolutiony"` Maxvgpuperpgpu int64 `json:"maxvgpuperpgpu"` Remainingcapacity int64 `json:"remainingcapacity"` Vgputype string `json:"vgputype"` Videoram int64 `json:"videoram"` } type AddSecondaryStorageParams struct { p map[string]interface{} } func (p *AddSecondaryStorageParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *AddSecondaryStorageParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddSecondaryStorageParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new AddSecondaryStorageParams instance, // as then you are sure you have configured all required params func (s *HostService) NewAddSecondaryStorageParams(url string) *AddSecondaryStorageParams { p := &AddSecondaryStorageParams{} p.p = make(map[string]interface{}) p.p["url"] = url return p } // Adds secondary storage. func (s *HostService) AddSecondaryStorage(p *AddSecondaryStorageParams) (*AddSecondaryStorageResponse, error) { resp, err := s.cs.newRequest("addSecondaryStorage", p.toURLValues()) if err != nil { return nil, err } var r AddSecondaryStorageResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddSecondaryStorageResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Protocol string `json:"protocol"` Providername string `json:"providername"` Scope string `json:"scope"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type CancelHostMaintenanceParams struct { p map[string]interface{} } func (p *CancelHostMaintenanceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *CancelHostMaintenanceParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new CancelHostMaintenanceParams instance, // as then you are sure you have configured all required params func (s *HostService) NewCancelHostMaintenanceParams(id string) *CancelHostMaintenanceParams { p := &CancelHostMaintenanceParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Cancels host maintenance. func (s *HostService) CancelHostMaintenance(p *CancelHostMaintenanceParams) (*CancelHostMaintenanceResponse, error) { resp, err := s.cs.newRequest("cancelHostMaintenance", p.toURLValues()) if err != nil { return nil, err } var r CancelHostMaintenanceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CancelHostMaintenanceResponse struct { Annotation string `json:"annotation"` Averageload int64 `json:"averageload"` Capabilities string `json:"capabilities"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Clustertype string `json:"clustertype"` Cpuallocated string `json:"cpuallocated"` Cpunumber int `json:"cpunumber"` Cpusockets int `json:"cpusockets"` Cpuspeed int64 `json:"cpuspeed"` Cpuused string `json:"cpuused"` Cpuwithoverprovisioning string `json:"cpuwithoverprovisioning"` Created string `json:"created"` Details map[string]string `json:"details"` Disconnected string `json:"disconnected"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Events string `json:"events"` Gpugroup []CancelHostMaintenanceResponseGpugroup `json:"gpugroup"` Hahost bool `json:"hahost"` Hasenoughcapacity bool `json:"hasenoughcapacity"` Hostha string `json:"hostha"` Hosttags string `json:"hosttags"` Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Islocalstorageactive bool `json:"islocalstorageactive"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastannotated string `json:"lastannotated"` Lastpinged string `json:"lastpinged"` Managementserverid int64 `json:"managementserverid"` Memoryallocated int64 `json:"memoryallocated"` Memorytotal int64 `json:"memorytotal"` Memoryused int64 `json:"memoryused"` Memorywithoverprovisioning string `json:"memorywithoverprovisioning"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Oscategoryid string `json:"oscategoryid"` Oscategoryname string `json:"oscategoryname"` Outofbandmanagement OutOfBandManagementResponse `json:"outofbandmanagement"` Podid string `json:"podid"` Podname string `json:"podname"` Removed string `json:"removed"` Resourcestate string `json:"resourcestate"` State string `json:"state"` Suitableformigration bool `json:"suitableformigration"` Type string `json:"type"` Username string `json:"username"` Version string `json:"version"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type CancelHostMaintenanceResponseGpugroup struct { Gpugroupname string `json:"gpugroupname"` Vgpu []CancelHostMaintenanceResponseGpugroupVgpu `json:"vgpu"` } type CancelHostMaintenanceResponseGpugroupVgpu struct { Maxcapacity int64 `json:"maxcapacity"` Maxheads int64 `json:"maxheads"` Maxresolutionx int64 `json:"maxresolutionx"` Maxresolutiony int64 `json:"maxresolutiony"` Maxvgpuperpgpu int64 `json:"maxvgpuperpgpu"` Remainingcapacity int64 `json:"remainingcapacity"` Vgputype string `json:"vgputype"` Videoram int64 `json:"videoram"` } type DedicateHostParams struct { p map[string]interface{} } func (p *DedicateHostParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } return u } func (p *DedicateHostParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DedicateHostParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DedicateHostParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } // You should always use this function to get a new DedicateHostParams instance, // as then you are sure you have configured all required params func (s *HostService) NewDedicateHostParams(domainid string, hostid string) *DedicateHostParams { p := &DedicateHostParams{} p.p = make(map[string]interface{}) p.p["domainid"] = domainid p.p["hostid"] = hostid return p } // Dedicates a host. func (s *HostService) DedicateHost(p *DedicateHostParams) (*DedicateHostResponse, error) { resp, err := s.cs.newRequest("dedicateHost", p.toURLValues()) if err != nil { return nil, err } var r DedicateHostResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DedicateHostResponse struct { Accountid string `json:"accountid"` Affinitygroupid string `json:"affinitygroupid"` Domainid string `json:"domainid"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } type DeleteHostParams struct { p map[string]interface{} } func (p *DeleteHostParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["forced"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forced", vv) } if v, found := p.p["forcedestroylocalstorage"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forcedestroylocalstorage", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteHostParams) SetForced(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forced"] = v return } func (p *DeleteHostParams) SetForcedestroylocalstorage(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forcedestroylocalstorage"] = v return } func (p *DeleteHostParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteHostParams instance, // as then you are sure you have configured all required params func (s *HostService) NewDeleteHostParams(id string) *DeleteHostParams { p := &DeleteHostParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a host. func (s *HostService) DeleteHost(p *DeleteHostParams) (*DeleteHostResponse, error) { resp, err := s.cs.newRequest("deleteHost", p.toURLValues()) if err != nil { return nil, err } var r DeleteHostResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteHostResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteHostResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteHostResponse return json.Unmarshal(b, (*alias)(r)) } type DisableOutOfBandManagementForHostParams struct { p map[string]interface{} } func (p *DisableOutOfBandManagementForHostParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } return u } func (p *DisableOutOfBandManagementForHostParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } // You should always use this function to get a new DisableOutOfBandManagementForHostParams instance, // as then you are sure you have configured all required params func (s *HostService) NewDisableOutOfBandManagementForHostParams(hostid string) *DisableOutOfBandManagementForHostParams { p := &DisableOutOfBandManagementForHostParams{} p.p = make(map[string]interface{}) p.p["hostid"] = hostid return p } // Disables out-of-band management for a host func (s *HostService) DisableOutOfBandManagementForHost(p *DisableOutOfBandManagementForHostParams) (*DisableOutOfBandManagementForHostResponse, error) { resp, err := s.cs.newRequest("disableOutOfBandManagementForHost", p.toURLValues()) if err != nil { return nil, err } var r DisableOutOfBandManagementForHostResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DisableOutOfBandManagementForHostResponse struct { Action string `json:"action"` Address string `json:"address"` Description string `json:"description"` Driver string `json:"driver"` Enabled bool `json:"enabled"` Hostid string `json:"hostid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Password string `json:"password"` Port string `json:"port"` Powerstate string `json:"powerstate"` Status bool `json:"status"` Username string `json:"username"` } type EnableOutOfBandManagementForHostParams struct { p map[string]interface{} } func (p *EnableOutOfBandManagementForHostParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } return u } func (p *EnableOutOfBandManagementForHostParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } // You should always use this function to get a new EnableOutOfBandManagementForHostParams instance, // as then you are sure you have configured all required params func (s *HostService) NewEnableOutOfBandManagementForHostParams(hostid string) *EnableOutOfBandManagementForHostParams { p := &EnableOutOfBandManagementForHostParams{} p.p = make(map[string]interface{}) p.p["hostid"] = hostid return p } // Enables out-of-band management for a host func (s *HostService) EnableOutOfBandManagementForHost(p *EnableOutOfBandManagementForHostParams) (*EnableOutOfBandManagementForHostResponse, error) { resp, err := s.cs.newRequest("enableOutOfBandManagementForHost", p.toURLValues()) if err != nil { return nil, err } var r EnableOutOfBandManagementForHostResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type EnableOutOfBandManagementForHostResponse struct { Action string `json:"action"` Address string `json:"address"` Description string `json:"description"` Driver string `json:"driver"` Enabled bool `json:"enabled"` Hostid string `json:"hostid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Password string `json:"password"` Port string `json:"port"` Powerstate string `json:"powerstate"` Status bool `json:"status"` Username string `json:"username"` } type FindHostsForMigrationParams struct { p map[string]interface{} } func (p *FindHostsForMigrationParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *FindHostsForMigrationParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *FindHostsForMigrationParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *FindHostsForMigrationParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *FindHostsForMigrationParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new FindHostsForMigrationParams instance, // as then you are sure you have configured all required params func (s *HostService) NewFindHostsForMigrationParams(virtualmachineid string) *FindHostsForMigrationParams { p := &FindHostsForMigrationParams{} p.p = make(map[string]interface{}) p.p["virtualmachineid"] = virtualmachineid return p } // Find hosts suitable for migrating a virtual machine. func (s *HostService) FindHostsForMigration(p *FindHostsForMigrationParams) (*FindHostsForMigrationResponse, error) { resp, err := s.cs.newRequest("findHostsForMigration", p.toURLValues()) if err != nil { return nil, err } var r FindHostsForMigrationResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type FindHostsForMigrationResponse struct { Averageload int64 `json:"averageload"` Capabilities string `json:"capabilities"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Clustertype string `json:"clustertype"` Cpuallocated string `json:"cpuallocated"` Cpunumber int `json:"cpunumber"` Cpuspeed int64 `json:"cpuspeed"` Cpuused string `json:"cpuused"` Cpuwithoverprovisioning string `json:"cpuwithoverprovisioning"` Created string `json:"created"` Disconnected string `json:"disconnected"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Events string `json:"events"` Hahost bool `json:"hahost"` Hasenoughcapacity bool `json:"hasenoughcapacity"` Hosttags string `json:"hosttags"` Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Islocalstorageactive bool `json:"islocalstorageactive"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastpinged string `json:"lastpinged"` Managementserverid int64 `json:"managementserverid"` Memoryallocated string `json:"memoryallocated"` Memorytotal int64 `json:"memorytotal"` Memoryused int64 `json:"memoryused"` Memorywithoverprovisioning string `json:"memorywithoverprovisioning"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Oscategoryid string `json:"oscategoryid"` Oscategoryname string `json:"oscategoryname"` Podid string `json:"podid"` Podname string `json:"podname"` Removed string `json:"removed"` RequiresStorageMotion bool `json:"requiresStorageMotion"` Resourcestate string `json:"resourcestate"` State string `json:"state"` Suitableformigration bool `json:"suitableformigration"` Type string `json:"type"` Version string `json:"version"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListDedicatedHostsParams struct { p map[string]interface{} } func (p *ListDedicatedHostsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["affinitygroupid"]; found { u.Set("affinitygroupid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListDedicatedHostsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListDedicatedHostsParams) SetAffinitygroupid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["affinitygroupid"] = v return } func (p *ListDedicatedHostsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListDedicatedHostsParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *ListDedicatedHostsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListDedicatedHostsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListDedicatedHostsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListDedicatedHostsParams instance, // as then you are sure you have configured all required params func (s *HostService) NewListDedicatedHostsParams() *ListDedicatedHostsParams { p := &ListDedicatedHostsParams{} p.p = make(map[string]interface{}) return p } // Lists dedicated hosts. func (s *HostService) ListDedicatedHosts(p *ListDedicatedHostsParams) (*ListDedicatedHostsResponse, error) { resp, err := s.cs.newRequest("listDedicatedHosts", p.toURLValues()) if err != nil { return nil, err } var r ListDedicatedHostsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListDedicatedHostsResponse struct { Count int `json:"count"` DedicatedHosts []*DedicatedHost `json:"dedicatedhost"` } type DedicatedHost struct { Accountid string `json:"accountid"` Affinitygroupid string `json:"affinitygroupid"` Domainid string `json:"domainid"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } type ListHostTagsParams struct { p map[string]interface{} } func (p *ListHostTagsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListHostTagsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListHostTagsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListHostTagsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListHostTagsParams instance, // as then you are sure you have configured all required params func (s *HostService) NewListHostTagsParams() *ListHostTagsParams { p := &ListHostTagsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *HostService) GetHostTagID(keyword string, opts ...OptionFunc) (string, int, error) { p := &ListHostTagsParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListHostTags(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.HostTags[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.HostTags { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // Lists host tags func (s *HostService) ListHostTags(p *ListHostTagsParams) (*ListHostTagsResponse, error) { resp, err := s.cs.newRequest("listHostTags", p.toURLValues()) if err != nil { return nil, err } var r ListHostTagsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListHostTagsResponse struct { Count int `json:"count"` HostTags []*HostTag `json:"hosttag"` } type HostTag struct { Hostid int64 `json:"hostid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` } type ListHostsParams struct { p map[string]interface{} } func (p *ListHostsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["details"]; found { vv := strings.Join(v.([]string), ",") u.Set("details", vv) } if v, found := p.p["hahost"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("hahost", vv) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["outofbandmanagementenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("outofbandmanagementenabled", vv) } if v, found := p.p["outofbandmanagementpowerstate"]; found { u.Set("outofbandmanagementpowerstate", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["resourcestate"]; found { u.Set("resourcestate", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListHostsParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *ListHostsParams) SetDetails(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *ListHostsParams) SetHahost(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hahost"] = v return } func (p *ListHostsParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *ListHostsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListHostsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListHostsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListHostsParams) SetOutofbandmanagementenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["outofbandmanagementenabled"] = v return } func (p *ListHostsParams) SetOutofbandmanagementpowerstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["outofbandmanagementpowerstate"] = v return } func (p *ListHostsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListHostsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListHostsParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListHostsParams) SetResourcestate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcestate"] = v return } func (p *ListHostsParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListHostsParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } func (p *ListHostsParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } func (p *ListHostsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListHostsParams instance, // as then you are sure you have configured all required params func (s *HostService) NewListHostsParams() *ListHostsParams { p := &ListHostsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *HostService) GetHostID(name string, opts ...OptionFunc) (string, int, error) { p := &ListHostsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListHosts(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Hosts[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Hosts { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *HostService) GetHostByName(name string, opts ...OptionFunc) (*Host, int, error) { id, count, err := s.GetHostID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetHostByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *HostService) GetHostByID(id string, opts ...OptionFunc) (*Host, int, error) { p := &ListHostsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListHosts(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Hosts[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Host UUID: %s!", id) } // Lists hosts. func (s *HostService) ListHosts(p *ListHostsParams) (*ListHostsResponse, error) { resp, err := s.cs.newRequest("listHosts", p.toURLValues()) if err != nil { return nil, err } var r ListHostsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListHostsResponse struct { Count int `json:"count"` Hosts []*Host `json:"host"` } type Host struct { Annotation string `json:"annotation"` Averageload int64 `json:"averageload"` Capabilities string `json:"capabilities"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Clustertype string `json:"clustertype"` Cpuallocated string `json:"cpuallocated"` Cpunumber int `json:"cpunumber"` Cpusockets int `json:"cpusockets"` Cpuspeed int64 `json:"cpuspeed"` Cpuused string `json:"cpuused"` Cpuwithoverprovisioning string `json:"cpuwithoverprovisioning"` Created string `json:"created"` Details map[string]string `json:"details"` Disconnected string `json:"disconnected"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Events string `json:"events"` Gpugroup []HostGpugroup `json:"gpugroup"` Hahost bool `json:"hahost"` Hasenoughcapacity bool `json:"hasenoughcapacity"` Hostha string `json:"hostha"` Hosttags string `json:"hosttags"` Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Islocalstorageactive bool `json:"islocalstorageactive"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastannotated string `json:"lastannotated"` Lastpinged string `json:"lastpinged"` Managementserverid int64 `json:"managementserverid"` Memoryallocated int64 `json:"memoryallocated"` Memorytotal int64 `json:"memorytotal"` Memoryused int64 `json:"memoryused"` Memorywithoverprovisioning string `json:"memorywithoverprovisioning"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Oscategoryid string `json:"oscategoryid"` Oscategoryname string `json:"oscategoryname"` Outofbandmanagement OutOfBandManagementResponse `json:"outofbandmanagement"` Podid string `json:"podid"` Podname string `json:"podname"` Removed string `json:"removed"` Resourcestate string `json:"resourcestate"` State string `json:"state"` Suitableformigration bool `json:"suitableformigration"` Type string `json:"type"` Username string `json:"username"` Version string `json:"version"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type HostGpugroup struct { Gpugroupname string `json:"gpugroupname"` Vgpu []HostGpugroupVgpu `json:"vgpu"` } type HostGpugroupVgpu struct { Maxcapacity int64 `json:"maxcapacity"` Maxheads int64 `json:"maxheads"` Maxresolutionx int64 `json:"maxresolutionx"` Maxresolutiony int64 `json:"maxresolutiony"` Maxvgpuperpgpu int64 `json:"maxvgpuperpgpu"` Remainingcapacity int64 `json:"remainingcapacity"` Vgputype string `json:"vgputype"` Videoram int64 `json:"videoram"` } type PrepareHostForMaintenanceParams struct { p map[string]interface{} } func (p *PrepareHostForMaintenanceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *PrepareHostForMaintenanceParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new PrepareHostForMaintenanceParams instance, // as then you are sure you have configured all required params func (s *HostService) NewPrepareHostForMaintenanceParams(id string) *PrepareHostForMaintenanceParams { p := &PrepareHostForMaintenanceParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Prepares a host for maintenance. func (s *HostService) PrepareHostForMaintenance(p *PrepareHostForMaintenanceParams) (*PrepareHostForMaintenanceResponse, error) { resp, err := s.cs.newRequest("prepareHostForMaintenance", p.toURLValues()) if err != nil { return nil, err } var r PrepareHostForMaintenanceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type PrepareHostForMaintenanceResponse struct { Annotation string `json:"annotation"` Averageload int64 `json:"averageload"` Capabilities string `json:"capabilities"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Clustertype string `json:"clustertype"` Cpuallocated string `json:"cpuallocated"` Cpunumber int `json:"cpunumber"` Cpusockets int `json:"cpusockets"` Cpuspeed int64 `json:"cpuspeed"` Cpuused string `json:"cpuused"` Cpuwithoverprovisioning string `json:"cpuwithoverprovisioning"` Created string `json:"created"` Details map[string]string `json:"details"` Disconnected string `json:"disconnected"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Events string `json:"events"` Gpugroup []PrepareHostForMaintenanceResponseGpugroup `json:"gpugroup"` Hahost bool `json:"hahost"` Hasenoughcapacity bool `json:"hasenoughcapacity"` Hostha string `json:"hostha"` Hosttags string `json:"hosttags"` Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Islocalstorageactive bool `json:"islocalstorageactive"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastannotated string `json:"lastannotated"` Lastpinged string `json:"lastpinged"` Managementserverid int64 `json:"managementserverid"` Memoryallocated int64 `json:"memoryallocated"` Memorytotal int64 `json:"memorytotal"` Memoryused int64 `json:"memoryused"` Memorywithoverprovisioning string `json:"memorywithoverprovisioning"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Oscategoryid string `json:"oscategoryid"` Oscategoryname string `json:"oscategoryname"` Outofbandmanagement OutOfBandManagementResponse `json:"outofbandmanagement"` Podid string `json:"podid"` Podname string `json:"podname"` Removed string `json:"removed"` Resourcestate string `json:"resourcestate"` State string `json:"state"` Suitableformigration bool `json:"suitableformigration"` Type string `json:"type"` Username string `json:"username"` Version string `json:"version"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type PrepareHostForMaintenanceResponseGpugroup struct { Gpugroupname string `json:"gpugroupname"` Vgpu []PrepareHostForMaintenanceResponseGpugroupVgpu `json:"vgpu"` } type PrepareHostForMaintenanceResponseGpugroupVgpu struct { Maxcapacity int64 `json:"maxcapacity"` Maxheads int64 `json:"maxheads"` Maxresolutionx int64 `json:"maxresolutionx"` Maxresolutiony int64 `json:"maxresolutiony"` Maxvgpuperpgpu int64 `json:"maxvgpuperpgpu"` Remainingcapacity int64 `json:"remainingcapacity"` Vgputype string `json:"vgputype"` Videoram int64 `json:"videoram"` } type ReconnectHostParams struct { p map[string]interface{} } func (p *ReconnectHostParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ReconnectHostParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ReconnectHostParams instance, // as then you are sure you have configured all required params func (s *HostService) NewReconnectHostParams(id string) *ReconnectHostParams { p := &ReconnectHostParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Reconnects a host. func (s *HostService) ReconnectHost(p *ReconnectHostParams) (*ReconnectHostResponse, error) { resp, err := s.cs.newRequest("reconnectHost", p.toURLValues()) if err != nil { return nil, err } var r ReconnectHostResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ReconnectHostResponse struct { Annotation string `json:"annotation"` Averageload int64 `json:"averageload"` Capabilities string `json:"capabilities"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Clustertype string `json:"clustertype"` Cpuallocated string `json:"cpuallocated"` Cpunumber int `json:"cpunumber"` Cpusockets int `json:"cpusockets"` Cpuspeed int64 `json:"cpuspeed"` Cpuused string `json:"cpuused"` Cpuwithoverprovisioning string `json:"cpuwithoverprovisioning"` Created string `json:"created"` Details map[string]string `json:"details"` Disconnected string `json:"disconnected"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Events string `json:"events"` Gpugroup []ReconnectHostResponseGpugroup `json:"gpugroup"` Hahost bool `json:"hahost"` Hasenoughcapacity bool `json:"hasenoughcapacity"` Hostha string `json:"hostha"` Hosttags string `json:"hosttags"` Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Islocalstorageactive bool `json:"islocalstorageactive"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastannotated string `json:"lastannotated"` Lastpinged string `json:"lastpinged"` Managementserverid int64 `json:"managementserverid"` Memoryallocated int64 `json:"memoryallocated"` Memorytotal int64 `json:"memorytotal"` Memoryused int64 `json:"memoryused"` Memorywithoverprovisioning string `json:"memorywithoverprovisioning"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Oscategoryid string `json:"oscategoryid"` Oscategoryname string `json:"oscategoryname"` Outofbandmanagement OutOfBandManagementResponse `json:"outofbandmanagement"` Podid string `json:"podid"` Podname string `json:"podname"` Removed string `json:"removed"` Resourcestate string `json:"resourcestate"` State string `json:"state"` Suitableformigration bool `json:"suitableformigration"` Type string `json:"type"` Username string `json:"username"` Version string `json:"version"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ReconnectHostResponseGpugroup struct { Gpugroupname string `json:"gpugroupname"` Vgpu []ReconnectHostResponseGpugroupVgpu `json:"vgpu"` } type ReconnectHostResponseGpugroupVgpu struct { Maxcapacity int64 `json:"maxcapacity"` Maxheads int64 `json:"maxheads"` Maxresolutionx int64 `json:"maxresolutionx"` Maxresolutiony int64 `json:"maxresolutiony"` Maxvgpuperpgpu int64 `json:"maxvgpuperpgpu"` Remainingcapacity int64 `json:"remainingcapacity"` Vgputype string `json:"vgputype"` Videoram int64 `json:"videoram"` } type ReleaseDedicatedHostParams struct { p map[string]interface{} } func (p *ReleaseDedicatedHostParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } return u } func (p *ReleaseDedicatedHostParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } // You should always use this function to get a new ReleaseDedicatedHostParams instance, // as then you are sure you have configured all required params func (s *HostService) NewReleaseDedicatedHostParams(hostid string) *ReleaseDedicatedHostParams { p := &ReleaseDedicatedHostParams{} p.p = make(map[string]interface{}) p.p["hostid"] = hostid return p } // Release the dedication for host func (s *HostService) ReleaseDedicatedHost(p *ReleaseDedicatedHostParams) (*ReleaseDedicatedHostResponse, error) { resp, err := s.cs.newRequest("releaseDedicatedHost", p.toURLValues()) if err != nil { return nil, err } var r ReleaseDedicatedHostResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ReleaseDedicatedHostResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ReleaseHostReservationParams struct { p map[string]interface{} } func (p *ReleaseHostReservationParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ReleaseHostReservationParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ReleaseHostReservationParams instance, // as then you are sure you have configured all required params func (s *HostService) NewReleaseHostReservationParams(id string) *ReleaseHostReservationParams { p := &ReleaseHostReservationParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Releases host reservation. func (s *HostService) ReleaseHostReservation(p *ReleaseHostReservationParams) (*ReleaseHostReservationResponse, error) { resp, err := s.cs.newRequest("releaseHostReservation", p.toURLValues()) if err != nil { return nil, err } var r ReleaseHostReservationResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ReleaseHostReservationResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type UpdateHostParams struct { p map[string]interface{} } func (p *UpdateHostParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["annotation"]; found { u.Set("annotation", v.(string)) } if v, found := p.p["hosttags"]; found { vv := strings.Join(v.([]string), ",") u.Set("hosttags", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["oscategoryid"]; found { u.Set("oscategoryid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } return u } func (p *UpdateHostParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *UpdateHostParams) SetAnnotation(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["annotation"] = v return } func (p *UpdateHostParams) SetHosttags(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hosttags"] = v return } func (p *UpdateHostParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateHostParams) SetOscategoryid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["oscategoryid"] = v return } func (p *UpdateHostParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } // You should always use this function to get a new UpdateHostParams instance, // as then you are sure you have configured all required params func (s *HostService) NewUpdateHostParams(id string) *UpdateHostParams { p := &UpdateHostParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a host. func (s *HostService) UpdateHost(p *UpdateHostParams) (*UpdateHostResponse, error) { resp, err := s.cs.newRequest("updateHost", p.toURLValues()) if err != nil { return nil, err } var r UpdateHostResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateHostResponse struct { Annotation string `json:"annotation"` Averageload int64 `json:"averageload"` Capabilities string `json:"capabilities"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Clustertype string `json:"clustertype"` Cpuallocated string `json:"cpuallocated"` Cpunumber int `json:"cpunumber"` Cpusockets int `json:"cpusockets"` Cpuspeed int64 `json:"cpuspeed"` Cpuused string `json:"cpuused"` Cpuwithoverprovisioning string `json:"cpuwithoverprovisioning"` Created string `json:"created"` Details map[string]string `json:"details"` Disconnected string `json:"disconnected"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Events string `json:"events"` Gpugroup []UpdateHostResponseGpugroup `json:"gpugroup"` Hahost bool `json:"hahost"` Hasenoughcapacity bool `json:"hasenoughcapacity"` Hostha string `json:"hostha"` Hosttags string `json:"hosttags"` Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Islocalstorageactive bool `json:"islocalstorageactive"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastannotated string `json:"lastannotated"` Lastpinged string `json:"lastpinged"` Managementserverid int64 `json:"managementserverid"` Memoryallocated int64 `json:"memoryallocated"` Memorytotal int64 `json:"memorytotal"` Memoryused int64 `json:"memoryused"` Memorywithoverprovisioning string `json:"memorywithoverprovisioning"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Oscategoryid string `json:"oscategoryid"` Oscategoryname string `json:"oscategoryname"` Outofbandmanagement OutOfBandManagementResponse `json:"outofbandmanagement"` Podid string `json:"podid"` Podname string `json:"podname"` Removed string `json:"removed"` Resourcestate string `json:"resourcestate"` State string `json:"state"` Suitableformigration bool `json:"suitableformigration"` Type string `json:"type"` Username string `json:"username"` Version string `json:"version"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateHostResponseGpugroup struct { Gpugroupname string `json:"gpugroupname"` Vgpu []UpdateHostResponseGpugroupVgpu `json:"vgpu"` } type UpdateHostResponseGpugroupVgpu struct { Maxcapacity int64 `json:"maxcapacity"` Maxheads int64 `json:"maxheads"` Maxresolutionx int64 `json:"maxresolutionx"` Maxresolutiony int64 `json:"maxresolutiony"` Maxvgpuperpgpu int64 `json:"maxvgpuperpgpu"` Remainingcapacity int64 `json:"remainingcapacity"` Vgputype string `json:"vgputype"` Videoram int64 `json:"videoram"` } type UpdateHostPasswordParams struct { p map[string]interface{} } func (p *UpdateHostPasswordParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["update_passwd_on_host"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("update_passwd_on_host", vv) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *UpdateHostPasswordParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *UpdateHostPasswordParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *UpdateHostPasswordParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *UpdateHostPasswordParams) SetUpdate_passwd_on_host(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["update_passwd_on_host"] = v return } func (p *UpdateHostPasswordParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new UpdateHostPasswordParams instance, // as then you are sure you have configured all required params func (s *HostService) NewUpdateHostPasswordParams(password string, username string) *UpdateHostPasswordParams { p := &UpdateHostPasswordParams{} p.p = make(map[string]interface{}) p.p["password"] = password p.p["username"] = username return p } // Update password of a host/pool on management server. func (s *HostService) UpdateHostPassword(p *UpdateHostPasswordParams) (*UpdateHostPasswordResponse, error) { resp, err := s.cs.newRequest("updateHostPassword", p.toURLValues()) if err != nil { return nil, err } var r UpdateHostPasswordResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateHostPasswordResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *UpdateHostPasswordResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateHostPasswordResponse return json.Unmarshal(b, (*alias)(r)) } go-cloudstack-2.9.0/cloudstack/HypervisorService.go000066400000000000000000000202131364073403100224360ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type ListHypervisorCapabilitiesParams struct { p map[string]interface{} } func (p *ListHypervisorCapabilitiesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListHypervisorCapabilitiesParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *ListHypervisorCapabilitiesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListHypervisorCapabilitiesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListHypervisorCapabilitiesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListHypervisorCapabilitiesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListHypervisorCapabilitiesParams instance, // as then you are sure you have configured all required params func (s *HypervisorService) NewListHypervisorCapabilitiesParams() *ListHypervisorCapabilitiesParams { p := &ListHypervisorCapabilitiesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *HypervisorService) GetHypervisorCapabilityByID(id string, opts ...OptionFunc) (*HypervisorCapability, int, error) { p := &ListHypervisorCapabilitiesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListHypervisorCapabilities(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.HypervisorCapabilities[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for HypervisorCapability UUID: %s!", id) } // Lists all hypervisor capabilities. func (s *HypervisorService) ListHypervisorCapabilities(p *ListHypervisorCapabilitiesParams) (*ListHypervisorCapabilitiesResponse, error) { resp, err := s.cs.newRequest("listHypervisorCapabilities", p.toURLValues()) if err != nil { return nil, err } var r ListHypervisorCapabilitiesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListHypervisorCapabilitiesResponse struct { Count int `json:"count"` HypervisorCapabilities []*HypervisorCapability `json:"hypervisorcapability"` } type HypervisorCapability struct { Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxdatavolumeslimit int `json:"maxdatavolumeslimit"` Maxguestslimit int64 `json:"maxguestslimit"` Maxhostspercluster int `json:"maxhostspercluster"` Securitygroupenabled bool `json:"securitygroupenabled"` Storagemotionenabled bool `json:"storagemotionenabled"` } type ListHypervisorsParams struct { p map[string]interface{} } func (p *ListHypervisorsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListHypervisorsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListHypervisorsParams instance, // as then you are sure you have configured all required params func (s *HypervisorService) NewListHypervisorsParams() *ListHypervisorsParams { p := &ListHypervisorsParams{} p.p = make(map[string]interface{}) return p } // List hypervisors func (s *HypervisorService) ListHypervisors(p *ListHypervisorsParams) (*ListHypervisorsResponse, error) { resp, err := s.cs.newRequest("listHypervisors", p.toURLValues()) if err != nil { return nil, err } var r ListHypervisorsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListHypervisorsResponse struct { Count int `json:"count"` Hypervisors []*Hypervisor `json:"hypervisor"` } type Hypervisor struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` } type UpdateHypervisorCapabilitiesParams struct { p map[string]interface{} } func (p *UpdateHypervisorCapabilitiesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["maxguestslimit"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("maxguestslimit", vv) } if v, found := p.p["securitygroupenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("securitygroupenabled", vv) } return u } func (p *UpdateHypervisorCapabilitiesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateHypervisorCapabilitiesParams) SetMaxguestslimit(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxguestslimit"] = v return } func (p *UpdateHypervisorCapabilitiesParams) SetSecuritygroupenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupenabled"] = v return } // You should always use this function to get a new UpdateHypervisorCapabilitiesParams instance, // as then you are sure you have configured all required params func (s *HypervisorService) NewUpdateHypervisorCapabilitiesParams() *UpdateHypervisorCapabilitiesParams { p := &UpdateHypervisorCapabilitiesParams{} p.p = make(map[string]interface{}) return p } // Updates a hypervisor capabilities. func (s *HypervisorService) UpdateHypervisorCapabilities(p *UpdateHypervisorCapabilitiesParams) (*UpdateHypervisorCapabilitiesResponse, error) { resp, err := s.cs.newRequest("updateHypervisorCapabilities", p.toURLValues()) if err != nil { return nil, err } var r UpdateHypervisorCapabilitiesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateHypervisorCapabilitiesResponse struct { Hypervisor string `json:"hypervisor"` Hypervisorversion string `json:"hypervisorversion"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxdatavolumeslimit int `json:"maxdatavolumeslimit"` Maxguestslimit int64 `json:"maxguestslimit"` Maxhostspercluster int `json:"maxhostspercluster"` Securitygroupenabled bool `json:"securitygroupenabled"` Storagemotionenabled bool `json:"storagemotionenabled"` } go-cloudstack-2.9.0/cloudstack/ISOService.go000066400000000000000000001664411364073403100207340ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AttachIsoParams struct { p map[string]interface{} } func (p *AttachIsoParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *AttachIsoParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *AttachIsoParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new AttachIsoParams instance, // as then you are sure you have configured all required params func (s *ISOService) NewAttachIsoParams(id string, virtualmachineid string) *AttachIsoParams { p := &AttachIsoParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["virtualmachineid"] = virtualmachineid return p } // Attaches an ISO to a virtual machine. func (s *ISOService) AttachIso(p *AttachIsoParams) (*AttachIsoResponse, error) { resp, err := s.cs.newRequest("attachIso", p.toURLValues()) if err != nil { return nil, err } var r AttachIsoResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AttachIsoResponse struct { Account string `json:"account"` Affinitygroup []AttachIsoResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []AttachIsoResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type AttachIsoResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []AttachIsoResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []AttachIsoResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type AttachIsoResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type AttachIsoResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *AttachIsoResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias AttachIsoResponse return json.Unmarshal(b, (*alias)(r)) } type CopyIsoParams struct { p map[string]interface{} } func (p *CopyIsoParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["destzoneid"]; found { u.Set("destzoneid", v.(string)) } if v, found := p.p["destzoneids"]; found { vv := strings.Join(v.([]string), ",") u.Set("destzoneids", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["sourcezoneid"]; found { u.Set("sourcezoneid", v.(string)) } return u } func (p *CopyIsoParams) SetDestzoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["destzoneid"] = v return } func (p *CopyIsoParams) SetDestzoneids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["destzoneids"] = v return } func (p *CopyIsoParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *CopyIsoParams) SetSourcezoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sourcezoneid"] = v return } // You should always use this function to get a new CopyIsoParams instance, // as then you are sure you have configured all required params func (s *ISOService) NewCopyIsoParams(id string) *CopyIsoParams { p := &CopyIsoParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Copies an iso from one zone to another. func (s *ISOService) CopyIso(p *CopyIsoParams) (*CopyIsoResponse, error) { resp, err := s.cs.newRequest("copyIso", p.toURLValues()) if err != nil { return nil, err } var r CopyIsoResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CopyIsoResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Bits int `json:"bits"` Bootable bool `json:"bootable"` Checksum string `json:"checksum"` Childtemplates []interface{} `json:"childtemplates"` Created string `json:"created"` CrossZones bool `json:"crossZones"` Details map[string]string `json:"details"` Directdownload bool `json:"directdownload"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Format string `json:"format"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isextractable bool `json:"isextractable"` Isfeatured bool `json:"isfeatured"` Ispublic bool `json:"ispublic"` Isready bool `json:"isready"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Ostypeid string `json:"ostypeid"` Ostypename string `json:"ostypename"` Parenttemplateid string `json:"parenttemplateid"` Passwordenabled bool `json:"passwordenabled"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` Requireshvm bool `json:"requireshvm"` Size int64 `json:"size"` Sourcetemplateid string `json:"sourcetemplateid"` Sshkeyenabled bool `json:"sshkeyenabled"` Status string `json:"status"` Tags []Tags `json:"tags"` Templatetag string `json:"templatetag"` Templatetype string `json:"templatetype"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } func (r *CopyIsoResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias CopyIsoResponse return json.Unmarshal(b, (*alias)(r)) } type DeleteIsoParams struct { p map[string]interface{} } func (p *DeleteIsoParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *DeleteIsoParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *DeleteIsoParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new DeleteIsoParams instance, // as then you are sure you have configured all required params func (s *ISOService) NewDeleteIsoParams(id string) *DeleteIsoParams { p := &DeleteIsoParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes an ISO file. func (s *ISOService) DeleteIso(p *DeleteIsoParams) (*DeleteIsoResponse, error) { resp, err := s.cs.newRequest("deleteIso", p.toURLValues()) if err != nil { return nil, err } var r DeleteIsoResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteIsoResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DetachIsoParams struct { p map[string]interface{} } func (p *DetachIsoParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *DetachIsoParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new DetachIsoParams instance, // as then you are sure you have configured all required params func (s *ISOService) NewDetachIsoParams(virtualmachineid string) *DetachIsoParams { p := &DetachIsoParams{} p.p = make(map[string]interface{}) p.p["virtualmachineid"] = virtualmachineid return p } // Detaches any ISO file (if any) currently attached to a virtual machine. func (s *ISOService) DetachIso(p *DetachIsoParams) (*DetachIsoResponse, error) { resp, err := s.cs.newRequest("detachIso", p.toURLValues()) if err != nil { return nil, err } var r DetachIsoResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DetachIsoResponse struct { Account string `json:"account"` Affinitygroup []DetachIsoResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []DetachIsoResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DetachIsoResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []DetachIsoResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []DetachIsoResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type DetachIsoResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type DetachIsoResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *DetachIsoResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DetachIsoResponse return json.Unmarshal(b, (*alias)(r)) } type ExtractIsoParams struct { p map[string]interface{} } func (p *ExtractIsoParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["mode"]; found { u.Set("mode", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ExtractIsoParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ExtractIsoParams) SetMode(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["mode"] = v return } func (p *ExtractIsoParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *ExtractIsoParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ExtractIsoParams instance, // as then you are sure you have configured all required params func (s *ISOService) NewExtractIsoParams(id string, mode string) *ExtractIsoParams { p := &ExtractIsoParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["mode"] = mode return p } // Extracts an ISO func (s *ISOService) ExtractIso(p *ExtractIsoParams) (*ExtractIsoResponse, error) { resp, err := s.cs.newRequest("extractIso", p.toURLValues()) if err != nil { return nil, err } var r ExtractIsoResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ExtractIsoResponse struct { Accountid string `json:"accountid"` Created string `json:"created"` ExtractId string `json:"extractId"` ExtractMode string `json:"extractMode"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Resultstring string `json:"resultstring"` State string `json:"state"` Status string `json:"status"` Storagetype string `json:"storagetype"` Uploadpercentage int `json:"uploadpercentage"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListIsoPermissionsParams struct { p map[string]interface{} } func (p *ListIsoPermissionsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ListIsoPermissionsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ListIsoPermissionsParams instance, // as then you are sure you have configured all required params func (s *ISOService) NewListIsoPermissionsParams(id string) *ListIsoPermissionsParams { p := &ListIsoPermissionsParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ISOService) GetIsoPermissionByID(id string, opts ...OptionFunc) (*IsoPermission, int, error) { p := &ListIsoPermissionsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListIsoPermissions(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.IsoPermissions[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for IsoPermission UUID: %s!", id) } // List iso visibility and all accounts that have permissions to view this iso. func (s *ISOService) ListIsoPermissions(p *ListIsoPermissionsParams) (*ListIsoPermissionsResponse, error) { resp, err := s.cs.newRequest("listIsoPermissions", p.toURLValues()) if err != nil { return nil, err } var r ListIsoPermissionsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListIsoPermissionsResponse struct { Count int `json:"count"` IsoPermissions []*IsoPermission `json:"isopermission"` } type IsoPermission struct { Account []string `json:"account"` Domainid string `json:"domainid"` Id string `json:"id"` Ispublic bool `json:"ispublic"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Projectids []string `json:"projectids"` } type ListIsosParams struct { p map[string]interface{} } func (p *ListIsosParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["bootable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("bootable", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isofilter"]; found { u.Set("isofilter", v.(string)) } if v, found := p.p["ispublic"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("ispublic", vv) } if v, found := p.p["isready"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isready", vv) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["showremoved"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("showremoved", vv) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListIsosParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListIsosParams) SetBootable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bootable"] = v return } func (p *ListIsosParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListIsosParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *ListIsosParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListIsosParams) SetIsofilter(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isofilter"] = v return } func (p *ListIsosParams) SetIspublic(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ispublic"] = v return } func (p *ListIsosParams) SetIsready(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isready"] = v return } func (p *ListIsosParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListIsosParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListIsosParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListIsosParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListIsosParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListIsosParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListIsosParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListIsosParams) SetShowremoved(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["showremoved"] = v return } func (p *ListIsosParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListIsosParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListIsosParams instance, // as then you are sure you have configured all required params func (s *ISOService) NewListIsosParams() *ListIsosParams { p := &ListIsosParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ISOService) GetIsoID(name string, isofilter string, zoneid string, opts ...OptionFunc) (string, int, error) { p := &ListIsosParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["isofilter"] = isofilter p.p["zoneid"] = zoneid for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListIsos(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Isos[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Isos { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ISOService) GetIsoByName(name string, isofilter string, zoneid string, opts ...OptionFunc) (*Iso, int, error) { id, count, err := s.GetIsoID(name, isofilter, zoneid, opts...) if err != nil { return nil, count, err } r, count, err := s.GetIsoByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ISOService) GetIsoByID(id string, opts ...OptionFunc) (*Iso, int, error) { p := &ListIsosParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListIsos(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Isos[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Iso UUID: %s!", id) } // Lists all available ISO files. func (s *ISOService) ListIsos(p *ListIsosParams) (*ListIsosResponse, error) { resp, err := s.cs.newRequest("listIsos", p.toURLValues()) if err != nil { return nil, err } var r ListIsosResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListIsosResponse struct { Count int `json:"count"` Isos []*Iso `json:"iso"` } type Iso struct { Account string `json:"account"` Accountid string `json:"accountid"` Bits int `json:"bits"` Bootable bool `json:"bootable"` Checksum string `json:"checksum"` Childtemplates []interface{} `json:"childtemplates"` Created string `json:"created"` CrossZones bool `json:"crossZones"` Details map[string]string `json:"details"` Directdownload bool `json:"directdownload"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Format string `json:"format"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isextractable bool `json:"isextractable"` Isfeatured bool `json:"isfeatured"` Ispublic bool `json:"ispublic"` Isready bool `json:"isready"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Ostypeid string `json:"ostypeid"` Ostypename string `json:"ostypename"` Parenttemplateid string `json:"parenttemplateid"` Passwordenabled bool `json:"passwordenabled"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` Requireshvm bool `json:"requireshvm"` Size int64 `json:"size"` Sourcetemplateid string `json:"sourcetemplateid"` Sshkeyenabled bool `json:"sshkeyenabled"` Status string `json:"status"` Tags []Tags `json:"tags"` Templatetag string `json:"templatetag"` Templatetype string `json:"templatetype"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } func (r *Iso) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias Iso return json.Unmarshal(b, (*alias)(r)) } type RegisterIsoParams struct { p map[string]interface{} } func (p *RegisterIsoParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["bootable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("bootable", vv) } if v, found := p.p["checksum"]; found { u.Set("checksum", v.(string)) } if v, found := p.p["directdownload"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("directdownload", vv) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["imagestoreuuid"]; found { u.Set("imagestoreuuid", v.(string)) } if v, found := p.p["isdynamicallyscalable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isdynamicallyscalable", vv) } if v, found := p.p["isextractable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isextractable", vv) } if v, found := p.p["isfeatured"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isfeatured", vv) } if v, found := p.p["ispublic"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("ispublic", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["ostypeid"]; found { u.Set("ostypeid", v.(string)) } if v, found := p.p["passwordenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("passwordenabled", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *RegisterIsoParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *RegisterIsoParams) SetBootable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bootable"] = v return } func (p *RegisterIsoParams) SetChecksum(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["checksum"] = v return } func (p *RegisterIsoParams) SetDirectdownload(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["directdownload"] = v return } func (p *RegisterIsoParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *RegisterIsoParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *RegisterIsoParams) SetImagestoreuuid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["imagestoreuuid"] = v return } func (p *RegisterIsoParams) SetIsdynamicallyscalable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isdynamicallyscalable"] = v return } func (p *RegisterIsoParams) SetIsextractable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isextractable"] = v return } func (p *RegisterIsoParams) SetIsfeatured(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isfeatured"] = v return } func (p *RegisterIsoParams) SetIspublic(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ispublic"] = v return } func (p *RegisterIsoParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *RegisterIsoParams) SetOstypeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ostypeid"] = v return } func (p *RegisterIsoParams) SetPasswordenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["passwordenabled"] = v return } func (p *RegisterIsoParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *RegisterIsoParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *RegisterIsoParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new RegisterIsoParams instance, // as then you are sure you have configured all required params func (s *ISOService) NewRegisterIsoParams(displaytext string, name string, url string, zoneid string) *RegisterIsoParams { p := &RegisterIsoParams{} p.p = make(map[string]interface{}) p.p["displaytext"] = displaytext p.p["name"] = name p.p["url"] = url p.p["zoneid"] = zoneid return p } // Registers an existing ISO into the CloudStack Cloud. func (s *ISOService) RegisterIso(p *RegisterIsoParams) (*RegisterIsoResponse, error) { resp, err := s.cs.newRequest("registerIso", p.toURLValues()) if err != nil { return nil, err } var r RegisterIsoResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type RegisterIsoResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Bits int `json:"bits"` Bootable bool `json:"bootable"` Checksum string `json:"checksum"` Childtemplates []interface{} `json:"childtemplates"` Created string `json:"created"` CrossZones bool `json:"crossZones"` Details map[string]string `json:"details"` Directdownload bool `json:"directdownload"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Format string `json:"format"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isextractable bool `json:"isextractable"` Isfeatured bool `json:"isfeatured"` Ispublic bool `json:"ispublic"` Isready bool `json:"isready"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Ostypeid string `json:"ostypeid"` Ostypename string `json:"ostypename"` Parenttemplateid string `json:"parenttemplateid"` Passwordenabled bool `json:"passwordenabled"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` Requireshvm bool `json:"requireshvm"` Size int64 `json:"size"` Sourcetemplateid string `json:"sourcetemplateid"` Sshkeyenabled bool `json:"sshkeyenabled"` Status string `json:"status"` Tags []Tags `json:"tags"` Templatetag string `json:"templatetag"` Templatetype string `json:"templatetype"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } func (r *RegisterIsoResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias RegisterIsoResponse return json.Unmarshal(b, (*alias)(r)) } type UpdateIsoParams struct { p map[string]interface{} } func (p *UpdateIsoParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["bootable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("bootable", vv) } if v, found := p.p["cleanupdetails"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("cleanupdetails", vv) } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["format"]; found { u.Set("format", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isdynamicallyscalable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isdynamicallyscalable", vv) } if v, found := p.p["isrouting"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrouting", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["ostypeid"]; found { u.Set("ostypeid", v.(string)) } if v, found := p.p["passwordenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("passwordenabled", vv) } if v, found := p.p["requireshvm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("requireshvm", vv) } if v, found := p.p["sortkey"]; found { vv := strconv.Itoa(v.(int)) u.Set("sortkey", vv) } if v, found := p.p["sshkeyenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("sshkeyenabled", vv) } return u } func (p *UpdateIsoParams) SetBootable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bootable"] = v return } func (p *UpdateIsoParams) SetCleanupdetails(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cleanupdetails"] = v return } func (p *UpdateIsoParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *UpdateIsoParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *UpdateIsoParams) SetFormat(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["format"] = v return } func (p *UpdateIsoParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateIsoParams) SetIsdynamicallyscalable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isdynamicallyscalable"] = v return } func (p *UpdateIsoParams) SetIsrouting(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrouting"] = v return } func (p *UpdateIsoParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateIsoParams) SetOstypeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ostypeid"] = v return } func (p *UpdateIsoParams) SetPasswordenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["passwordenabled"] = v return } func (p *UpdateIsoParams) SetRequireshvm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["requireshvm"] = v return } func (p *UpdateIsoParams) SetSortkey(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sortkey"] = v return } func (p *UpdateIsoParams) SetSshkeyenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sshkeyenabled"] = v return } // You should always use this function to get a new UpdateIsoParams instance, // as then you are sure you have configured all required params func (s *ISOService) NewUpdateIsoParams(id string) *UpdateIsoParams { p := &UpdateIsoParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates an ISO file. func (s *ISOService) UpdateIso(p *UpdateIsoParams) (*UpdateIsoResponse, error) { resp, err := s.cs.newRequest("updateIso", p.toURLValues()) if err != nil { return nil, err } var r UpdateIsoResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateIsoResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Bits int `json:"bits"` Bootable bool `json:"bootable"` Checksum string `json:"checksum"` Childtemplates []interface{} `json:"childtemplates"` Created string `json:"created"` CrossZones bool `json:"crossZones"` Details map[string]string `json:"details"` Directdownload bool `json:"directdownload"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Format string `json:"format"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isextractable bool `json:"isextractable"` Isfeatured bool `json:"isfeatured"` Ispublic bool `json:"ispublic"` Isready bool `json:"isready"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Ostypeid string `json:"ostypeid"` Ostypename string `json:"ostypename"` Parenttemplateid string `json:"parenttemplateid"` Passwordenabled bool `json:"passwordenabled"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` Requireshvm bool `json:"requireshvm"` Size int64 `json:"size"` Sourcetemplateid string `json:"sourcetemplateid"` Sshkeyenabled bool `json:"sshkeyenabled"` Status string `json:"status"` Tags []Tags `json:"tags"` Templatetag string `json:"templatetag"` Templatetype string `json:"templatetype"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } func (r *UpdateIsoResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateIsoResponse return json.Unmarshal(b, (*alias)(r)) } type UpdateIsoPermissionsParams struct { p map[string]interface{} } func (p *UpdateIsoPermissionsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["accounts"]; found { vv := strings.Join(v.([]string), ",") u.Set("accounts", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isextractable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isextractable", vv) } if v, found := p.p["isfeatured"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isfeatured", vv) } if v, found := p.p["ispublic"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("ispublic", vv) } if v, found := p.p["op"]; found { u.Set("op", v.(string)) } if v, found := p.p["projectids"]; found { vv := strings.Join(v.([]string), ",") u.Set("projectids", vv) } return u } func (p *UpdateIsoPermissionsParams) SetAccounts(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accounts"] = v return } func (p *UpdateIsoPermissionsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateIsoPermissionsParams) SetIsextractable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isextractable"] = v return } func (p *UpdateIsoPermissionsParams) SetIsfeatured(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isfeatured"] = v return } func (p *UpdateIsoPermissionsParams) SetIspublic(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ispublic"] = v return } func (p *UpdateIsoPermissionsParams) SetOp(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["op"] = v return } func (p *UpdateIsoPermissionsParams) SetProjectids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectids"] = v return } // You should always use this function to get a new UpdateIsoPermissionsParams instance, // as then you are sure you have configured all required params func (s *ISOService) NewUpdateIsoPermissionsParams(id string) *UpdateIsoPermissionsParams { p := &UpdateIsoPermissionsParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates ISO permissions func (s *ISOService) UpdateIsoPermissions(p *UpdateIsoPermissionsParams) (*UpdateIsoPermissionsResponse, error) { resp, err := s.cs.newRequest("updateIsoPermissions", p.toURLValues()) if err != nil { return nil, err } var r UpdateIsoPermissionsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateIsoPermissionsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *UpdateIsoPermissionsResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateIsoPermissionsResponse return json.Unmarshal(b, (*alias)(r)) } go-cloudstack-2.9.0/cloudstack/ImageStoreService.go000066400000000000000000000656471364073403100223470ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AddImageStoreParams struct { p map[string]interface{} } func (p *AddImageStoreParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].key", i), k) u.Set(fmt.Sprintf("details[%d].value", i), m[k]) } } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["provider"]; found { u.Set("provider", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *AddImageStoreParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *AddImageStoreParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *AddImageStoreParams) SetProvider(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["provider"] = v return } func (p *AddImageStoreParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddImageStoreParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new AddImageStoreParams instance, // as then you are sure you have configured all required params func (s *ImageStoreService) NewAddImageStoreParams(provider string) *AddImageStoreParams { p := &AddImageStoreParams{} p.p = make(map[string]interface{}) p.p["provider"] = provider return p } // Adds backup image store. func (s *ImageStoreService) AddImageStore(p *AddImageStoreParams) (*AddImageStoreResponse, error) { resp, err := s.cs.newRequest("addImageStore", p.toURLValues()) if err != nil { return nil, err } var r AddImageStoreResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddImageStoreResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Protocol string `json:"protocol"` Providername string `json:"providername"` Scope string `json:"scope"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type AddImageStoreS3Params struct { p map[string]interface{} } func (p *AddImageStoreS3Params) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["accesskey"]; found { u.Set("accesskey", v.(string)) } if v, found := p.p["bucket"]; found { u.Set("bucket", v.(string)) } if v, found := p.p["connectiontimeout"]; found { vv := strconv.Itoa(v.(int)) u.Set("connectiontimeout", vv) } if v, found := p.p["connectionttl"]; found { vv := strconv.Itoa(v.(int)) u.Set("connectionttl", vv) } if v, found := p.p["endpoint"]; found { u.Set("endpoint", v.(string)) } if v, found := p.p["maxerrorretry"]; found { vv := strconv.Itoa(v.(int)) u.Set("maxerrorretry", vv) } if v, found := p.p["s3signer"]; found { u.Set("s3signer", v.(string)) } if v, found := p.p["secretkey"]; found { u.Set("secretkey", v.(string)) } if v, found := p.p["sockettimeout"]; found { vv := strconv.Itoa(v.(int)) u.Set("sockettimeout", vv) } if v, found := p.p["usehttps"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("usehttps", vv) } if v, found := p.p["usetcpkeepalive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("usetcpkeepalive", vv) } return u } func (p *AddImageStoreS3Params) SetAccesskey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accesskey"] = v return } func (p *AddImageStoreS3Params) SetBucket(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bucket"] = v return } func (p *AddImageStoreS3Params) SetConnectiontimeout(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["connectiontimeout"] = v return } func (p *AddImageStoreS3Params) SetConnectionttl(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["connectionttl"] = v return } func (p *AddImageStoreS3Params) SetEndpoint(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endpoint"] = v return } func (p *AddImageStoreS3Params) SetMaxerrorretry(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxerrorretry"] = v return } func (p *AddImageStoreS3Params) SetS3signer(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["s3signer"] = v return } func (p *AddImageStoreS3Params) SetSecretkey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["secretkey"] = v return } func (p *AddImageStoreS3Params) SetSockettimeout(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sockettimeout"] = v return } func (p *AddImageStoreS3Params) SetUsehttps(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["usehttps"] = v return } func (p *AddImageStoreS3Params) SetUsetcpkeepalive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["usetcpkeepalive"] = v return } // You should always use this function to get a new AddImageStoreS3Params instance, // as then you are sure you have configured all required params func (s *ImageStoreService) NewAddImageStoreS3Params(accesskey string, bucket string, endpoint string, secretkey string) *AddImageStoreS3Params { p := &AddImageStoreS3Params{} p.p = make(map[string]interface{}) p.p["accesskey"] = accesskey p.p["bucket"] = bucket p.p["endpoint"] = endpoint p.p["secretkey"] = secretkey return p } // Adds S3 Image Store func (s *ImageStoreService) AddImageStoreS3(p *AddImageStoreS3Params) (*AddImageStoreS3Response, error) { resp, err := s.cs.newRequest("addImageStoreS3", p.toURLValues()) if err != nil { return nil, err } var r AddImageStoreS3Response if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddImageStoreS3Response struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Protocol string `json:"protocol"` Providername string `json:"providername"` Scope string `json:"scope"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type CreateSecondaryStagingStoreParams struct { p map[string]interface{} } func (p *CreateSecondaryStagingStoreParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].key", i), k) u.Set(fmt.Sprintf("details[%d].value", i), m[k]) } } if v, found := p.p["provider"]; found { u.Set("provider", v.(string)) } if v, found := p.p["scope"]; found { u.Set("scope", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreateSecondaryStagingStoreParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *CreateSecondaryStagingStoreParams) SetProvider(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["provider"] = v return } func (p *CreateSecondaryStagingStoreParams) SetScope(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["scope"] = v return } func (p *CreateSecondaryStagingStoreParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *CreateSecondaryStagingStoreParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreateSecondaryStagingStoreParams instance, // as then you are sure you have configured all required params func (s *ImageStoreService) NewCreateSecondaryStagingStoreParams(url string) *CreateSecondaryStagingStoreParams { p := &CreateSecondaryStagingStoreParams{} p.p = make(map[string]interface{}) p.p["url"] = url return p } // create secondary staging store. func (s *ImageStoreService) CreateSecondaryStagingStore(p *CreateSecondaryStagingStoreParams) (*CreateSecondaryStagingStoreResponse, error) { resp, err := s.cs.newRequest("createSecondaryStagingStore", p.toURLValues()) if err != nil { return nil, err } var r CreateSecondaryStagingStoreResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateSecondaryStagingStoreResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Protocol string `json:"protocol"` Providername string `json:"providername"` Scope string `json:"scope"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DeleteImageStoreParams struct { p map[string]interface{} } func (p *DeleteImageStoreParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteImageStoreParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteImageStoreParams instance, // as then you are sure you have configured all required params func (s *ImageStoreService) NewDeleteImageStoreParams(id string) *DeleteImageStoreParams { p := &DeleteImageStoreParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes an image store or Secondary Storage. func (s *ImageStoreService) DeleteImageStore(p *DeleteImageStoreParams) (*DeleteImageStoreResponse, error) { resp, err := s.cs.newRequest("deleteImageStore", p.toURLValues()) if err != nil { return nil, err } var r DeleteImageStoreResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteImageStoreResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteImageStoreResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteImageStoreResponse return json.Unmarshal(b, (*alias)(r)) } type DeleteSecondaryStagingStoreParams struct { p map[string]interface{} } func (p *DeleteSecondaryStagingStoreParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteSecondaryStagingStoreParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteSecondaryStagingStoreParams instance, // as then you are sure you have configured all required params func (s *ImageStoreService) NewDeleteSecondaryStagingStoreParams(id string) *DeleteSecondaryStagingStoreParams { p := &DeleteSecondaryStagingStoreParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a secondary staging store . func (s *ImageStoreService) DeleteSecondaryStagingStore(p *DeleteSecondaryStagingStoreParams) (*DeleteSecondaryStagingStoreResponse, error) { resp, err := s.cs.newRequest("deleteSecondaryStagingStore", p.toURLValues()) if err != nil { return nil, err } var r DeleteSecondaryStagingStoreResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteSecondaryStagingStoreResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteSecondaryStagingStoreResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteSecondaryStagingStoreResponse return json.Unmarshal(b, (*alias)(r)) } type ListImageStoresParams struct { p map[string]interface{} } func (p *ListImageStoresParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["provider"]; found { u.Set("provider", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListImageStoresParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListImageStoresParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListImageStoresParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListImageStoresParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListImageStoresParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListImageStoresParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *ListImageStoresParams) SetProvider(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["provider"] = v return } func (p *ListImageStoresParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListImageStoresParams instance, // as then you are sure you have configured all required params func (s *ImageStoreService) NewListImageStoresParams() *ListImageStoresParams { p := &ListImageStoresParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ImageStoreService) GetImageStoreID(name string, opts ...OptionFunc) (string, int, error) { p := &ListImageStoresParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListImageStores(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.ImageStores[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.ImageStores { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ImageStoreService) GetImageStoreByName(name string, opts ...OptionFunc) (*ImageStore, int, error) { id, count, err := s.GetImageStoreID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetImageStoreByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ImageStoreService) GetImageStoreByID(id string, opts ...OptionFunc) (*ImageStore, int, error) { p := &ListImageStoresParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListImageStores(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.ImageStores[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for ImageStore UUID: %s!", id) } // Lists image stores. func (s *ImageStoreService) ListImageStores(p *ListImageStoresParams) (*ListImageStoresResponse, error) { resp, err := s.cs.newRequest("listImageStores", p.toURLValues()) if err != nil { return nil, err } var r ListImageStoresResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListImageStoresResponse struct { Count int `json:"count"` ImageStores []*ImageStore `json:"imagestore"` } type ImageStore struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Protocol string `json:"protocol"` Providername string `json:"providername"` Scope string `json:"scope"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListSecondaryStagingStoresParams struct { p map[string]interface{} } func (p *ListSecondaryStagingStoresParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["provider"]; found { u.Set("provider", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListSecondaryStagingStoresParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListSecondaryStagingStoresParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListSecondaryStagingStoresParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListSecondaryStagingStoresParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListSecondaryStagingStoresParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListSecondaryStagingStoresParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *ListSecondaryStagingStoresParams) SetProvider(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["provider"] = v return } func (p *ListSecondaryStagingStoresParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListSecondaryStagingStoresParams instance, // as then you are sure you have configured all required params func (s *ImageStoreService) NewListSecondaryStagingStoresParams() *ListSecondaryStagingStoresParams { p := &ListSecondaryStagingStoresParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ImageStoreService) GetSecondaryStagingStoreID(name string, opts ...OptionFunc) (string, int, error) { p := &ListSecondaryStagingStoresParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListSecondaryStagingStores(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.SecondaryStagingStores[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.SecondaryStagingStores { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ImageStoreService) GetSecondaryStagingStoreByName(name string, opts ...OptionFunc) (*SecondaryStagingStore, int, error) { id, count, err := s.GetSecondaryStagingStoreID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetSecondaryStagingStoreByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ImageStoreService) GetSecondaryStagingStoreByID(id string, opts ...OptionFunc) (*SecondaryStagingStore, int, error) { p := &ListSecondaryStagingStoresParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListSecondaryStagingStores(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.SecondaryStagingStores[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for SecondaryStagingStore UUID: %s!", id) } // Lists secondary staging stores. func (s *ImageStoreService) ListSecondaryStagingStores(p *ListSecondaryStagingStoresParams) (*ListSecondaryStagingStoresResponse, error) { resp, err := s.cs.newRequest("listSecondaryStagingStores", p.toURLValues()) if err != nil { return nil, err } var r ListSecondaryStagingStoresResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListSecondaryStagingStoresResponse struct { Count int `json:"count"` SecondaryStagingStores []*SecondaryStagingStore `json:"secondarystagingstore"` } type SecondaryStagingStore struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Protocol string `json:"protocol"` Providername string `json:"providername"` Scope string `json:"scope"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateCloudToUseObjectStoreParams struct { p map[string]interface{} } func (p *UpdateCloudToUseObjectStoreParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].key", i), k) u.Set(fmt.Sprintf("details[%d].value", i), m[k]) } } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["provider"]; found { u.Set("provider", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } return u } func (p *UpdateCloudToUseObjectStoreParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *UpdateCloudToUseObjectStoreParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateCloudToUseObjectStoreParams) SetProvider(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["provider"] = v return } func (p *UpdateCloudToUseObjectStoreParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } // You should always use this function to get a new UpdateCloudToUseObjectStoreParams instance, // as then you are sure you have configured all required params func (s *ImageStoreService) NewUpdateCloudToUseObjectStoreParams(provider string) *UpdateCloudToUseObjectStoreParams { p := &UpdateCloudToUseObjectStoreParams{} p.p = make(map[string]interface{}) p.p["provider"] = provider return p } // Migrate current NFS secondary storages to use object store. func (s *ImageStoreService) UpdateCloudToUseObjectStore(p *UpdateCloudToUseObjectStoreParams) (*UpdateCloudToUseObjectStoreResponse, error) { resp, err := s.cs.newRequest("updateCloudToUseObjectStore", p.toURLValues()) if err != nil { return nil, err } var r UpdateCloudToUseObjectStoreResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateCloudToUseObjectStoreResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Protocol string `json:"protocol"` Providername string `json:"providername"` Scope string `json:"scope"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/InternalLBService.go000066400000000000000000000644511364073403100222720ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type ConfigureInternalLoadBalancerElementParams struct { p map[string]interface{} } func (p *ConfigureInternalLoadBalancerElementParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["enabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("enabled", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ConfigureInternalLoadBalancerElementParams) SetEnabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enabled"] = v return } func (p *ConfigureInternalLoadBalancerElementParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ConfigureInternalLoadBalancerElementParams instance, // as then you are sure you have configured all required params func (s *InternalLBService) NewConfigureInternalLoadBalancerElementParams(enabled bool, id string) *ConfigureInternalLoadBalancerElementParams { p := &ConfigureInternalLoadBalancerElementParams{} p.p = make(map[string]interface{}) p.p["enabled"] = enabled p.p["id"] = id return p } // Configures an Internal Load Balancer element. func (s *InternalLBService) ConfigureInternalLoadBalancerElement(p *ConfigureInternalLoadBalancerElementParams) (*InternalLoadBalancerElementResponse, error) { resp, err := s.cs.newRequest("configureInternalLoadBalancerElement", p.toURLValues()) if err != nil { return nil, err } var r InternalLoadBalancerElementResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type InternalLoadBalancerElementResponse struct { Enabled bool `json:"enabled"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nspid string `json:"nspid"` } type CreateInternalLoadBalancerElementParams struct { p map[string]interface{} } func (p *CreateInternalLoadBalancerElementParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["nspid"]; found { u.Set("nspid", v.(string)) } return u } func (p *CreateInternalLoadBalancerElementParams) SetNspid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nspid"] = v return } // You should always use this function to get a new CreateInternalLoadBalancerElementParams instance, // as then you are sure you have configured all required params func (s *InternalLBService) NewCreateInternalLoadBalancerElementParams(nspid string) *CreateInternalLoadBalancerElementParams { p := &CreateInternalLoadBalancerElementParams{} p.p = make(map[string]interface{}) p.p["nspid"] = nspid return p } // Create an Internal Load Balancer element. func (s *InternalLBService) CreateInternalLoadBalancerElement(p *CreateInternalLoadBalancerElementParams) (*CreateInternalLoadBalancerElementResponse, error) { resp, err := s.cs.newRequest("createInternalLoadBalancerElement", p.toURLValues()) if err != nil { return nil, err } var r CreateInternalLoadBalancerElementResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateInternalLoadBalancerElementResponse struct { Enabled bool `json:"enabled"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nspid string `json:"nspid"` } type ListInternalLoadBalancerElementsParams struct { p map[string]interface{} } func (p *ListInternalLoadBalancerElementsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["enabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("enabled", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["nspid"]; found { u.Set("nspid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListInternalLoadBalancerElementsParams) SetEnabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enabled"] = v return } func (p *ListInternalLoadBalancerElementsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListInternalLoadBalancerElementsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListInternalLoadBalancerElementsParams) SetNspid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nspid"] = v return } func (p *ListInternalLoadBalancerElementsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListInternalLoadBalancerElementsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListInternalLoadBalancerElementsParams instance, // as then you are sure you have configured all required params func (s *InternalLBService) NewListInternalLoadBalancerElementsParams() *ListInternalLoadBalancerElementsParams { p := &ListInternalLoadBalancerElementsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *InternalLBService) GetInternalLoadBalancerElementByID(id string, opts ...OptionFunc) (*InternalLoadBalancerElement, int, error) { p := &ListInternalLoadBalancerElementsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListInternalLoadBalancerElements(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.InternalLoadBalancerElements[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for InternalLoadBalancerElement UUID: %s!", id) } // Lists all available Internal Load Balancer elements. func (s *InternalLBService) ListInternalLoadBalancerElements(p *ListInternalLoadBalancerElementsParams) (*ListInternalLoadBalancerElementsResponse, error) { resp, err := s.cs.newRequest("listInternalLoadBalancerElements", p.toURLValues()) if err != nil { return nil, err } var r ListInternalLoadBalancerElementsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListInternalLoadBalancerElementsResponse struct { Count int `json:"count"` InternalLoadBalancerElements []*InternalLoadBalancerElement `json:"internalloadbalancerelement"` } type InternalLoadBalancerElement struct { Enabled bool `json:"enabled"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nspid string `json:"nspid"` } type ListInternalLoadBalancerVMsParams struct { p map[string]interface{} } func (p *ListInternalLoadBalancerVMsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["forvpc"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forvpc", vv) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListInternalLoadBalancerVMsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetForvpc(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forvpc"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } func (p *ListInternalLoadBalancerVMsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListInternalLoadBalancerVMsParams instance, // as then you are sure you have configured all required params func (s *InternalLBService) NewListInternalLoadBalancerVMsParams() *ListInternalLoadBalancerVMsParams { p := &ListInternalLoadBalancerVMsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *InternalLBService) GetInternalLoadBalancerVMID(name string, opts ...OptionFunc) (string, int, error) { p := &ListInternalLoadBalancerVMsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListInternalLoadBalancerVMs(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.InternalLoadBalancerVMs[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.InternalLoadBalancerVMs { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *InternalLBService) GetInternalLoadBalancerVMByName(name string, opts ...OptionFunc) (*InternalLoadBalancerVM, int, error) { id, count, err := s.GetInternalLoadBalancerVMID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetInternalLoadBalancerVMByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *InternalLBService) GetInternalLoadBalancerVMByID(id string, opts ...OptionFunc) (*InternalLoadBalancerVM, int, error) { p := &ListInternalLoadBalancerVMsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListInternalLoadBalancerVMs(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.InternalLoadBalancerVMs[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for InternalLoadBalancerVM UUID: %s!", id) } // List internal LB VMs. func (s *InternalLBService) ListInternalLoadBalancerVMs(p *ListInternalLoadBalancerVMsParams) (*ListInternalLoadBalancerVMsResponse, error) { resp, err := s.cs.newRequest("listInternalLoadBalancerVMs", p.toURLValues()) if err != nil { return nil, err } var r ListInternalLoadBalancerVMsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListInternalLoadBalancerVMsResponse struct { Count int `json:"count"` InternalLoadBalancerVMs []*InternalLoadBalancerVM `json:"internalloadbalancervm"` } type InternalLoadBalancerVM struct { Account string `json:"account"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Guestipaddress string `json:"guestipaddress"` Guestmacaddress string `json:"guestmacaddress"` Guestnetmask string `json:"guestnetmask"` Guestnetworkid string `json:"guestnetworkid"` Guestnetworkname string `json:"guestnetworkname"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` Isredundantrouter bool `json:"isredundantrouter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Linklocalnetworkid string `json:"linklocalnetworkid"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Nic []Nic `json:"nic"` Podid string `json:"podid"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicnetworkid string `json:"publicnetworkid"` Redundantstate string `json:"redundantstate"` Requiresupgrade bool `json:"requiresupgrade"` Role string `json:"role"` Scriptsversion string `json:"scriptsversion"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` State string `json:"state"` Templateid string `json:"templateid"` Version string `json:"version"` Vpcid string `json:"vpcid"` Vpcname string `json:"vpcname"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type StartInternalLoadBalancerVMParams struct { p map[string]interface{} } func (p *StartInternalLoadBalancerVMParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *StartInternalLoadBalancerVMParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new StartInternalLoadBalancerVMParams instance, // as then you are sure you have configured all required params func (s *InternalLBService) NewStartInternalLoadBalancerVMParams(id string) *StartInternalLoadBalancerVMParams { p := &StartInternalLoadBalancerVMParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Starts an existing internal lb vm. func (s *InternalLBService) StartInternalLoadBalancerVM(p *StartInternalLoadBalancerVMParams) (*StartInternalLoadBalancerVMResponse, error) { resp, err := s.cs.newRequest("startInternalLoadBalancerVM", p.toURLValues()) if err != nil { return nil, err } var r StartInternalLoadBalancerVMResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type StartInternalLoadBalancerVMResponse struct { Account string `json:"account"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Guestipaddress string `json:"guestipaddress"` Guestmacaddress string `json:"guestmacaddress"` Guestnetmask string `json:"guestnetmask"` Guestnetworkid string `json:"guestnetworkid"` Guestnetworkname string `json:"guestnetworkname"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` Isredundantrouter bool `json:"isredundantrouter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Linklocalnetworkid string `json:"linklocalnetworkid"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Nic []Nic `json:"nic"` Podid string `json:"podid"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicnetworkid string `json:"publicnetworkid"` Redundantstate string `json:"redundantstate"` Requiresupgrade bool `json:"requiresupgrade"` Role string `json:"role"` Scriptsversion string `json:"scriptsversion"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` State string `json:"state"` Templateid string `json:"templateid"` Version string `json:"version"` Vpcid string `json:"vpcid"` Vpcname string `json:"vpcname"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type StopInternalLoadBalancerVMParams struct { p map[string]interface{} } func (p *StopInternalLoadBalancerVMParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["forced"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forced", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *StopInternalLoadBalancerVMParams) SetForced(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forced"] = v return } func (p *StopInternalLoadBalancerVMParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new StopInternalLoadBalancerVMParams instance, // as then you are sure you have configured all required params func (s *InternalLBService) NewStopInternalLoadBalancerVMParams(id string) *StopInternalLoadBalancerVMParams { p := &StopInternalLoadBalancerVMParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Stops an Internal LB vm. func (s *InternalLBService) StopInternalLoadBalancerVM(p *StopInternalLoadBalancerVMParams) (*StopInternalLoadBalancerVMResponse, error) { resp, err := s.cs.newRequest("stopInternalLoadBalancerVM", p.toURLValues()) if err != nil { return nil, err } var r StopInternalLoadBalancerVMResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type StopInternalLoadBalancerVMResponse struct { Account string `json:"account"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Guestipaddress string `json:"guestipaddress"` Guestmacaddress string `json:"guestmacaddress"` Guestnetmask string `json:"guestnetmask"` Guestnetworkid string `json:"guestnetworkid"` Guestnetworkname string `json:"guestnetworkname"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` Isredundantrouter bool `json:"isredundantrouter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Linklocalnetworkid string `json:"linklocalnetworkid"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Nic []Nic `json:"nic"` Podid string `json:"podid"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicnetworkid string `json:"publicnetworkid"` Redundantstate string `json:"redundantstate"` Requiresupgrade bool `json:"requiresupgrade"` Role string `json:"role"` Scriptsversion string `json:"scriptsversion"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` State string `json:"state"` Templateid string `json:"templateid"` Version string `json:"version"` Vpcid string `json:"vpcid"` Vpcname string `json:"vpcname"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/LDAPService.go000066400000000000000000000751761364073403100210260ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" ) type AddLdapConfigurationParams struct { p map[string]interface{} } func (p *AddLdapConfigurationParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["hostname"]; found { u.Set("hostname", v.(string)) } if v, found := p.p["port"]; found { vv := strconv.Itoa(v.(int)) u.Set("port", vv) } return u } func (p *AddLdapConfigurationParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *AddLdapConfigurationParams) SetHostname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostname"] = v return } func (p *AddLdapConfigurationParams) SetPort(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["port"] = v return } // You should always use this function to get a new AddLdapConfigurationParams instance, // as then you are sure you have configured all required params func (s *LDAPService) NewAddLdapConfigurationParams(hostname string, port int) *AddLdapConfigurationParams { p := &AddLdapConfigurationParams{} p.p = make(map[string]interface{}) p.p["hostname"] = hostname p.p["port"] = port return p } // Add a new Ldap Configuration func (s *LDAPService) AddLdapConfiguration(p *AddLdapConfigurationParams) (*AddLdapConfigurationResponse, error) { resp, err := s.cs.newRequest("addLdapConfiguration", p.toURLValues()) if err != nil { return nil, err } var r AddLdapConfigurationResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddLdapConfigurationResponse struct { Domainid string `json:"domainid"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Port int `json:"port"` } type DeleteLdapConfigurationParams struct { p map[string]interface{} } func (p *DeleteLdapConfigurationParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["hostname"]; found { u.Set("hostname", v.(string)) } if v, found := p.p["port"]; found { vv := strconv.Itoa(v.(int)) u.Set("port", vv) } return u } func (p *DeleteLdapConfigurationParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DeleteLdapConfigurationParams) SetHostname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostname"] = v return } func (p *DeleteLdapConfigurationParams) SetPort(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["port"] = v return } // You should always use this function to get a new DeleteLdapConfigurationParams instance, // as then you are sure you have configured all required params func (s *LDAPService) NewDeleteLdapConfigurationParams(hostname string) *DeleteLdapConfigurationParams { p := &DeleteLdapConfigurationParams{} p.p = make(map[string]interface{}) p.p["hostname"] = hostname return p } // Remove an Ldap Configuration func (s *LDAPService) DeleteLdapConfiguration(p *DeleteLdapConfigurationParams) (*DeleteLdapConfigurationResponse, error) { resp, err := s.cs.newRequest("deleteLdapConfiguration", p.toURLValues()) if err != nil { return nil, err } var r DeleteLdapConfigurationResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteLdapConfigurationResponse struct { Domainid string `json:"domainid"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Port int `json:"port"` } type ImportLdapUsersParams struct { p map[string]interface{} } func (p *ImportLdapUsersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["accountdetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("accountdetails[%d].key", i), k) u.Set(fmt.Sprintf("accountdetails[%d].value", i), m[k]) } } if v, found := p.p["accounttype"]; found { vv := strconv.Itoa(v.(int)) u.Set("accounttype", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["group"]; found { u.Set("group", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["roleid"]; found { u.Set("roleid", v.(string)) } if v, found := p.p["timezone"]; found { u.Set("timezone", v.(string)) } return u } func (p *ImportLdapUsersParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ImportLdapUsersParams) SetAccountdetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountdetails"] = v return } func (p *ImportLdapUsersParams) SetAccounttype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accounttype"] = v return } func (p *ImportLdapUsersParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ImportLdapUsersParams) SetGroup(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["group"] = v return } func (p *ImportLdapUsersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ImportLdapUsersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ImportLdapUsersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ImportLdapUsersParams) SetRoleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["roleid"] = v return } func (p *ImportLdapUsersParams) SetTimezone(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["timezone"] = v return } // You should always use this function to get a new ImportLdapUsersParams instance, // as then you are sure you have configured all required params func (s *LDAPService) NewImportLdapUsersParams() *ImportLdapUsersParams { p := &ImportLdapUsersParams{} p.p = make(map[string]interface{}) return p } // Import LDAP users func (s *LDAPService) ImportLdapUsers(p *ImportLdapUsersParams) (*ImportLdapUsersResponse, error) { resp, err := s.cs.newRequest("importLdapUsers", p.toURLValues()) if err != nil { return nil, err } var r ImportLdapUsersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ImportLdapUsersResponse struct { Domain string `json:"domain"` Email string `json:"email"` Firstname string `json:"firstname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Principal string `json:"principal"` Username string `json:"username"` } type LdapConfigParams struct { p map[string]interface{} } func (p *LdapConfigParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["binddn"]; found { u.Set("binddn", v.(string)) } if v, found := p.p["bindpass"]; found { u.Set("bindpass", v.(string)) } if v, found := p.p["hostname"]; found { u.Set("hostname", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["port"]; found { vv := strconv.Itoa(v.(int)) u.Set("port", vv) } if v, found := p.p["queryfilter"]; found { u.Set("queryfilter", v.(string)) } if v, found := p.p["searchbase"]; found { u.Set("searchbase", v.(string)) } if v, found := p.p["ssl"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("ssl", vv) } if v, found := p.p["truststore"]; found { u.Set("truststore", v.(string)) } if v, found := p.p["truststorepass"]; found { u.Set("truststorepass", v.(string)) } return u } func (p *LdapConfigParams) SetBinddn(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["binddn"] = v return } func (p *LdapConfigParams) SetBindpass(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bindpass"] = v return } func (p *LdapConfigParams) SetHostname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostname"] = v return } func (p *LdapConfigParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *LdapConfigParams) SetPort(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["port"] = v return } func (p *LdapConfigParams) SetQueryfilter(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["queryfilter"] = v return } func (p *LdapConfigParams) SetSearchbase(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["searchbase"] = v return } func (p *LdapConfigParams) SetSsl(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ssl"] = v return } func (p *LdapConfigParams) SetTruststore(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["truststore"] = v return } func (p *LdapConfigParams) SetTruststorepass(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["truststorepass"] = v return } // You should always use this function to get a new LdapConfigParams instance, // as then you are sure you have configured all required params func (s *LDAPService) NewLdapConfigParams() *LdapConfigParams { p := &LdapConfigParams{} p.p = make(map[string]interface{}) return p } // (Deprecated, use addLdapConfiguration) Configure the LDAP context for this site. func (s *LDAPService) LdapConfig(p *LdapConfigParams) (*LdapConfigResponse, error) { resp, err := s.cs.newRequest("ldapConfig", p.toURLValues()) if err != nil { return nil, err } var r LdapConfigResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type LdapConfigResponse struct { Binddn string `json:"binddn"` Bindpass string `json:"bindpass"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Port string `json:"port"` Queryfilter string `json:"queryfilter"` Searchbase string `json:"searchbase"` Ssl string `json:"ssl"` } type LdapCreateAccountParams struct { p map[string]interface{} } func (p *LdapCreateAccountParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["accountdetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("accountdetails[%d].key", i), k) u.Set(fmt.Sprintf("accountdetails[%d].value", i), m[k]) } } if v, found := p.p["accountid"]; found { u.Set("accountid", v.(string)) } if v, found := p.p["accounttype"]; found { vv := strconv.Itoa(v.(int)) u.Set("accounttype", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["networkdomain"]; found { u.Set("networkdomain", v.(string)) } if v, found := p.p["roleid"]; found { u.Set("roleid", v.(string)) } if v, found := p.p["timezone"]; found { u.Set("timezone", v.(string)) } if v, found := p.p["userid"]; found { u.Set("userid", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *LdapCreateAccountParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *LdapCreateAccountParams) SetAccountdetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountdetails"] = v return } func (p *LdapCreateAccountParams) SetAccountid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountid"] = v return } func (p *LdapCreateAccountParams) SetAccounttype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accounttype"] = v return } func (p *LdapCreateAccountParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *LdapCreateAccountParams) SetNetworkdomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdomain"] = v return } func (p *LdapCreateAccountParams) SetRoleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["roleid"] = v return } func (p *LdapCreateAccountParams) SetTimezone(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["timezone"] = v return } func (p *LdapCreateAccountParams) SetUserid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["userid"] = v return } func (p *LdapCreateAccountParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new LdapCreateAccountParams instance, // as then you are sure you have configured all required params func (s *LDAPService) NewLdapCreateAccountParams(username string) *LdapCreateAccountParams { p := &LdapCreateAccountParams{} p.p = make(map[string]interface{}) p.p["username"] = username return p } // Creates an account from an LDAP user func (s *LDAPService) LdapCreateAccount(p *LdapCreateAccountParams) (*LdapCreateAccountResponse, error) { resp, err := s.cs.newRequest("ldapCreateAccount", p.toURLValues()) if err != nil { return nil, err } var r LdapCreateAccountResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type LdapCreateAccountResponse struct { Accountdetails map[string]string `json:"accountdetails"` Accounttype int `json:"accounttype"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Defaultzoneid string `json:"defaultzoneid"` Domain string `json:"domain"` Domainid string `json:"domainid"` Groups []string `json:"groups"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` Iscleanuprequired bool `json:"iscleanuprequired"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networkdomain string `json:"networkdomain"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectavailable string `json:"projectavailable"` Projectlimit string `json:"projectlimit"` Projecttotal int64 `json:"projecttotal"` Receivedbytes int64 `json:"receivedbytes"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Sentbytes int64 `json:"sentbytes"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` User []LdapCreateAccountResponseUser `json:"user"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type LdapCreateAccountResponseUser struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type LdapRemoveParams struct { p map[string]interface{} } func (p *LdapRemoveParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } return u } // You should always use this function to get a new LdapRemoveParams instance, // as then you are sure you have configured all required params func (s *LDAPService) NewLdapRemoveParams() *LdapRemoveParams { p := &LdapRemoveParams{} p.p = make(map[string]interface{}) return p } // (Deprecated , use deleteLdapConfiguration) Remove the LDAP context for this site. func (s *LDAPService) LdapRemove(p *LdapRemoveParams) (*LdapRemoveResponse, error) { resp, err := s.cs.newRequest("ldapRemove", p.toURLValues()) if err != nil { return nil, err } var r LdapRemoveResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type LdapRemoveResponse struct { Binddn string `json:"binddn"` Bindpass string `json:"bindpass"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Port string `json:"port"` Queryfilter string `json:"queryfilter"` Searchbase string `json:"searchbase"` Ssl string `json:"ssl"` } type LinkDomainToLdapParams struct { p map[string]interface{} } func (p *LinkDomainToLdapParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["accounttype"]; found { vv := strconv.Itoa(v.(int)) u.Set("accounttype", vv) } if v, found := p.p["admin"]; found { u.Set("admin", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["ldapdomain"]; found { u.Set("ldapdomain", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *LinkDomainToLdapParams) SetAccounttype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accounttype"] = v return } func (p *LinkDomainToLdapParams) SetAdmin(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["admin"] = v return } func (p *LinkDomainToLdapParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *LinkDomainToLdapParams) SetLdapdomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ldapdomain"] = v return } func (p *LinkDomainToLdapParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *LinkDomainToLdapParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new LinkDomainToLdapParams instance, // as then you are sure you have configured all required params func (s *LDAPService) NewLinkDomainToLdapParams(accounttype int, domainid string, lDAPType string) *LinkDomainToLdapParams { p := &LinkDomainToLdapParams{} p.p = make(map[string]interface{}) p.p["accounttype"] = accounttype p.p["domainid"] = domainid p.p["type"] = lDAPType return p } // link an existing cloudstack domain to group or OU in ldap func (s *LDAPService) LinkDomainToLdap(p *LinkDomainToLdapParams) (*LinkDomainToLdapResponse, error) { resp, err := s.cs.newRequest("linkDomainToLdap", p.toURLValues()) if err != nil { return nil, err } var r LinkDomainToLdapResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type LinkDomainToLdapResponse struct { Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Domainid string `json:"domainid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Ldapdomain string `json:"ldapdomain"` Name string `json:"name"` Type string `json:"type"` } type ListLdapConfigurationsParams struct { p map[string]interface{} } func (p *ListLdapConfigurationsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["hostname"]; found { u.Set("hostname", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["port"]; found { vv := strconv.Itoa(v.(int)) u.Set("port", vv) } return u } func (p *ListLdapConfigurationsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListLdapConfigurationsParams) SetHostname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostname"] = v return } func (p *ListLdapConfigurationsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListLdapConfigurationsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListLdapConfigurationsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListLdapConfigurationsParams) SetPort(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["port"] = v return } // You should always use this function to get a new ListLdapConfigurationsParams instance, // as then you are sure you have configured all required params func (s *LDAPService) NewListLdapConfigurationsParams() *ListLdapConfigurationsParams { p := &ListLdapConfigurationsParams{} p.p = make(map[string]interface{}) return p } // Lists all LDAP configurations func (s *LDAPService) ListLdapConfigurations(p *ListLdapConfigurationsParams) (*ListLdapConfigurationsResponse, error) { resp, err := s.cs.newRequest("listLdapConfigurations", p.toURLValues()) if err != nil { return nil, err } var r ListLdapConfigurationsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListLdapConfigurationsResponse struct { Count int `json:"count"` LdapConfigurations []*LdapConfiguration `json:"ldapconfiguration"` } type LdapConfiguration struct { Domainid string `json:"domainid"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Port int `json:"port"` } type ListLdapUsersParams struct { p map[string]interface{} } func (p *ListLdapUsersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listtype"]; found { u.Set("listtype", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListLdapUsersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListLdapUsersParams) SetListtype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listtype"] = v return } func (p *ListLdapUsersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListLdapUsersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListLdapUsersParams instance, // as then you are sure you have configured all required params func (s *LDAPService) NewListLdapUsersParams() *ListLdapUsersParams { p := &ListLdapUsersParams{} p.p = make(map[string]interface{}) return p } // Lists all LDAP Users func (s *LDAPService) ListLdapUsers(p *ListLdapUsersParams) (*ListLdapUsersResponse, error) { resp, err := s.cs.newRequest("listLdapUsers", p.toURLValues()) if err != nil { return nil, err } var r ListLdapUsersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListLdapUsersResponse struct { Count int `json:"count"` LdapUsers []*LdapUser `json:"ldapuser"` } type LdapUser struct { Domain string `json:"domain"` Email string `json:"email"` Firstname string `json:"firstname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Principal string `json:"principal"` Username string `json:"username"` } type SearchLdapParams struct { p map[string]interface{} } func (p *SearchLdapParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["query"]; found { u.Set("query", v.(string)) } return u } func (p *SearchLdapParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *SearchLdapParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *SearchLdapParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *SearchLdapParams) SetQuery(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["query"] = v return } // You should always use this function to get a new SearchLdapParams instance, // as then you are sure you have configured all required params func (s *LDAPService) NewSearchLdapParams(query string) *SearchLdapParams { p := &SearchLdapParams{} p.p = make(map[string]interface{}) p.p["query"] = query return p } // Searches LDAP based on the username attribute func (s *LDAPService) SearchLdap(p *SearchLdapParams) (*SearchLdapResponse, error) { resp, err := s.cs.newRequest("searchLdap", p.toURLValues()) if err != nil { return nil, err } var r SearchLdapResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type SearchLdapResponse struct { Domain string `json:"domain"` Email string `json:"email"` Firstname string `json:"firstname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Principal string `json:"principal"` Username string `json:"username"` } go-cloudstack-2.9.0/cloudstack/LimitService.go000066400000000000000000000277311364073403100213560ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type GetApiLimitParams struct { p map[string]interface{} } func (p *GetApiLimitParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } return u } // You should always use this function to get a new GetApiLimitParams instance, // as then you are sure you have configured all required params func (s *LimitService) NewGetApiLimitParams() *GetApiLimitParams { p := &GetApiLimitParams{} p.p = make(map[string]interface{}) return p } // Get API limit count for the caller func (s *LimitService) GetApiLimit(p *GetApiLimitParams) (*GetApiLimitResponse, error) { resp, err := s.cs.newRequest("getApiLimit", p.toURLValues()) if err != nil { return nil, err } var r GetApiLimitResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetApiLimitResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` ApiAllowed int `json:"apiAllowed"` ApiIssued int `json:"apiIssued"` ExpireAfter int64 `json:"expireAfter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } type ListResourceLimitsParams struct { p map[string]interface{} } func (p *ListResourceLimitsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("id", vv) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["resourcetype"]; found { vv := strconv.Itoa(v.(int)) u.Set("resourcetype", vv) } if v, found := p.p["resourcetypename"]; found { u.Set("resourcetypename", v.(string)) } return u } func (p *ListResourceLimitsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListResourceLimitsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListResourceLimitsParams) SetId(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListResourceLimitsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListResourceLimitsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListResourceLimitsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListResourceLimitsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListResourceLimitsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListResourceLimitsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListResourceLimitsParams) SetResourcetype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcetype"] = v return } func (p *ListResourceLimitsParams) SetResourcetypename(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcetypename"] = v return } // You should always use this function to get a new ListResourceLimitsParams instance, // as then you are sure you have configured all required params func (s *LimitService) NewListResourceLimitsParams() *ListResourceLimitsParams { p := &ListResourceLimitsParams{} p.p = make(map[string]interface{}) return p } // Lists resource limits. func (s *LimitService) ListResourceLimits(p *ListResourceLimitsParams) (*ListResourceLimitsResponse, error) { resp, err := s.cs.newRequest("listResourceLimits", p.toURLValues()) if err != nil { return nil, err } var r ListResourceLimitsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListResourceLimitsResponse struct { Count int `json:"count"` ResourceLimits []*ResourceLimit `json:"resourcelimit"` } type ResourceLimit struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Max int64 `json:"max"` Project string `json:"project"` Projectid string `json:"projectid"` Resourcetype string `json:"resourcetype"` Resourcetypename string `json:"resourcetypename"` } type ResetApiLimitParams struct { p map[string]interface{} } func (p *ResetApiLimitParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } return u } func (p *ResetApiLimitParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } // You should always use this function to get a new ResetApiLimitParams instance, // as then you are sure you have configured all required params func (s *LimitService) NewResetApiLimitParams() *ResetApiLimitParams { p := &ResetApiLimitParams{} p.p = make(map[string]interface{}) return p } // Reset api count func (s *LimitService) ResetApiLimit(p *ResetApiLimitParams) (*ResetApiLimitResponse, error) { resp, err := s.cs.newRequest("resetApiLimit", p.toURLValues()) if err != nil { return nil, err } var r ResetApiLimitResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ResetApiLimitResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` ApiAllowed int `json:"apiAllowed"` ApiIssued int `json:"apiIssued"` ExpireAfter int64 `json:"expireAfter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } type UpdateResourceCountParams struct { p map[string]interface{} } func (p *UpdateResourceCountParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["resourcetype"]; found { vv := strconv.Itoa(v.(int)) u.Set("resourcetype", vv) } return u } func (p *UpdateResourceCountParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *UpdateResourceCountParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *UpdateResourceCountParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *UpdateResourceCountParams) SetResourcetype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcetype"] = v return } // You should always use this function to get a new UpdateResourceCountParams instance, // as then you are sure you have configured all required params func (s *LimitService) NewUpdateResourceCountParams(domainid string) *UpdateResourceCountParams { p := &UpdateResourceCountParams{} p.p = make(map[string]interface{}) p.p["domainid"] = domainid return p } // Recalculate and update resource count for an account or domain. func (s *LimitService) UpdateResourceCount(p *UpdateResourceCountParams) (*UpdateResourceCountResponse, error) { resp, err := s.cs.newRequest("updateResourceCount", p.toURLValues()) if err != nil { return nil, err } var r UpdateResourceCountResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateResourceCountResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` Resourcecount int64 `json:"resourcecount"` Resourcetype string `json:"resourcetype"` Resourcetypename string `json:"resourcetypename"` } type UpdateResourceLimitParams struct { p map[string]interface{} } func (p *UpdateResourceLimitParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["max"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("max", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["resourcetype"]; found { vv := strconv.Itoa(v.(int)) u.Set("resourcetype", vv) } return u } func (p *UpdateResourceLimitParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *UpdateResourceLimitParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *UpdateResourceLimitParams) SetMax(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["max"] = v return } func (p *UpdateResourceLimitParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *UpdateResourceLimitParams) SetResourcetype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcetype"] = v return } // You should always use this function to get a new UpdateResourceLimitParams instance, // as then you are sure you have configured all required params func (s *LimitService) NewUpdateResourceLimitParams(resourcetype int) *UpdateResourceLimitParams { p := &UpdateResourceLimitParams{} p.p = make(map[string]interface{}) p.p["resourcetype"] = resourcetype return p } // Updates resource limits for an account or domain. func (s *LimitService) UpdateResourceLimit(p *UpdateResourceLimitParams) (*UpdateResourceLimitResponse, error) { resp, err := s.cs.newRequest("updateResourceLimit", p.toURLValues()) if err != nil { return nil, err } var r UpdateResourceLimitResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateResourceLimitResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Max int64 `json:"max"` Project string `json:"project"` Projectid string `json:"projectid"` Resourcetype string `json:"resourcetype"` Resourcetypename string `json:"resourcetypename"` } go-cloudstack-2.9.0/cloudstack/LoadBalancerService.go000066400000000000000000004015671364073403100226120ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AddNetscalerLoadBalancerParams struct { p map[string]interface{} } func (p *AddNetscalerLoadBalancerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["gslbprovider"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("gslbprovider", vv) } if v, found := p.p["gslbproviderprivateip"]; found { u.Set("gslbproviderprivateip", v.(string)) } if v, found := p.p["gslbproviderpublicip"]; found { u.Set("gslbproviderpublicip", v.(string)) } if v, found := p.p["isexclusivegslbprovider"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isexclusivegslbprovider", vv) } if v, found := p.p["networkdevicetype"]; found { u.Set("networkdevicetype", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddNetscalerLoadBalancerParams) SetGslbprovider(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gslbprovider"] = v return } func (p *AddNetscalerLoadBalancerParams) SetGslbproviderprivateip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gslbproviderprivateip"] = v return } func (p *AddNetscalerLoadBalancerParams) SetGslbproviderpublicip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gslbproviderpublicip"] = v return } func (p *AddNetscalerLoadBalancerParams) SetIsexclusivegslbprovider(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isexclusivegslbprovider"] = v return } func (p *AddNetscalerLoadBalancerParams) SetNetworkdevicetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdevicetype"] = v return } func (p *AddNetscalerLoadBalancerParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddNetscalerLoadBalancerParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddNetscalerLoadBalancerParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddNetscalerLoadBalancerParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddNetscalerLoadBalancerParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewAddNetscalerLoadBalancerParams(networkdevicetype string, password string, physicalnetworkid string, url string, username string) *AddNetscalerLoadBalancerParams { p := &AddNetscalerLoadBalancerParams{} p.p = make(map[string]interface{}) p.p["networkdevicetype"] = networkdevicetype p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["url"] = url p.p["username"] = username return p } // Adds a netscaler load balancer device func (s *LoadBalancerService) AddNetscalerLoadBalancer(p *AddNetscalerLoadBalancerParams) (*AddNetscalerLoadBalancerResponse, error) { resp, err := s.cs.newRequest("addNetscalerLoadBalancer", p.toURLValues()) if err != nil { return nil, err } var r AddNetscalerLoadBalancerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddNetscalerLoadBalancerResponse struct { Gslbprovider bool `json:"gslbprovider"` Gslbproviderprivateip string `json:"gslbproviderprivateip"` Gslbproviderpublicip string `json:"gslbproviderpublicip"` Ipaddress string `json:"ipaddress"` Isexclusivegslbprovider bool `json:"isexclusivegslbprovider"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbdevicecapacity int64 `json:"lbdevicecapacity"` Lbdevicededicated bool `json:"lbdevicededicated"` Lbdeviceid string `json:"lbdeviceid"` Lbdevicename string `json:"lbdevicename"` Lbdevicestate string `json:"lbdevicestate"` Physicalnetworkid string `json:"physicalnetworkid"` Podids []string `json:"podids"` Privateinterface string `json:"privateinterface"` Provider string `json:"provider"` Publicinterface string `json:"publicinterface"` } type AssignCertToLoadBalancerParams struct { p map[string]interface{} } func (p *AssignCertToLoadBalancerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["certid"]; found { u.Set("certid", v.(string)) } if v, found := p.p["lbruleid"]; found { u.Set("lbruleid", v.(string)) } return u } func (p *AssignCertToLoadBalancerParams) SetCertid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["certid"] = v return } func (p *AssignCertToLoadBalancerParams) SetLbruleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbruleid"] = v return } // You should always use this function to get a new AssignCertToLoadBalancerParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewAssignCertToLoadBalancerParams(certid string, lbruleid string) *AssignCertToLoadBalancerParams { p := &AssignCertToLoadBalancerParams{} p.p = make(map[string]interface{}) p.p["certid"] = certid p.p["lbruleid"] = lbruleid return p } // Assigns a certificate to a load balancer rule func (s *LoadBalancerService) AssignCertToLoadBalancer(p *AssignCertToLoadBalancerParams) (*AssignCertToLoadBalancerResponse, error) { resp, err := s.cs.newRequest("assignCertToLoadBalancer", p.toURLValues()) if err != nil { return nil, err } var r AssignCertToLoadBalancerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AssignCertToLoadBalancerResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type AssignToGlobalLoadBalancerRuleParams struct { p map[string]interface{} } func (p *AssignToGlobalLoadBalancerRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["gslblbruleweightsmap"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("gslblbruleweightsmap[%d].key", i), k) u.Set(fmt.Sprintf("gslblbruleweightsmap[%d].value", i), m[k]) } } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["loadbalancerrulelist"]; found { vv := strings.Join(v.([]string), ",") u.Set("loadbalancerrulelist", vv) } return u } func (p *AssignToGlobalLoadBalancerRuleParams) SetGslblbruleweightsmap(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gslblbruleweightsmap"] = v return } func (p *AssignToGlobalLoadBalancerRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *AssignToGlobalLoadBalancerRuleParams) SetLoadbalancerrulelist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["loadbalancerrulelist"] = v return } // You should always use this function to get a new AssignToGlobalLoadBalancerRuleParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewAssignToGlobalLoadBalancerRuleParams(id string, loadbalancerrulelist []string) *AssignToGlobalLoadBalancerRuleParams { p := &AssignToGlobalLoadBalancerRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["loadbalancerrulelist"] = loadbalancerrulelist return p } // Assign load balancer rule or list of load balancer rules to a global load balancer rules. func (s *LoadBalancerService) AssignToGlobalLoadBalancerRule(p *AssignToGlobalLoadBalancerRuleParams) (*AssignToGlobalLoadBalancerRuleResponse, error) { resp, err := s.cs.newRequest("assignToGlobalLoadBalancerRule", p.toURLValues()) if err != nil { return nil, err } var r AssignToGlobalLoadBalancerRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AssignToGlobalLoadBalancerRuleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type AssignToLoadBalancerRuleParams struct { p map[string]interface{} } func (p *AssignToLoadBalancerRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["virtualmachineids"]; found { vv := strings.Join(v.([]string), ",") u.Set("virtualmachineids", vv) } if v, found := p.p["vmidipmap"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("vmidipmap[%d].key", i), k) u.Set(fmt.Sprintf("vmidipmap[%d].value", i), m[k]) } } return u } func (p *AssignToLoadBalancerRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *AssignToLoadBalancerRuleParams) SetVirtualmachineids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineids"] = v return } func (p *AssignToLoadBalancerRuleParams) SetVmidipmap(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmidipmap"] = v return } // You should always use this function to get a new AssignToLoadBalancerRuleParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewAssignToLoadBalancerRuleParams(id string) *AssignToLoadBalancerRuleParams { p := &AssignToLoadBalancerRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Assigns virtual machine or a list of virtual machines to a load balancer rule. func (s *LoadBalancerService) AssignToLoadBalancerRule(p *AssignToLoadBalancerRuleParams) (*AssignToLoadBalancerRuleResponse, error) { resp, err := s.cs.newRequest("assignToLoadBalancerRule", p.toURLValues()) if err != nil { return nil, err } var r AssignToLoadBalancerRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AssignToLoadBalancerRuleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ConfigureNetscalerLoadBalancerParams struct { p map[string]interface{} } func (p *ConfigureNetscalerLoadBalancerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["inline"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("inline", vv) } if v, found := p.p["lbdevicecapacity"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("lbdevicecapacity", vv) } if v, found := p.p["lbdevicededicated"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("lbdevicededicated", vv) } if v, found := p.p["lbdeviceid"]; found { u.Set("lbdeviceid", v.(string)) } if v, found := p.p["podids"]; found { vv := strings.Join(v.([]string), ",") u.Set("podids", vv) } return u } func (p *ConfigureNetscalerLoadBalancerParams) SetInline(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["inline"] = v return } func (p *ConfigureNetscalerLoadBalancerParams) SetLbdevicecapacity(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbdevicecapacity"] = v return } func (p *ConfigureNetscalerLoadBalancerParams) SetLbdevicededicated(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbdevicededicated"] = v return } func (p *ConfigureNetscalerLoadBalancerParams) SetLbdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbdeviceid"] = v return } func (p *ConfigureNetscalerLoadBalancerParams) SetPodids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podids"] = v return } // You should always use this function to get a new ConfigureNetscalerLoadBalancerParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewConfigureNetscalerLoadBalancerParams(lbdeviceid string) *ConfigureNetscalerLoadBalancerParams { p := &ConfigureNetscalerLoadBalancerParams{} p.p = make(map[string]interface{}) p.p["lbdeviceid"] = lbdeviceid return p } // configures a netscaler load balancer device func (s *LoadBalancerService) ConfigureNetscalerLoadBalancer(p *ConfigureNetscalerLoadBalancerParams) (*NetscalerLoadBalancerResponse, error) { resp, err := s.cs.newRequest("configureNetscalerLoadBalancer", p.toURLValues()) if err != nil { return nil, err } var r NetscalerLoadBalancerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type NetscalerLoadBalancerResponse struct { Gslbprovider bool `json:"gslbprovider"` Gslbproviderprivateip string `json:"gslbproviderprivateip"` Gslbproviderpublicip string `json:"gslbproviderpublicip"` Ipaddress string `json:"ipaddress"` Isexclusivegslbprovider bool `json:"isexclusivegslbprovider"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbdevicecapacity int64 `json:"lbdevicecapacity"` Lbdevicededicated bool `json:"lbdevicededicated"` Lbdeviceid string `json:"lbdeviceid"` Lbdevicename string `json:"lbdevicename"` Lbdevicestate string `json:"lbdevicestate"` Physicalnetworkid string `json:"physicalnetworkid"` Podids []string `json:"podids"` Privateinterface string `json:"privateinterface"` Provider string `json:"provider"` Publicinterface string `json:"publicinterface"` } type CreateGlobalLoadBalancerRuleParams struct { p map[string]interface{} } func (p *CreateGlobalLoadBalancerRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["gslbdomainname"]; found { u.Set("gslbdomainname", v.(string)) } if v, found := p.p["gslblbmethod"]; found { u.Set("gslblbmethod", v.(string)) } if v, found := p.p["gslbservicetype"]; found { u.Set("gslbservicetype", v.(string)) } if v, found := p.p["gslbstickysessionmethodname"]; found { u.Set("gslbstickysessionmethodname", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["regionid"]; found { vv := strconv.Itoa(v.(int)) u.Set("regionid", vv) } return u } func (p *CreateGlobalLoadBalancerRuleParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateGlobalLoadBalancerRuleParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateGlobalLoadBalancerRuleParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateGlobalLoadBalancerRuleParams) SetGslbdomainname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gslbdomainname"] = v return } func (p *CreateGlobalLoadBalancerRuleParams) SetGslblbmethod(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gslblbmethod"] = v return } func (p *CreateGlobalLoadBalancerRuleParams) SetGslbservicetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gslbservicetype"] = v return } func (p *CreateGlobalLoadBalancerRuleParams) SetGslbstickysessionmethodname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gslbstickysessionmethodname"] = v return } func (p *CreateGlobalLoadBalancerRuleParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateGlobalLoadBalancerRuleParams) SetRegionid(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["regionid"] = v return } // You should always use this function to get a new CreateGlobalLoadBalancerRuleParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewCreateGlobalLoadBalancerRuleParams(gslbdomainname string, gslbservicetype string, name string, regionid int) *CreateGlobalLoadBalancerRuleParams { p := &CreateGlobalLoadBalancerRuleParams{} p.p = make(map[string]interface{}) p.p["gslbdomainname"] = gslbdomainname p.p["gslbservicetype"] = gslbservicetype p.p["name"] = name p.p["regionid"] = regionid return p } // Creates a global load balancer rule func (s *LoadBalancerService) CreateGlobalLoadBalancerRule(p *CreateGlobalLoadBalancerRuleParams) (*CreateGlobalLoadBalancerRuleResponse, error) { resp, err := s.cs.newRequest("createGlobalLoadBalancerRule", p.toURLValues()) if err != nil { return nil, err } var r CreateGlobalLoadBalancerRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateGlobalLoadBalancerRuleResponse struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gslbdomainname string `json:"gslbdomainname"` Gslblbmethod string `json:"gslblbmethod"` Gslbservicetype string `json:"gslbservicetype"` Gslbstickysessionmethodname string `json:"gslbstickysessionmethodname"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Loadbalancerrule []CreateGlobalLoadBalancerRuleResponseLoadbalancerrule `json:"loadbalancerrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Regionid int `json:"regionid"` } type CreateGlobalLoadBalancerRuleResponseLoadbalancerrule struct { Account string `json:"account"` Algorithm string `json:"algorithm"` Cidrlist string `json:"cidrlist"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Name string `json:"name"` Networkid string `json:"networkid"` Privateport string `json:"privateport"` Project string `json:"project"` Projectid string `json:"projectid"` Protocol string `json:"protocol"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type CreateLBHealthCheckPolicyParams struct { p map[string]interface{} } func (p *CreateLBHealthCheckPolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["healthythreshold"]; found { vv := strconv.Itoa(v.(int)) u.Set("healthythreshold", vv) } if v, found := p.p["intervaltime"]; found { vv := strconv.Itoa(v.(int)) u.Set("intervaltime", vv) } if v, found := p.p["lbruleid"]; found { u.Set("lbruleid", v.(string)) } if v, found := p.p["pingpath"]; found { u.Set("pingpath", v.(string)) } if v, found := p.p["responsetimeout"]; found { vv := strconv.Itoa(v.(int)) u.Set("responsetimeout", vv) } if v, found := p.p["unhealthythreshold"]; found { vv := strconv.Itoa(v.(int)) u.Set("unhealthythreshold", vv) } return u } func (p *CreateLBHealthCheckPolicyParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateLBHealthCheckPolicyParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateLBHealthCheckPolicyParams) SetHealthythreshold(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["healthythreshold"] = v return } func (p *CreateLBHealthCheckPolicyParams) SetIntervaltime(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["intervaltime"] = v return } func (p *CreateLBHealthCheckPolicyParams) SetLbruleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbruleid"] = v return } func (p *CreateLBHealthCheckPolicyParams) SetPingpath(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pingpath"] = v return } func (p *CreateLBHealthCheckPolicyParams) SetResponsetimeout(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["responsetimeout"] = v return } func (p *CreateLBHealthCheckPolicyParams) SetUnhealthythreshold(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["unhealthythreshold"] = v return } // You should always use this function to get a new CreateLBHealthCheckPolicyParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewCreateLBHealthCheckPolicyParams(lbruleid string) *CreateLBHealthCheckPolicyParams { p := &CreateLBHealthCheckPolicyParams{} p.p = make(map[string]interface{}) p.p["lbruleid"] = lbruleid return p } // Creates a load balancer health check policy func (s *LoadBalancerService) CreateLBHealthCheckPolicy(p *CreateLBHealthCheckPolicyParams) (*CreateLBHealthCheckPolicyResponse, error) { resp, err := s.cs.newRequest("createLBHealthCheckPolicy", p.toURLValues()) if err != nil { return nil, err } var r CreateLBHealthCheckPolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateLBHealthCheckPolicyResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Healthcheckpolicy []CreateLBHealthCheckPolicyResponseHealthcheckpolicy `json:"healthcheckpolicy"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Zoneid string `json:"zoneid"` } type CreateLBHealthCheckPolicyResponseHealthcheckpolicy struct { Description string `json:"description"` Fordisplay bool `json:"fordisplay"` Healthcheckinterval int `json:"healthcheckinterval"` Healthcheckthresshold int `json:"healthcheckthresshold"` Id string `json:"id"` Pingpath string `json:"pingpath"` Responsetime int `json:"responsetime"` State string `json:"state"` Unhealthcheckthresshold int `json:"unhealthcheckthresshold"` } type CreateLBStickinessPolicyParams struct { p map[string]interface{} } func (p *CreateLBStickinessPolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["lbruleid"]; found { u.Set("lbruleid", v.(string)) } if v, found := p.p["methodname"]; found { u.Set("methodname", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["param"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("param[%d].key", i), k) u.Set(fmt.Sprintf("param[%d].value", i), m[k]) } } return u } func (p *CreateLBStickinessPolicyParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateLBStickinessPolicyParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateLBStickinessPolicyParams) SetLbruleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbruleid"] = v return } func (p *CreateLBStickinessPolicyParams) SetMethodname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["methodname"] = v return } func (p *CreateLBStickinessPolicyParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateLBStickinessPolicyParams) SetParam(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["param"] = v return } // You should always use this function to get a new CreateLBStickinessPolicyParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewCreateLBStickinessPolicyParams(lbruleid string, methodname string, name string) *CreateLBStickinessPolicyParams { p := &CreateLBStickinessPolicyParams{} p.p = make(map[string]interface{}) p.p["lbruleid"] = lbruleid p.p["methodname"] = methodname p.p["name"] = name return p } // Creates a load balancer stickiness policy func (s *LoadBalancerService) CreateLBStickinessPolicy(p *CreateLBStickinessPolicyParams) (*CreateLBStickinessPolicyResponse, error) { resp, err := s.cs.newRequest("createLBStickinessPolicy", p.toURLValues()) if err != nil { return nil, err } var r CreateLBStickinessPolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateLBStickinessPolicyResponse struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Name string `json:"name"` State string `json:"state"` Stickinesspolicy []CreateLBStickinessPolicyResponseStickinesspolicy `json:"stickinesspolicy"` Zoneid string `json:"zoneid"` } type CreateLBStickinessPolicyResponseStickinesspolicy struct { Description string `json:"description"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Methodname string `json:"methodname"` Name string `json:"name"` Params map[string]string `json:"params"` State string `json:"state"` } type CreateLoadBalancerParams struct { p map[string]interface{} } func (p *CreateLoadBalancerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["algorithm"]; found { u.Set("algorithm", v.(string)) } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["instanceport"]; found { vv := strconv.Itoa(v.(int)) u.Set("instanceport", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["scheme"]; found { u.Set("scheme", v.(string)) } if v, found := p.p["sourceipaddress"]; found { u.Set("sourceipaddress", v.(string)) } if v, found := p.p["sourceipaddressnetworkid"]; found { u.Set("sourceipaddressnetworkid", v.(string)) } if v, found := p.p["sourceport"]; found { vv := strconv.Itoa(v.(int)) u.Set("sourceport", vv) } return u } func (p *CreateLoadBalancerParams) SetAlgorithm(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["algorithm"] = v return } func (p *CreateLoadBalancerParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateLoadBalancerParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateLoadBalancerParams) SetInstanceport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["instanceport"] = v return } func (p *CreateLoadBalancerParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateLoadBalancerParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *CreateLoadBalancerParams) SetScheme(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["scheme"] = v return } func (p *CreateLoadBalancerParams) SetSourceipaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sourceipaddress"] = v return } func (p *CreateLoadBalancerParams) SetSourceipaddressnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sourceipaddressnetworkid"] = v return } func (p *CreateLoadBalancerParams) SetSourceport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sourceport"] = v return } // You should always use this function to get a new CreateLoadBalancerParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewCreateLoadBalancerParams(algorithm string, instanceport int, name string, networkid string, scheme string, sourceipaddressnetworkid string, sourceport int) *CreateLoadBalancerParams { p := &CreateLoadBalancerParams{} p.p = make(map[string]interface{}) p.p["algorithm"] = algorithm p.p["instanceport"] = instanceport p.p["name"] = name p.p["networkid"] = networkid p.p["scheme"] = scheme p.p["sourceipaddressnetworkid"] = sourceipaddressnetworkid p.p["sourceport"] = sourceport return p } // Creates a load balancer func (s *LoadBalancerService) CreateLoadBalancer(p *CreateLoadBalancerParams) (*CreateLoadBalancerResponse, error) { resp, err := s.cs.newRequest("createLoadBalancer", p.toURLValues()) if err != nil { return nil, err } var r CreateLoadBalancerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateLoadBalancerResponse struct { Account string `json:"account"` Algorithm string `json:"algorithm"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Loadbalancerinstance []CreateLoadBalancerResponseLoadbalancerinstance `json:"loadbalancerinstance"` Loadbalancerrule []CreateLoadBalancerResponseLoadbalancerrule `json:"loadbalancerrule"` Name string `json:"name"` Networkid string `json:"networkid"` Project string `json:"project"` Projectid string `json:"projectid"` Sourceipaddress string `json:"sourceipaddress"` Sourceipaddressnetworkid string `json:"sourceipaddressnetworkid"` Tags []Tags `json:"tags"` } type CreateLoadBalancerResponseLoadbalancerrule struct { Instanceport int `json:"instanceport"` Sourceport int `json:"sourceport"` State string `json:"state"` } type CreateLoadBalancerResponseLoadbalancerinstance struct { Id string `json:"id"` Ipaddress string `json:"ipaddress"` Name string `json:"name"` State string `json:"state"` } type CreateLoadBalancerRuleParams struct { p map[string]interface{} } func (p *CreateLoadBalancerRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["algorithm"]; found { u.Set("algorithm", v.(string)) } if v, found := p.p["cidrlist"]; found { vv := strings.Join(v.([]string), ",") u.Set("cidrlist", vv) } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["openfirewall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("openfirewall", vv) } if v, found := p.p["privateport"]; found { vv := strconv.Itoa(v.(int)) u.Set("privateport", vv) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["publicipid"]; found { u.Set("publicipid", v.(string)) } if v, found := p.p["publicport"]; found { vv := strconv.Itoa(v.(int)) u.Set("publicport", vv) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreateLoadBalancerRuleParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateLoadBalancerRuleParams) SetAlgorithm(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["algorithm"] = v return } func (p *CreateLoadBalancerRuleParams) SetCidrlist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *CreateLoadBalancerRuleParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateLoadBalancerRuleParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateLoadBalancerRuleParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateLoadBalancerRuleParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateLoadBalancerRuleParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *CreateLoadBalancerRuleParams) SetOpenfirewall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["openfirewall"] = v return } func (p *CreateLoadBalancerRuleParams) SetPrivateport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["privateport"] = v return } func (p *CreateLoadBalancerRuleParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *CreateLoadBalancerRuleParams) SetPublicipid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publicipid"] = v return } func (p *CreateLoadBalancerRuleParams) SetPublicport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publicport"] = v return } func (p *CreateLoadBalancerRuleParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreateLoadBalancerRuleParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewCreateLoadBalancerRuleParams(algorithm string, name string, privateport int, publicport int) *CreateLoadBalancerRuleParams { p := &CreateLoadBalancerRuleParams{} p.p = make(map[string]interface{}) p.p["algorithm"] = algorithm p.p["name"] = name p.p["privateport"] = privateport p.p["publicport"] = publicport return p } // Creates a load balancer rule func (s *LoadBalancerService) CreateLoadBalancerRule(p *CreateLoadBalancerRuleParams) (*CreateLoadBalancerRuleResponse, error) { resp, err := s.cs.newRequest("createLoadBalancerRule", p.toURLValues()) if err != nil { return nil, err } var r CreateLoadBalancerRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateLoadBalancerRuleResponse struct { Account string `json:"account"` Algorithm string `json:"algorithm"` Cidrlist string `json:"cidrlist"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Networkid string `json:"networkid"` Privateport string `json:"privateport"` Project string `json:"project"` Projectid string `json:"projectid"` Protocol string `json:"protocol"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DeleteGlobalLoadBalancerRuleParams struct { p map[string]interface{} } func (p *DeleteGlobalLoadBalancerRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteGlobalLoadBalancerRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteGlobalLoadBalancerRuleParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewDeleteGlobalLoadBalancerRuleParams(id string) *DeleteGlobalLoadBalancerRuleParams { p := &DeleteGlobalLoadBalancerRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a global load balancer rule. func (s *LoadBalancerService) DeleteGlobalLoadBalancerRule(p *DeleteGlobalLoadBalancerRuleParams) (*DeleteGlobalLoadBalancerRuleResponse, error) { resp, err := s.cs.newRequest("deleteGlobalLoadBalancerRule", p.toURLValues()) if err != nil { return nil, err } var r DeleteGlobalLoadBalancerRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteGlobalLoadBalancerRuleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteLBHealthCheckPolicyParams struct { p map[string]interface{} } func (p *DeleteLBHealthCheckPolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteLBHealthCheckPolicyParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteLBHealthCheckPolicyParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewDeleteLBHealthCheckPolicyParams(id string) *DeleteLBHealthCheckPolicyParams { p := &DeleteLBHealthCheckPolicyParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a load balancer health check policy. func (s *LoadBalancerService) DeleteLBHealthCheckPolicy(p *DeleteLBHealthCheckPolicyParams) (*DeleteLBHealthCheckPolicyResponse, error) { resp, err := s.cs.newRequest("deleteLBHealthCheckPolicy", p.toURLValues()) if err != nil { return nil, err } var r DeleteLBHealthCheckPolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteLBHealthCheckPolicyResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteLBStickinessPolicyParams struct { p map[string]interface{} } func (p *DeleteLBStickinessPolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteLBStickinessPolicyParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteLBStickinessPolicyParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewDeleteLBStickinessPolicyParams(id string) *DeleteLBStickinessPolicyParams { p := &DeleteLBStickinessPolicyParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a load balancer stickiness policy. func (s *LoadBalancerService) DeleteLBStickinessPolicy(p *DeleteLBStickinessPolicyParams) (*DeleteLBStickinessPolicyResponse, error) { resp, err := s.cs.newRequest("deleteLBStickinessPolicy", p.toURLValues()) if err != nil { return nil, err } var r DeleteLBStickinessPolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteLBStickinessPolicyResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteLoadBalancerParams struct { p map[string]interface{} } func (p *DeleteLoadBalancerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteLoadBalancerParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteLoadBalancerParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewDeleteLoadBalancerParams(id string) *DeleteLoadBalancerParams { p := &DeleteLoadBalancerParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a load balancer func (s *LoadBalancerService) DeleteLoadBalancer(p *DeleteLoadBalancerParams) (*DeleteLoadBalancerResponse, error) { resp, err := s.cs.newRequest("deleteLoadBalancer", p.toURLValues()) if err != nil { return nil, err } var r DeleteLoadBalancerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteLoadBalancerResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteLoadBalancerRuleParams struct { p map[string]interface{} } func (p *DeleteLoadBalancerRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteLoadBalancerRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteLoadBalancerRuleParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewDeleteLoadBalancerRuleParams(id string) *DeleteLoadBalancerRuleParams { p := &DeleteLoadBalancerRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a load balancer rule. func (s *LoadBalancerService) DeleteLoadBalancerRule(p *DeleteLoadBalancerRuleParams) (*DeleteLoadBalancerRuleResponse, error) { resp, err := s.cs.newRequest("deleteLoadBalancerRule", p.toURLValues()) if err != nil { return nil, err } var r DeleteLoadBalancerRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteLoadBalancerRuleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteNetscalerLoadBalancerParams struct { p map[string]interface{} } func (p *DeleteNetscalerLoadBalancerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["lbdeviceid"]; found { u.Set("lbdeviceid", v.(string)) } return u } func (p *DeleteNetscalerLoadBalancerParams) SetLbdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbdeviceid"] = v return } // You should always use this function to get a new DeleteNetscalerLoadBalancerParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewDeleteNetscalerLoadBalancerParams(lbdeviceid string) *DeleteNetscalerLoadBalancerParams { p := &DeleteNetscalerLoadBalancerParams{} p.p = make(map[string]interface{}) p.p["lbdeviceid"] = lbdeviceid return p } // delete a netscaler load balancer device func (s *LoadBalancerService) DeleteNetscalerLoadBalancer(p *DeleteNetscalerLoadBalancerParams) (*DeleteNetscalerLoadBalancerResponse, error) { resp, err := s.cs.newRequest("deleteNetscalerLoadBalancer", p.toURLValues()) if err != nil { return nil, err } var r DeleteNetscalerLoadBalancerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteNetscalerLoadBalancerResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteSslCertParams struct { p map[string]interface{} } func (p *DeleteSslCertParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteSslCertParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteSslCertParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewDeleteSslCertParams(id string) *DeleteSslCertParams { p := &DeleteSslCertParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Delete a certificate to CloudStack func (s *LoadBalancerService) DeleteSslCert(p *DeleteSslCertParams) (*DeleteSslCertResponse, error) { resp, err := s.cs.newRequest("deleteSslCert", p.toURLValues()) if err != nil { return nil, err } var r DeleteSslCertResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteSslCertResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteSslCertResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteSslCertResponse return json.Unmarshal(b, (*alias)(r)) } type ListGlobalLoadBalancerRulesParams struct { p map[string]interface{} } func (p *ListGlobalLoadBalancerRulesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["regionid"]; found { vv := strconv.Itoa(v.(int)) u.Set("regionid", vv) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } return u } func (p *ListGlobalLoadBalancerRulesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListGlobalLoadBalancerRulesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListGlobalLoadBalancerRulesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListGlobalLoadBalancerRulesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListGlobalLoadBalancerRulesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListGlobalLoadBalancerRulesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListGlobalLoadBalancerRulesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListGlobalLoadBalancerRulesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListGlobalLoadBalancerRulesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListGlobalLoadBalancerRulesParams) SetRegionid(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["regionid"] = v return } func (p *ListGlobalLoadBalancerRulesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new ListGlobalLoadBalancerRulesParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewListGlobalLoadBalancerRulesParams() *ListGlobalLoadBalancerRulesParams { p := &ListGlobalLoadBalancerRulesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetGlobalLoadBalancerRuleID(keyword string, opts ...OptionFunc) (string, int, error) { p := &ListGlobalLoadBalancerRulesParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListGlobalLoadBalancerRules(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.GlobalLoadBalancerRules[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.GlobalLoadBalancerRules { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetGlobalLoadBalancerRuleByName(name string, opts ...OptionFunc) (*GlobalLoadBalancerRule, int, error) { id, count, err := s.GetGlobalLoadBalancerRuleID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetGlobalLoadBalancerRuleByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetGlobalLoadBalancerRuleByID(id string, opts ...OptionFunc) (*GlobalLoadBalancerRule, int, error) { p := &ListGlobalLoadBalancerRulesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListGlobalLoadBalancerRules(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.GlobalLoadBalancerRules[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for GlobalLoadBalancerRule UUID: %s!", id) } // Lists load balancer rules. func (s *LoadBalancerService) ListGlobalLoadBalancerRules(p *ListGlobalLoadBalancerRulesParams) (*ListGlobalLoadBalancerRulesResponse, error) { resp, err := s.cs.newRequest("listGlobalLoadBalancerRules", p.toURLValues()) if err != nil { return nil, err } var r ListGlobalLoadBalancerRulesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListGlobalLoadBalancerRulesResponse struct { Count int `json:"count"` GlobalLoadBalancerRules []*GlobalLoadBalancerRule `json:"globalloadbalancerrule"` } type GlobalLoadBalancerRule struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gslbdomainname string `json:"gslbdomainname"` Gslblbmethod string `json:"gslblbmethod"` Gslbservicetype string `json:"gslbservicetype"` Gslbstickysessionmethodname string `json:"gslbstickysessionmethodname"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Loadbalancerrule []GlobalLoadBalancerRuleLoadbalancerrule `json:"loadbalancerrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Regionid int `json:"regionid"` } type GlobalLoadBalancerRuleLoadbalancerrule struct { Account string `json:"account"` Algorithm string `json:"algorithm"` Cidrlist string `json:"cidrlist"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Name string `json:"name"` Networkid string `json:"networkid"` Privateport string `json:"privateport"` Project string `json:"project"` Projectid string `json:"projectid"` Protocol string `json:"protocol"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListLBHealthCheckPoliciesParams struct { p map[string]interface{} } func (p *ListLBHealthCheckPoliciesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["lbruleid"]; found { u.Set("lbruleid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListLBHealthCheckPoliciesParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListLBHealthCheckPoliciesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListLBHealthCheckPoliciesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListLBHealthCheckPoliciesParams) SetLbruleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbruleid"] = v return } func (p *ListLBHealthCheckPoliciesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListLBHealthCheckPoliciesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListLBHealthCheckPoliciesParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewListLBHealthCheckPoliciesParams() *ListLBHealthCheckPoliciesParams { p := &ListLBHealthCheckPoliciesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetLBHealthCheckPolicyByID(id string, opts ...OptionFunc) (*LBHealthCheckPolicy, int, error) { p := &ListLBHealthCheckPoliciesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListLBHealthCheckPolicies(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.LBHealthCheckPolicies[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for LBHealthCheckPolicy UUID: %s!", id) } // Lists load balancer health check policies. func (s *LoadBalancerService) ListLBHealthCheckPolicies(p *ListLBHealthCheckPoliciesParams) (*ListLBHealthCheckPoliciesResponse, error) { resp, err := s.cs.newRequest("listLBHealthCheckPolicies", p.toURLValues()) if err != nil { return nil, err } var r ListLBHealthCheckPoliciesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListLBHealthCheckPoliciesResponse struct { Count int `json:"count"` LBHealthCheckPolicies []*LBHealthCheckPolicy `json:"lbhealthcheckpolicy"` } type LBHealthCheckPolicy struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Healthcheckpolicy []LBHealthCheckPolicyHealthcheckpolicy `json:"healthcheckpolicy"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Zoneid string `json:"zoneid"` } type LBHealthCheckPolicyHealthcheckpolicy struct { Description string `json:"description"` Fordisplay bool `json:"fordisplay"` Healthcheckinterval int `json:"healthcheckinterval"` Healthcheckthresshold int `json:"healthcheckthresshold"` Id string `json:"id"` Pingpath string `json:"pingpath"` Responsetime int `json:"responsetime"` State string `json:"state"` Unhealthcheckthresshold int `json:"unhealthcheckthresshold"` } type ListLBStickinessPoliciesParams struct { p map[string]interface{} } func (p *ListLBStickinessPoliciesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["lbruleid"]; found { u.Set("lbruleid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListLBStickinessPoliciesParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListLBStickinessPoliciesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListLBStickinessPoliciesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListLBStickinessPoliciesParams) SetLbruleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbruleid"] = v return } func (p *ListLBStickinessPoliciesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListLBStickinessPoliciesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListLBStickinessPoliciesParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewListLBStickinessPoliciesParams() *ListLBStickinessPoliciesParams { p := &ListLBStickinessPoliciesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetLBStickinessPolicyByID(id string, opts ...OptionFunc) (*LBStickinessPolicy, int, error) { p := &ListLBStickinessPoliciesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListLBStickinessPolicies(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.LBStickinessPolicies[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for LBStickinessPolicy UUID: %s!", id) } // Lists load balancer stickiness policies. func (s *LoadBalancerService) ListLBStickinessPolicies(p *ListLBStickinessPoliciesParams) (*ListLBStickinessPoliciesResponse, error) { resp, err := s.cs.newRequest("listLBStickinessPolicies", p.toURLValues()) if err != nil { return nil, err } var r ListLBStickinessPoliciesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListLBStickinessPoliciesResponse struct { Count int `json:"count"` LBStickinessPolicies []*LBStickinessPolicy `json:"lbstickinesspolicy"` } type LBStickinessPolicy struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Name string `json:"name"` State string `json:"state"` Stickinesspolicy []LBStickinessPolicyStickinesspolicy `json:"stickinesspolicy"` Zoneid string `json:"zoneid"` } type LBStickinessPolicyStickinesspolicy struct { Description string `json:"description"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Methodname string `json:"methodname"` Name string `json:"name"` Params map[string]string `json:"params"` State string `json:"state"` } type ListLoadBalancerRuleInstancesParams struct { p map[string]interface{} } func (p *ListLoadBalancerRuleInstancesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["applied"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("applied", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["lbvmips"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("lbvmips", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListLoadBalancerRuleInstancesParams) SetApplied(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["applied"] = v return } func (p *ListLoadBalancerRuleInstancesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListLoadBalancerRuleInstancesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListLoadBalancerRuleInstancesParams) SetLbvmips(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbvmips"] = v return } func (p *ListLoadBalancerRuleInstancesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListLoadBalancerRuleInstancesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListLoadBalancerRuleInstancesParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewListLoadBalancerRuleInstancesParams(id string) *ListLoadBalancerRuleInstancesParams { p := &ListLoadBalancerRuleInstancesParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetLoadBalancerRuleInstanceByID(id string, opts ...OptionFunc) (*VirtualMachine, int, error) { p := &ListLoadBalancerRuleInstancesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListLoadBalancerRuleInstances(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.LoadBalancerRuleInstances[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for LoadBalancerRuleInstance UUID: %s!", id) } // List all virtual machine instances that are assigned to a load balancer rule. func (s *LoadBalancerService) ListLoadBalancerRuleInstances(p *ListLoadBalancerRuleInstancesParams) (*ListLoadBalancerRuleInstancesResponse, error) { resp, err := s.cs.newRequest("listLoadBalancerRuleInstances", p.toURLValues()) if err != nil { return nil, err } var r ListLoadBalancerRuleInstancesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListLoadBalancerRuleInstancesResponse struct { Count int `json:"count"` LBRuleVMIDIPs []*LoadBalancerRuleInstance `json:"lbrulevmidip"` LoadBalancerRuleInstances []*VirtualMachine `json:"loadbalancerruleinstance"` } type LoadBalancerRuleInstance struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbvmipaddresses []string `json:"lbvmipaddresses"` Loadbalancerruleinstance *VirtualMachine `json:"loadbalancerruleinstance"` } type ListLoadBalancerRulesParams struct { p map[string]interface{} } func (p *ListLoadBalancerRulesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["publicipid"]; found { u.Set("publicipid", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListLoadBalancerRulesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListLoadBalancerRulesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListLoadBalancerRulesParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListLoadBalancerRulesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListLoadBalancerRulesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListLoadBalancerRulesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListLoadBalancerRulesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListLoadBalancerRulesParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListLoadBalancerRulesParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListLoadBalancerRulesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListLoadBalancerRulesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListLoadBalancerRulesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListLoadBalancerRulesParams) SetPublicipid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publicipid"] = v return } func (p *ListLoadBalancerRulesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListLoadBalancerRulesParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } func (p *ListLoadBalancerRulesParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListLoadBalancerRulesParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewListLoadBalancerRulesParams() *ListLoadBalancerRulesParams { p := &ListLoadBalancerRulesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetLoadBalancerRuleID(name string, opts ...OptionFunc) (string, int, error) { p := &ListLoadBalancerRulesParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListLoadBalancerRules(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.LoadBalancerRules[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.LoadBalancerRules { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetLoadBalancerRuleByName(name string, opts ...OptionFunc) (*LoadBalancerRule, int, error) { id, count, err := s.GetLoadBalancerRuleID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetLoadBalancerRuleByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetLoadBalancerRuleByID(id string, opts ...OptionFunc) (*LoadBalancerRule, int, error) { p := &ListLoadBalancerRulesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListLoadBalancerRules(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.LoadBalancerRules[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for LoadBalancerRule UUID: %s!", id) } // Lists load balancer rules. func (s *LoadBalancerService) ListLoadBalancerRules(p *ListLoadBalancerRulesParams) (*ListLoadBalancerRulesResponse, error) { resp, err := s.cs.newRequest("listLoadBalancerRules", p.toURLValues()) if err != nil { return nil, err } var r ListLoadBalancerRulesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListLoadBalancerRulesResponse struct { Count int `json:"count"` LoadBalancerRules []*LoadBalancerRule `json:"loadbalancerrule"` } type LoadBalancerRule struct { Account string `json:"account"` Algorithm string `json:"algorithm"` Cidrlist string `json:"cidrlist"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Networkid string `json:"networkid"` Privateport string `json:"privateport"` Project string `json:"project"` Projectid string `json:"projectid"` Protocol string `json:"protocol"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListLoadBalancersParams struct { p map[string]interface{} } func (p *ListLoadBalancersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["scheme"]; found { u.Set("scheme", v.(string)) } if v, found := p.p["sourceipaddress"]; found { u.Set("sourceipaddress", v.(string)) } if v, found := p.p["sourceipaddressnetworkid"]; found { u.Set("sourceipaddressnetworkid", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } return u } func (p *ListLoadBalancersParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListLoadBalancersParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListLoadBalancersParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListLoadBalancersParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListLoadBalancersParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListLoadBalancersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListLoadBalancersParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListLoadBalancersParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListLoadBalancersParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListLoadBalancersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListLoadBalancersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListLoadBalancersParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListLoadBalancersParams) SetScheme(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["scheme"] = v return } func (p *ListLoadBalancersParams) SetSourceipaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sourceipaddress"] = v return } func (p *ListLoadBalancersParams) SetSourceipaddressnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sourceipaddressnetworkid"] = v return } func (p *ListLoadBalancersParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new ListLoadBalancersParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewListLoadBalancersParams() *ListLoadBalancersParams { p := &ListLoadBalancersParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetLoadBalancerID(name string, opts ...OptionFunc) (string, int, error) { p := &ListLoadBalancersParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListLoadBalancers(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.LoadBalancers[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.LoadBalancers { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetLoadBalancerByName(name string, opts ...OptionFunc) (*LoadBalancer, int, error) { id, count, err := s.GetLoadBalancerID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetLoadBalancerByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *LoadBalancerService) GetLoadBalancerByID(id string, opts ...OptionFunc) (*LoadBalancer, int, error) { p := &ListLoadBalancersParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListLoadBalancers(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.LoadBalancers[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for LoadBalancer UUID: %s!", id) } // Lists load balancers func (s *LoadBalancerService) ListLoadBalancers(p *ListLoadBalancersParams) (*ListLoadBalancersResponse, error) { resp, err := s.cs.newRequest("listLoadBalancers", p.toURLValues()) if err != nil { return nil, err } var r ListLoadBalancersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListLoadBalancersResponse struct { Count int `json:"count"` LoadBalancers []*LoadBalancer `json:"loadbalancer"` } type LoadBalancer struct { Account string `json:"account"` Algorithm string `json:"algorithm"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Loadbalancerinstance []LoadBalancerLoadbalancerinstance `json:"loadbalancerinstance"` Loadbalancerrule []LoadBalancerLoadbalancerrule `json:"loadbalancerrule"` Name string `json:"name"` Networkid string `json:"networkid"` Project string `json:"project"` Projectid string `json:"projectid"` Sourceipaddress string `json:"sourceipaddress"` Sourceipaddressnetworkid string `json:"sourceipaddressnetworkid"` Tags []Tags `json:"tags"` } type LoadBalancerLoadbalancerrule struct { Instanceport int `json:"instanceport"` Sourceport int `json:"sourceport"` State string `json:"state"` } type LoadBalancerLoadbalancerinstance struct { Id string `json:"id"` Ipaddress string `json:"ipaddress"` Name string `json:"name"` State string `json:"state"` } type ListNetscalerLoadBalancersParams struct { p map[string]interface{} } func (p *ListNetscalerLoadBalancersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["lbdeviceid"]; found { u.Set("lbdeviceid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } return u } func (p *ListNetscalerLoadBalancersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNetscalerLoadBalancersParams) SetLbdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbdeviceid"] = v return } func (p *ListNetscalerLoadBalancersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNetscalerLoadBalancersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListNetscalerLoadBalancersParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } // You should always use this function to get a new ListNetscalerLoadBalancersParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewListNetscalerLoadBalancersParams() *ListNetscalerLoadBalancersParams { p := &ListNetscalerLoadBalancersParams{} p.p = make(map[string]interface{}) return p } // lists netscaler load balancer devices func (s *LoadBalancerService) ListNetscalerLoadBalancers(p *ListNetscalerLoadBalancersParams) (*ListNetscalerLoadBalancersResponse, error) { resp, err := s.cs.newRequest("listNetscalerLoadBalancers", p.toURLValues()) if err != nil { return nil, err } var r ListNetscalerLoadBalancersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNetscalerLoadBalancersResponse struct { Count int `json:"count"` NetscalerLoadBalancers []*NetscalerLoadBalancer `json:"netscalerloadbalancer"` } type NetscalerLoadBalancer struct { Gslbprovider bool `json:"gslbprovider"` Gslbproviderprivateip string `json:"gslbproviderprivateip"` Gslbproviderpublicip string `json:"gslbproviderpublicip"` Ipaddress string `json:"ipaddress"` Isexclusivegslbprovider bool `json:"isexclusivegslbprovider"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbdevicecapacity int64 `json:"lbdevicecapacity"` Lbdevicededicated bool `json:"lbdevicededicated"` Lbdeviceid string `json:"lbdeviceid"` Lbdevicename string `json:"lbdevicename"` Lbdevicestate string `json:"lbdevicestate"` Physicalnetworkid string `json:"physicalnetworkid"` Podids []string `json:"podids"` Privateinterface string `json:"privateinterface"` Provider string `json:"provider"` Publicinterface string `json:"publicinterface"` } type ListSslCertsParams struct { p map[string]interface{} } func (p *ListSslCertsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["accountid"]; found { u.Set("accountid", v.(string)) } if v, found := p.p["certid"]; found { u.Set("certid", v.(string)) } if v, found := p.p["lbruleid"]; found { u.Set("lbruleid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *ListSslCertsParams) SetAccountid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountid"] = v return } func (p *ListSslCertsParams) SetCertid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["certid"] = v return } func (p *ListSslCertsParams) SetLbruleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbruleid"] = v return } func (p *ListSslCertsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new ListSslCertsParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewListSslCertsParams() *ListSslCertsParams { p := &ListSslCertsParams{} p.p = make(map[string]interface{}) return p } // Lists SSL certificates func (s *LoadBalancerService) ListSslCerts(p *ListSslCertsParams) (*ListSslCertsResponse, error) { resp, err := s.cs.newRequest("listSslCerts", p.toURLValues()) if err != nil { return nil, err } var r ListSslCertsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListSslCertsResponse struct { Count int `json:"count"` SslCerts []*SslCert `json:"sslcert"` } type SslCert struct { Account string `json:"account"` Certchain string `json:"certchain"` Certificate string `json:"certificate"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fingerprint string `json:"fingerprint"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Loadbalancerrulelist []string `json:"loadbalancerrulelist"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` } type RemoveCertFromLoadBalancerParams struct { p map[string]interface{} } func (p *RemoveCertFromLoadBalancerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["lbruleid"]; found { u.Set("lbruleid", v.(string)) } return u } func (p *RemoveCertFromLoadBalancerParams) SetLbruleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbruleid"] = v return } // You should always use this function to get a new RemoveCertFromLoadBalancerParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewRemoveCertFromLoadBalancerParams(lbruleid string) *RemoveCertFromLoadBalancerParams { p := &RemoveCertFromLoadBalancerParams{} p.p = make(map[string]interface{}) p.p["lbruleid"] = lbruleid return p } // Removes a certificate from a load balancer rule func (s *LoadBalancerService) RemoveCertFromLoadBalancer(p *RemoveCertFromLoadBalancerParams) (*RemoveCertFromLoadBalancerResponse, error) { resp, err := s.cs.newRequest("removeCertFromLoadBalancer", p.toURLValues()) if err != nil { return nil, err } var r RemoveCertFromLoadBalancerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RemoveCertFromLoadBalancerResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type RemoveFromGlobalLoadBalancerRuleParams struct { p map[string]interface{} } func (p *RemoveFromGlobalLoadBalancerRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["loadbalancerrulelist"]; found { vv := strings.Join(v.([]string), ",") u.Set("loadbalancerrulelist", vv) } return u } func (p *RemoveFromGlobalLoadBalancerRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *RemoveFromGlobalLoadBalancerRuleParams) SetLoadbalancerrulelist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["loadbalancerrulelist"] = v return } // You should always use this function to get a new RemoveFromGlobalLoadBalancerRuleParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewRemoveFromGlobalLoadBalancerRuleParams(id string, loadbalancerrulelist []string) *RemoveFromGlobalLoadBalancerRuleParams { p := &RemoveFromGlobalLoadBalancerRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["loadbalancerrulelist"] = loadbalancerrulelist return p } // Removes a load balancer rule association with global load balancer rule func (s *LoadBalancerService) RemoveFromGlobalLoadBalancerRule(p *RemoveFromGlobalLoadBalancerRuleParams) (*RemoveFromGlobalLoadBalancerRuleResponse, error) { resp, err := s.cs.newRequest("removeFromGlobalLoadBalancerRule", p.toURLValues()) if err != nil { return nil, err } var r RemoveFromGlobalLoadBalancerRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RemoveFromGlobalLoadBalancerRuleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type RemoveFromLoadBalancerRuleParams struct { p map[string]interface{} } func (p *RemoveFromLoadBalancerRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["virtualmachineids"]; found { vv := strings.Join(v.([]string), ",") u.Set("virtualmachineids", vv) } if v, found := p.p["vmidipmap"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("vmidipmap[%d].key", i), k) u.Set(fmt.Sprintf("vmidipmap[%d].value", i), m[k]) } } return u } func (p *RemoveFromLoadBalancerRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *RemoveFromLoadBalancerRuleParams) SetVirtualmachineids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineids"] = v return } func (p *RemoveFromLoadBalancerRuleParams) SetVmidipmap(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmidipmap"] = v return } // You should always use this function to get a new RemoveFromLoadBalancerRuleParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewRemoveFromLoadBalancerRuleParams(id string) *RemoveFromLoadBalancerRuleParams { p := &RemoveFromLoadBalancerRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Removes a virtual machine or a list of virtual machines from a load balancer rule. func (s *LoadBalancerService) RemoveFromLoadBalancerRule(p *RemoveFromLoadBalancerRuleParams) (*RemoveFromLoadBalancerRuleResponse, error) { resp, err := s.cs.newRequest("removeFromLoadBalancerRule", p.toURLValues()) if err != nil { return nil, err } var r RemoveFromLoadBalancerRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RemoveFromLoadBalancerRuleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type UpdateGlobalLoadBalancerRuleParams struct { p map[string]interface{} } func (p *UpdateGlobalLoadBalancerRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["gslblbmethod"]; found { u.Set("gslblbmethod", v.(string)) } if v, found := p.p["gslbstickysessionmethodname"]; found { u.Set("gslbstickysessionmethodname", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateGlobalLoadBalancerRuleParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *UpdateGlobalLoadBalancerRuleParams) SetGslblbmethod(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gslblbmethod"] = v return } func (p *UpdateGlobalLoadBalancerRuleParams) SetGslbstickysessionmethodname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gslbstickysessionmethodname"] = v return } func (p *UpdateGlobalLoadBalancerRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateGlobalLoadBalancerRuleParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewUpdateGlobalLoadBalancerRuleParams(id string) *UpdateGlobalLoadBalancerRuleParams { p := &UpdateGlobalLoadBalancerRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // update global load balancer rules. func (s *LoadBalancerService) UpdateGlobalLoadBalancerRule(p *UpdateGlobalLoadBalancerRuleParams) (*UpdateGlobalLoadBalancerRuleResponse, error) { resp, err := s.cs.newRequest("updateGlobalLoadBalancerRule", p.toURLValues()) if err != nil { return nil, err } var r UpdateGlobalLoadBalancerRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateGlobalLoadBalancerRuleResponse struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gslbdomainname string `json:"gslbdomainname"` Gslblbmethod string `json:"gslblbmethod"` Gslbservicetype string `json:"gslbservicetype"` Gslbstickysessionmethodname string `json:"gslbstickysessionmethodname"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Loadbalancerrule []UpdateGlobalLoadBalancerRuleResponseLoadbalancerrule `json:"loadbalancerrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Regionid int `json:"regionid"` } type UpdateGlobalLoadBalancerRuleResponseLoadbalancerrule struct { Account string `json:"account"` Algorithm string `json:"algorithm"` Cidrlist string `json:"cidrlist"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Name string `json:"name"` Networkid string `json:"networkid"` Privateport string `json:"privateport"` Project string `json:"project"` Projectid string `json:"projectid"` Protocol string `json:"protocol"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateLBHealthCheckPolicyParams struct { p map[string]interface{} } func (p *UpdateLBHealthCheckPolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateLBHealthCheckPolicyParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateLBHealthCheckPolicyParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateLBHealthCheckPolicyParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateLBHealthCheckPolicyParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewUpdateLBHealthCheckPolicyParams(id string) *UpdateLBHealthCheckPolicyParams { p := &UpdateLBHealthCheckPolicyParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates load balancer health check policy func (s *LoadBalancerService) UpdateLBHealthCheckPolicy(p *UpdateLBHealthCheckPolicyParams) (*UpdateLBHealthCheckPolicyResponse, error) { resp, err := s.cs.newRequest("updateLBHealthCheckPolicy", p.toURLValues()) if err != nil { return nil, err } var r UpdateLBHealthCheckPolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateLBHealthCheckPolicyResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Healthcheckpolicy []UpdateLBHealthCheckPolicyResponseHealthcheckpolicy `json:"healthcheckpolicy"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Zoneid string `json:"zoneid"` } type UpdateLBHealthCheckPolicyResponseHealthcheckpolicy struct { Description string `json:"description"` Fordisplay bool `json:"fordisplay"` Healthcheckinterval int `json:"healthcheckinterval"` Healthcheckthresshold int `json:"healthcheckthresshold"` Id string `json:"id"` Pingpath string `json:"pingpath"` Responsetime int `json:"responsetime"` State string `json:"state"` Unhealthcheckthresshold int `json:"unhealthcheckthresshold"` } type UpdateLBStickinessPolicyParams struct { p map[string]interface{} } func (p *UpdateLBStickinessPolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateLBStickinessPolicyParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateLBStickinessPolicyParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateLBStickinessPolicyParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateLBStickinessPolicyParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewUpdateLBStickinessPolicyParams(id string) *UpdateLBStickinessPolicyParams { p := &UpdateLBStickinessPolicyParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates load balancer stickiness policy func (s *LoadBalancerService) UpdateLBStickinessPolicy(p *UpdateLBStickinessPolicyParams) (*UpdateLBStickinessPolicyResponse, error) { resp, err := s.cs.newRequest("updateLBStickinessPolicy", p.toURLValues()) if err != nil { return nil, err } var r UpdateLBStickinessPolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateLBStickinessPolicyResponse struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lbruleid string `json:"lbruleid"` Name string `json:"name"` State string `json:"state"` Stickinesspolicy []UpdateLBStickinessPolicyResponseStickinesspolicy `json:"stickinesspolicy"` Zoneid string `json:"zoneid"` } type UpdateLBStickinessPolicyResponseStickinesspolicy struct { Description string `json:"description"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Methodname string `json:"methodname"` Name string `json:"name"` Params map[string]string `json:"params"` State string `json:"state"` } type UpdateLoadBalancerParams struct { p map[string]interface{} } func (p *UpdateLoadBalancerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateLoadBalancerParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateLoadBalancerParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateLoadBalancerParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateLoadBalancerParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewUpdateLoadBalancerParams(id string) *UpdateLoadBalancerParams { p := &UpdateLoadBalancerParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a load balancer func (s *LoadBalancerService) UpdateLoadBalancer(p *UpdateLoadBalancerParams) (*UpdateLoadBalancerResponse, error) { resp, err := s.cs.newRequest("updateLoadBalancer", p.toURLValues()) if err != nil { return nil, err } var r UpdateLoadBalancerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateLoadBalancerResponse struct { Account string `json:"account"` Algorithm string `json:"algorithm"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Loadbalancerinstance []UpdateLoadBalancerResponseLoadbalancerinstance `json:"loadbalancerinstance"` Loadbalancerrule []UpdateLoadBalancerResponseLoadbalancerrule `json:"loadbalancerrule"` Name string `json:"name"` Networkid string `json:"networkid"` Project string `json:"project"` Projectid string `json:"projectid"` Sourceipaddress string `json:"sourceipaddress"` Sourceipaddressnetworkid string `json:"sourceipaddressnetworkid"` Tags []Tags `json:"tags"` } type UpdateLoadBalancerResponseLoadbalancerrule struct { Instanceport int `json:"instanceport"` Sourceport int `json:"sourceport"` State string `json:"state"` } type UpdateLoadBalancerResponseLoadbalancerinstance struct { Id string `json:"id"` Ipaddress string `json:"ipaddress"` Name string `json:"name"` State string `json:"state"` } type UpdateLoadBalancerRuleParams struct { p map[string]interface{} } func (p *UpdateLoadBalancerRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["algorithm"]; found { u.Set("algorithm", v.(string)) } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } return u } func (p *UpdateLoadBalancerRuleParams) SetAlgorithm(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["algorithm"] = v return } func (p *UpdateLoadBalancerRuleParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateLoadBalancerRuleParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *UpdateLoadBalancerRuleParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateLoadBalancerRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateLoadBalancerRuleParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateLoadBalancerRuleParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } // You should always use this function to get a new UpdateLoadBalancerRuleParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewUpdateLoadBalancerRuleParams(id string) *UpdateLoadBalancerRuleParams { p := &UpdateLoadBalancerRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates load balancer func (s *LoadBalancerService) UpdateLoadBalancerRule(p *UpdateLoadBalancerRuleParams) (*UpdateLoadBalancerRuleResponse, error) { resp, err := s.cs.newRequest("updateLoadBalancerRule", p.toURLValues()) if err != nil { return nil, err } var r UpdateLoadBalancerRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateLoadBalancerRuleResponse struct { Account string `json:"account"` Algorithm string `json:"algorithm"` Cidrlist string `json:"cidrlist"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Networkid string `json:"networkid"` Privateport string `json:"privateport"` Project string `json:"project"` Projectid string `json:"projectid"` Protocol string `json:"protocol"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UploadSslCertParams struct { p map[string]interface{} } func (p *UploadSslCertParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["certchain"]; found { u.Set("certchain", v.(string)) } if v, found := p.p["certificate"]; found { u.Set("certificate", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["privatekey"]; found { u.Set("privatekey", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *UploadSslCertParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *UploadSslCertParams) SetCertchain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["certchain"] = v return } func (p *UploadSslCertParams) SetCertificate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["certificate"] = v return } func (p *UploadSslCertParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *UploadSslCertParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UploadSslCertParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *UploadSslCertParams) SetPrivatekey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["privatekey"] = v return } func (p *UploadSslCertParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new UploadSslCertParams instance, // as then you are sure you have configured all required params func (s *LoadBalancerService) NewUploadSslCertParams(certificate string, name string, privatekey string) *UploadSslCertParams { p := &UploadSslCertParams{} p.p = make(map[string]interface{}) p.p["certificate"] = certificate p.p["name"] = name p.p["privatekey"] = privatekey return p } // Upload a certificate to CloudStack func (s *LoadBalancerService) UploadSslCert(p *UploadSslCertParams) (*UploadSslCertResponse, error) { resp, err := s.cs.newRequest("uploadSslCert", p.toURLValues()) if err != nil { return nil, err } var r UploadSslCertResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UploadSslCertResponse struct { Account string `json:"account"` Certchain string `json:"certchain"` Certificate string `json:"certificate"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fingerprint string `json:"fingerprint"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Loadbalancerrulelist []string `json:"loadbalancerrulelist"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` } go-cloudstack-2.9.0/cloudstack/NATService.go000066400000000000000000000400571364073403100207160ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateIpForwardingRuleParams struct { p map[string]interface{} } func (p *CreateIpForwardingRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["cidrlist"]; found { vv := strings.Join(v.([]string), ",") u.Set("cidrlist", vv) } if v, found := p.p["endport"]; found { vv := strconv.Itoa(v.(int)) u.Set("endport", vv) } if v, found := p.p["ipaddressid"]; found { u.Set("ipaddressid", v.(string)) } if v, found := p.p["openfirewall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("openfirewall", vv) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["startport"]; found { vv := strconv.Itoa(v.(int)) u.Set("startport", vv) } return u } func (p *CreateIpForwardingRuleParams) SetCidrlist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *CreateIpForwardingRuleParams) SetEndport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endport"] = v return } func (p *CreateIpForwardingRuleParams) SetIpaddressid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddressid"] = v return } func (p *CreateIpForwardingRuleParams) SetOpenfirewall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["openfirewall"] = v return } func (p *CreateIpForwardingRuleParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *CreateIpForwardingRuleParams) SetStartport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startport"] = v return } // You should always use this function to get a new CreateIpForwardingRuleParams instance, // as then you are sure you have configured all required params func (s *NATService) NewCreateIpForwardingRuleParams(ipaddressid string, protocol string, startport int) *CreateIpForwardingRuleParams { p := &CreateIpForwardingRuleParams{} p.p = make(map[string]interface{}) p.p["ipaddressid"] = ipaddressid p.p["protocol"] = protocol p.p["startport"] = startport return p } // Creates an IP forwarding rule func (s *NATService) CreateIpForwardingRule(p *CreateIpForwardingRuleParams) (*CreateIpForwardingRuleResponse, error) { resp, err := s.cs.newRequest("createIpForwardingRule", p.toURLValues()) if err != nil { return nil, err } var r CreateIpForwardingRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateIpForwardingRuleResponse struct { Cidrlist string `json:"cidrlist"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Privateendport string `json:"privateendport"` Privateport string `json:"privateport"` Protocol string `json:"protocol"` Publicendport string `json:"publicendport"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualmachinedisplayname string `json:"virtualmachinedisplayname"` Virtualmachineid string `json:"virtualmachineid"` Virtualmachinename string `json:"virtualmachinename"` Vmguestip string `json:"vmguestip"` } type DeleteIpForwardingRuleParams struct { p map[string]interface{} } func (p *DeleteIpForwardingRuleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteIpForwardingRuleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteIpForwardingRuleParams instance, // as then you are sure you have configured all required params func (s *NATService) NewDeleteIpForwardingRuleParams(id string) *DeleteIpForwardingRuleParams { p := &DeleteIpForwardingRuleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes an IP forwarding rule func (s *NATService) DeleteIpForwardingRule(p *DeleteIpForwardingRuleParams) (*DeleteIpForwardingRuleResponse, error) { resp, err := s.cs.newRequest("deleteIpForwardingRule", p.toURLValues()) if err != nil { return nil, err } var r DeleteIpForwardingRuleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteIpForwardingRuleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DisableStaticNatParams struct { p map[string]interface{} } func (p *DisableStaticNatParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["ipaddressid"]; found { u.Set("ipaddressid", v.(string)) } return u } func (p *DisableStaticNatParams) SetIpaddressid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddressid"] = v return } // You should always use this function to get a new DisableStaticNatParams instance, // as then you are sure you have configured all required params func (s *NATService) NewDisableStaticNatParams(ipaddressid string) *DisableStaticNatParams { p := &DisableStaticNatParams{} p.p = make(map[string]interface{}) p.p["ipaddressid"] = ipaddressid return p } // Disables static rule for given IP address func (s *NATService) DisableStaticNat(p *DisableStaticNatParams) (*DisableStaticNatResponse, error) { resp, err := s.cs.newRequest("disableStaticNat", p.toURLValues()) if err != nil { return nil, err } var r DisableStaticNatResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DisableStaticNatResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type EnableStaticNatParams struct { p map[string]interface{} } func (p *EnableStaticNatParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["ipaddressid"]; found { u.Set("ipaddressid", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } if v, found := p.p["vmguestip"]; found { u.Set("vmguestip", v.(string)) } return u } func (p *EnableStaticNatParams) SetIpaddressid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddressid"] = v return } func (p *EnableStaticNatParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *EnableStaticNatParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } func (p *EnableStaticNatParams) SetVmguestip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmguestip"] = v return } // You should always use this function to get a new EnableStaticNatParams instance, // as then you are sure you have configured all required params func (s *NATService) NewEnableStaticNatParams(ipaddressid string, virtualmachineid string) *EnableStaticNatParams { p := &EnableStaticNatParams{} p.p = make(map[string]interface{}) p.p["ipaddressid"] = ipaddressid p.p["virtualmachineid"] = virtualmachineid return p } // Enables static NAT for given IP address func (s *NATService) EnableStaticNat(p *EnableStaticNatParams) (*EnableStaticNatResponse, error) { resp, err := s.cs.newRequest("enableStaticNat", p.toURLValues()) if err != nil { return nil, err } var r EnableStaticNatResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type EnableStaticNatResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *EnableStaticNatResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias EnableStaticNatResponse return json.Unmarshal(b, (*alias)(r)) } type ListIpForwardingRulesParams struct { p map[string]interface{} } func (p *ListIpForwardingRulesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ipaddressid"]; found { u.Set("ipaddressid", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *ListIpForwardingRulesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListIpForwardingRulesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListIpForwardingRulesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListIpForwardingRulesParams) SetIpaddressid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddressid"] = v return } func (p *ListIpForwardingRulesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListIpForwardingRulesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListIpForwardingRulesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListIpForwardingRulesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListIpForwardingRulesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListIpForwardingRulesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListIpForwardingRulesParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new ListIpForwardingRulesParams instance, // as then you are sure you have configured all required params func (s *NATService) NewListIpForwardingRulesParams() *ListIpForwardingRulesParams { p := &ListIpForwardingRulesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NATService) GetIpForwardingRuleByID(id string, opts ...OptionFunc) (*IpForwardingRule, int, error) { p := &ListIpForwardingRulesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListIpForwardingRules(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.IpForwardingRules[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for IpForwardingRule UUID: %s!", id) } // List the IP forwarding rules func (s *NATService) ListIpForwardingRules(p *ListIpForwardingRulesParams) (*ListIpForwardingRulesResponse, error) { resp, err := s.cs.newRequest("listIpForwardingRules", p.toURLValues()) if err != nil { return nil, err } var r ListIpForwardingRulesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListIpForwardingRulesResponse struct { Count int `json:"count"` IpForwardingRules []*IpForwardingRule `json:"ipforwardingrule"` } type IpForwardingRule struct { Cidrlist string `json:"cidrlist"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Ipaddressid string `json:"ipaddressid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Privateendport string `json:"privateendport"` Privateport string `json:"privateport"` Protocol string `json:"protocol"` Publicendport string `json:"publicendport"` Publicport string `json:"publicport"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualmachinedisplayname string `json:"virtualmachinedisplayname"` Virtualmachineid string `json:"virtualmachineid"` Virtualmachinename string `json:"virtualmachinename"` Vmguestip string `json:"vmguestip"` } go-cloudstack-2.9.0/cloudstack/NetworkACLService.go000066400000000000000000001035301364073403100222410ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateNetworkACLParams struct { p map[string]interface{} } func (p *CreateNetworkACLParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["aclid"]; found { u.Set("aclid", v.(string)) } if v, found := p.p["action"]; found { u.Set("action", v.(string)) } if v, found := p.p["cidrlist"]; found { vv := strings.Join(v.([]string), ",") u.Set("cidrlist", vv) } if v, found := p.p["endport"]; found { vv := strconv.Itoa(v.(int)) u.Set("endport", vv) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["icmpcode"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmpcode", vv) } if v, found := p.p["icmptype"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmptype", vv) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["number"]; found { vv := strconv.Itoa(v.(int)) u.Set("number", vv) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["reason"]; found { u.Set("reason", v.(string)) } if v, found := p.p["startport"]; found { vv := strconv.Itoa(v.(int)) u.Set("startport", vv) } if v, found := p.p["traffictype"]; found { u.Set("traffictype", v.(string)) } return u } func (p *CreateNetworkACLParams) SetAclid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["aclid"] = v return } func (p *CreateNetworkACLParams) SetAction(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["action"] = v return } func (p *CreateNetworkACLParams) SetCidrlist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *CreateNetworkACLParams) SetEndport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endport"] = v return } func (p *CreateNetworkACLParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateNetworkACLParams) SetIcmpcode(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmpcode"] = v return } func (p *CreateNetworkACLParams) SetIcmptype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmptype"] = v return } func (p *CreateNetworkACLParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *CreateNetworkACLParams) SetNumber(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["number"] = v return } func (p *CreateNetworkACLParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *CreateNetworkACLParams) SetReason(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["reason"] = v return } func (p *CreateNetworkACLParams) SetStartport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startport"] = v return } func (p *CreateNetworkACLParams) SetTraffictype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["traffictype"] = v return } // You should always use this function to get a new CreateNetworkACLParams instance, // as then you are sure you have configured all required params func (s *NetworkACLService) NewCreateNetworkACLParams(protocol string) *CreateNetworkACLParams { p := &CreateNetworkACLParams{} p.p = make(map[string]interface{}) p.p["protocol"] = protocol return p } // Creates a ACL rule in the given network (the network has to belong to VPC) func (s *NetworkACLService) CreateNetworkACL(p *CreateNetworkACLParams) (*CreateNetworkACLResponse, error) { resp, err := s.cs.newRequest("createNetworkACL", p.toURLValues()) if err != nil { return nil, err } var r CreateNetworkACLResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateNetworkACLResponse struct { Aclid string `json:"aclid"` Action string `json:"action"` Cidrlist string `json:"cidrlist"` Endport string `json:"endport"` Fordisplay bool `json:"fordisplay"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Number int `json:"number"` Protocol string `json:"protocol"` Reason string `json:"reason"` Startport string `json:"startport"` State string `json:"state"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` } type CreateNetworkACLListParams struct { p map[string]interface{} } func (p *CreateNetworkACLListParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } return u } func (p *CreateNetworkACLListParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateNetworkACLListParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateNetworkACLListParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateNetworkACLListParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } // You should always use this function to get a new CreateNetworkACLListParams instance, // as then you are sure you have configured all required params func (s *NetworkACLService) NewCreateNetworkACLListParams(name string, vpcid string) *CreateNetworkACLListParams { p := &CreateNetworkACLListParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["vpcid"] = vpcid return p } // Creates a network ACL for the given VPC func (s *NetworkACLService) CreateNetworkACLList(p *CreateNetworkACLListParams) (*CreateNetworkACLListResponse, error) { resp, err := s.cs.newRequest("createNetworkACLList", p.toURLValues()) if err != nil { return nil, err } var r CreateNetworkACLListResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateNetworkACLListResponse struct { Description string `json:"description"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Vpcid string `json:"vpcid"` } type DeleteNetworkACLParams struct { p map[string]interface{} } func (p *DeleteNetworkACLParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteNetworkACLParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteNetworkACLParams instance, // as then you are sure you have configured all required params func (s *NetworkACLService) NewDeleteNetworkACLParams(id string) *DeleteNetworkACLParams { p := &DeleteNetworkACLParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a network ACL func (s *NetworkACLService) DeleteNetworkACL(p *DeleteNetworkACLParams) (*DeleteNetworkACLResponse, error) { resp, err := s.cs.newRequest("deleteNetworkACL", p.toURLValues()) if err != nil { return nil, err } var r DeleteNetworkACLResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteNetworkACLResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteNetworkACLListParams struct { p map[string]interface{} } func (p *DeleteNetworkACLListParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteNetworkACLListParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteNetworkACLListParams instance, // as then you are sure you have configured all required params func (s *NetworkACLService) NewDeleteNetworkACLListParams(id string) *DeleteNetworkACLListParams { p := &DeleteNetworkACLListParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a network ACL func (s *NetworkACLService) DeleteNetworkACLList(p *DeleteNetworkACLListParams) (*DeleteNetworkACLListResponse, error) { resp, err := s.cs.newRequest("deleteNetworkACLList", p.toURLValues()) if err != nil { return nil, err } var r DeleteNetworkACLListResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteNetworkACLListResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListNetworkACLListsParams struct { p map[string]interface{} } func (p *ListNetworkACLListsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } return u } func (p *ListNetworkACLListsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListNetworkACLListsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListNetworkACLListsParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListNetworkACLListsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListNetworkACLListsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListNetworkACLListsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNetworkACLListsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListNetworkACLListsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListNetworkACLListsParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListNetworkACLListsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNetworkACLListsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListNetworkACLListsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListNetworkACLListsParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } // You should always use this function to get a new ListNetworkACLListsParams instance, // as then you are sure you have configured all required params func (s *NetworkACLService) NewListNetworkACLListsParams() *ListNetworkACLListsParams { p := &ListNetworkACLListsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkACLService) GetNetworkACLListID(name string, opts ...OptionFunc) (string, int, error) { p := &ListNetworkACLListsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListNetworkACLLists(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.NetworkACLLists[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.NetworkACLLists { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkACLService) GetNetworkACLListByName(name string, opts ...OptionFunc) (*NetworkACLList, int, error) { id, count, err := s.GetNetworkACLListID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetNetworkACLListByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkACLService) GetNetworkACLListByID(id string, opts ...OptionFunc) (*NetworkACLList, int, error) { p := &ListNetworkACLListsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListNetworkACLLists(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.NetworkACLLists[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for NetworkACLList UUID: %s!", id) } // Lists all network ACLs func (s *NetworkACLService) ListNetworkACLLists(p *ListNetworkACLListsParams) (*ListNetworkACLListsResponse, error) { resp, err := s.cs.newRequest("listNetworkACLLists", p.toURLValues()) if err != nil { return nil, err } var r ListNetworkACLListsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNetworkACLListsResponse struct { Count int `json:"count"` NetworkACLLists []*NetworkACLList `json:"networkacllist"` } type NetworkACLList struct { Description string `json:"description"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Vpcid string `json:"vpcid"` } type ListNetworkACLsParams struct { p map[string]interface{} } func (p *ListNetworkACLsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["aclid"]; found { u.Set("aclid", v.(string)) } if v, found := p.p["action"]; found { u.Set("action", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["traffictype"]; found { u.Set("traffictype", v.(string)) } return u } func (p *ListNetworkACLsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListNetworkACLsParams) SetAclid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["aclid"] = v return } func (p *ListNetworkACLsParams) SetAction(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["action"] = v return } func (p *ListNetworkACLsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListNetworkACLsParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListNetworkACLsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListNetworkACLsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListNetworkACLsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNetworkACLsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListNetworkACLsParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListNetworkACLsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNetworkACLsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListNetworkACLsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListNetworkACLsParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *ListNetworkACLsParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListNetworkACLsParams) SetTraffictype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["traffictype"] = v return } // You should always use this function to get a new ListNetworkACLsParams instance, // as then you are sure you have configured all required params func (s *NetworkACLService) NewListNetworkACLsParams() *ListNetworkACLsParams { p := &ListNetworkACLsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkACLService) GetNetworkACLByID(id string, opts ...OptionFunc) (*NetworkACL, int, error) { p := &ListNetworkACLsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListNetworkACLs(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.NetworkACLs[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for NetworkACL UUID: %s!", id) } // Lists all network ACL items func (s *NetworkACLService) ListNetworkACLs(p *ListNetworkACLsParams) (*ListNetworkACLsResponse, error) { resp, err := s.cs.newRequest("listNetworkACLs", p.toURLValues()) if err != nil { return nil, err } var r ListNetworkACLsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNetworkACLsResponse struct { Count int `json:"count"` NetworkACLs []*NetworkACL `json:"networkacl"` } type NetworkACL struct { Aclid string `json:"aclid"` Action string `json:"action"` Cidrlist string `json:"cidrlist"` Endport string `json:"endport"` Fordisplay bool `json:"fordisplay"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Number int `json:"number"` Protocol string `json:"protocol"` Reason string `json:"reason"` Startport string `json:"startport"` State string `json:"state"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` } type ReplaceNetworkACLListParams struct { p map[string]interface{} } func (p *ReplaceNetworkACLListParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["aclid"]; found { u.Set("aclid", v.(string)) } if v, found := p.p["gatewayid"]; found { u.Set("gatewayid", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } return u } func (p *ReplaceNetworkACLListParams) SetAclid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["aclid"] = v return } func (p *ReplaceNetworkACLListParams) SetGatewayid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gatewayid"] = v return } func (p *ReplaceNetworkACLListParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } // You should always use this function to get a new ReplaceNetworkACLListParams instance, // as then you are sure you have configured all required params func (s *NetworkACLService) NewReplaceNetworkACLListParams(aclid string) *ReplaceNetworkACLListParams { p := &ReplaceNetworkACLListParams{} p.p = make(map[string]interface{}) p.p["aclid"] = aclid return p } // Replaces ACL associated with a network or private gateway func (s *NetworkACLService) ReplaceNetworkACLList(p *ReplaceNetworkACLListParams) (*ReplaceNetworkACLListResponse, error) { resp, err := s.cs.newRequest("replaceNetworkACLList", p.toURLValues()) if err != nil { return nil, err } var r ReplaceNetworkACLListResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ReplaceNetworkACLListResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type UpdateNetworkACLItemParams struct { p map[string]interface{} } func (p *UpdateNetworkACLItemParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["action"]; found { u.Set("action", v.(string)) } if v, found := p.p["cidrlist"]; found { vv := strings.Join(v.([]string), ",") u.Set("cidrlist", vv) } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["endport"]; found { vv := strconv.Itoa(v.(int)) u.Set("endport", vv) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["icmpcode"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmpcode", vv) } if v, found := p.p["icmptype"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmptype", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["number"]; found { vv := strconv.Itoa(v.(int)) u.Set("number", vv) } if v, found := p.p["partialupgrade"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("partialupgrade", vv) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["reason"]; found { u.Set("reason", v.(string)) } if v, found := p.p["startport"]; found { vv := strconv.Itoa(v.(int)) u.Set("startport", vv) } if v, found := p.p["traffictype"]; found { u.Set("traffictype", v.(string)) } return u } func (p *UpdateNetworkACLItemParams) SetAction(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["action"] = v return } func (p *UpdateNetworkACLItemParams) SetCidrlist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *UpdateNetworkACLItemParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateNetworkACLItemParams) SetEndport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endport"] = v return } func (p *UpdateNetworkACLItemParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateNetworkACLItemParams) SetIcmpcode(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmpcode"] = v return } func (p *UpdateNetworkACLItemParams) SetIcmptype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmptype"] = v return } func (p *UpdateNetworkACLItemParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateNetworkACLItemParams) SetNumber(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["number"] = v return } func (p *UpdateNetworkACLItemParams) SetPartialupgrade(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["partialupgrade"] = v return } func (p *UpdateNetworkACLItemParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *UpdateNetworkACLItemParams) SetReason(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["reason"] = v return } func (p *UpdateNetworkACLItemParams) SetStartport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startport"] = v return } func (p *UpdateNetworkACLItemParams) SetTraffictype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["traffictype"] = v return } // You should always use this function to get a new UpdateNetworkACLItemParams instance, // as then you are sure you have configured all required params func (s *NetworkACLService) NewUpdateNetworkACLItemParams(id string) *UpdateNetworkACLItemParams { p := &UpdateNetworkACLItemParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates ACL item with specified ID func (s *NetworkACLService) UpdateNetworkACLItem(p *UpdateNetworkACLItemParams) (*UpdateNetworkACLItemResponse, error) { resp, err := s.cs.newRequest("updateNetworkACLItem", p.toURLValues()) if err != nil { return nil, err } var r UpdateNetworkACLItemResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateNetworkACLItemResponse struct { Aclid string `json:"aclid"` Action string `json:"action"` Cidrlist string `json:"cidrlist"` Endport string `json:"endport"` Fordisplay bool `json:"fordisplay"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Number int `json:"number"` Protocol string `json:"protocol"` Reason string `json:"reason"` Startport string `json:"startport"` State string `json:"state"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` } type UpdateNetworkACLListParams struct { p map[string]interface{} } func (p *UpdateNetworkACLListParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } return u } func (p *UpdateNetworkACLListParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateNetworkACLListParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *UpdateNetworkACLListParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateNetworkACLListParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateNetworkACLListParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } // You should always use this function to get a new UpdateNetworkACLListParams instance, // as then you are sure you have configured all required params func (s *NetworkACLService) NewUpdateNetworkACLListParams(id string) *UpdateNetworkACLListParams { p := &UpdateNetworkACLListParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates network ACL list func (s *NetworkACLService) UpdateNetworkACLList(p *UpdateNetworkACLListParams) (*UpdateNetworkACLListResponse, error) { resp, err := s.cs.newRequest("updateNetworkACLList", p.toURLValues()) if err != nil { return nil, err } var r UpdateNetworkACLListResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateNetworkACLListResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } go-cloudstack-2.9.0/cloudstack/NetworkDeviceService.go000066400000000000000000000155011364073403100230410ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" ) type AddNetworkDeviceParams struct { p map[string]interface{} } func (p *AddNetworkDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["networkdeviceparameterlist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].key", i), k) u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].value", i), m[k]) } } if v, found := p.p["networkdevicetype"]; found { u.Set("networkdevicetype", v.(string)) } return u } func (p *AddNetworkDeviceParams) SetNetworkdeviceparameterlist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdeviceparameterlist"] = v return } func (p *AddNetworkDeviceParams) SetNetworkdevicetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdevicetype"] = v return } // You should always use this function to get a new AddNetworkDeviceParams instance, // as then you are sure you have configured all required params func (s *NetworkDeviceService) NewAddNetworkDeviceParams() *AddNetworkDeviceParams { p := &AddNetworkDeviceParams{} p.p = make(map[string]interface{}) return p } // Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer func (s *NetworkDeviceService) AddNetworkDevice(p *AddNetworkDeviceParams) (*AddNetworkDeviceResponse, error) { resp, err := s.cs.newRequest("addNetworkDevice", p.toURLValues()) if err != nil { return nil, err } var r AddNetworkDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddNetworkDeviceResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } type DeleteNetworkDeviceParams struct { p map[string]interface{} } func (p *DeleteNetworkDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteNetworkDeviceParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteNetworkDeviceParams instance, // as then you are sure you have configured all required params func (s *NetworkDeviceService) NewDeleteNetworkDeviceParams(id string) *DeleteNetworkDeviceParams { p := &DeleteNetworkDeviceParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes network device. func (s *NetworkDeviceService) DeleteNetworkDevice(p *DeleteNetworkDeviceParams) (*DeleteNetworkDeviceResponse, error) { resp, err := s.cs.newRequest("deleteNetworkDevice", p.toURLValues()) if err != nil { return nil, err } var r DeleteNetworkDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteNetworkDeviceResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteNetworkDeviceResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteNetworkDeviceResponse return json.Unmarshal(b, (*alias)(r)) } type ListNetworkDeviceParams struct { p map[string]interface{} } func (p *ListNetworkDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["networkdeviceparameterlist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].key", i), k) u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].value", i), m[k]) } } if v, found := p.p["networkdevicetype"]; found { u.Set("networkdevicetype", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListNetworkDeviceParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNetworkDeviceParams) SetNetworkdeviceparameterlist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdeviceparameterlist"] = v return } func (p *ListNetworkDeviceParams) SetNetworkdevicetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdevicetype"] = v return } func (p *ListNetworkDeviceParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNetworkDeviceParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListNetworkDeviceParams instance, // as then you are sure you have configured all required params func (s *NetworkDeviceService) NewListNetworkDeviceParams() *ListNetworkDeviceParams { p := &ListNetworkDeviceParams{} p.p = make(map[string]interface{}) return p } // List network devices func (s *NetworkDeviceService) ListNetworkDevice(p *ListNetworkDeviceParams) (*ListNetworkDeviceResponse, error) { resp, err := s.cs.newRequest("listNetworkDevice", p.toURLValues()) if err != nil { return nil, err } var r ListNetworkDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNetworkDeviceResponse struct { Count int `json:"count"` NetworkDevice []*NetworkDevice `json:"networkdevice"` } type NetworkDevice struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } go-cloudstack-2.9.0/cloudstack/NetworkOfferingService.go000066400000000000000000000727741364073403100234200ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateNetworkOfferingParams struct { p map[string]interface{} } func (p *CreateNetworkOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["availability"]; found { u.Set("availability", v.(string)) } if v, found := p.p["conservemode"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("conservemode", vv) } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["egressdefaultpolicy"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("egressdefaultpolicy", vv) } if v, found := p.p["forvpc"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forvpc", vv) } if v, found := p.p["guestiptype"]; found { u.Set("guestiptype", v.(string)) } if v, found := p.p["ispersistent"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("ispersistent", vv) } if v, found := p.p["keepaliveenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("keepaliveenabled", vv) } if v, found := p.p["maxconnections"]; found { vv := strconv.Itoa(v.(int)) u.Set("maxconnections", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkrate"]; found { vv := strconv.Itoa(v.(int)) u.Set("networkrate", vv) } if v, found := p.p["servicecapabilitylist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("servicecapabilitylist[%d].key", i), k) u.Set(fmt.Sprintf("servicecapabilitylist[%d].value", i), m[k]) } } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } if v, found := p.p["serviceproviderlist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("serviceproviderlist[%d].service", i), k) u.Set(fmt.Sprintf("serviceproviderlist[%d].provider", i), m[k]) } } if v, found := p.p["specifyipranges"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("specifyipranges", vv) } if v, found := p.p["specifyvlan"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("specifyvlan", vv) } if v, found := p.p["supportedservices"]; found { vv := strings.Join(v.([]string), ",") u.Set("supportedservices", vv) } if v, found := p.p["tags"]; found { u.Set("tags", v.(string)) } if v, found := p.p["traffictype"]; found { u.Set("traffictype", v.(string)) } return u } func (p *CreateNetworkOfferingParams) SetAvailability(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["availability"] = v return } func (p *CreateNetworkOfferingParams) SetConservemode(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["conservemode"] = v return } func (p *CreateNetworkOfferingParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *CreateNetworkOfferingParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *CreateNetworkOfferingParams) SetEgressdefaultpolicy(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["egressdefaultpolicy"] = v return } func (p *CreateNetworkOfferingParams) SetForvpc(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forvpc"] = v return } func (p *CreateNetworkOfferingParams) SetGuestiptype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["guestiptype"] = v return } func (p *CreateNetworkOfferingParams) SetIspersistent(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ispersistent"] = v return } func (p *CreateNetworkOfferingParams) SetKeepaliveenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keepaliveenabled"] = v return } func (p *CreateNetworkOfferingParams) SetMaxconnections(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxconnections"] = v return } func (p *CreateNetworkOfferingParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateNetworkOfferingParams) SetNetworkrate(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkrate"] = v return } func (p *CreateNetworkOfferingParams) SetServicecapabilitylist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["servicecapabilitylist"] = v return } func (p *CreateNetworkOfferingParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } func (p *CreateNetworkOfferingParams) SetServiceproviderlist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceproviderlist"] = v return } func (p *CreateNetworkOfferingParams) SetSpecifyipranges(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["specifyipranges"] = v return } func (p *CreateNetworkOfferingParams) SetSpecifyvlan(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["specifyvlan"] = v return } func (p *CreateNetworkOfferingParams) SetSupportedservices(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["supportedservices"] = v return } func (p *CreateNetworkOfferingParams) SetTags(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *CreateNetworkOfferingParams) SetTraffictype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["traffictype"] = v return } // You should always use this function to get a new CreateNetworkOfferingParams instance, // as then you are sure you have configured all required params func (s *NetworkOfferingService) NewCreateNetworkOfferingParams(displaytext string, guestiptype string, name string, supportedservices []string, traffictype string) *CreateNetworkOfferingParams { p := &CreateNetworkOfferingParams{} p.p = make(map[string]interface{}) p.p["displaytext"] = displaytext p.p["guestiptype"] = guestiptype p.p["name"] = name p.p["supportedservices"] = supportedservices p.p["traffictype"] = traffictype return p } // Creates a network offering. func (s *NetworkOfferingService) CreateNetworkOffering(p *CreateNetworkOfferingParams) (*CreateNetworkOfferingResponse, error) { resp, err := s.cs.newRequest("createNetworkOffering", p.toURLValues()) if err != nil { return nil, err } if resp, err = getRawValue(resp); err != nil { return nil, err } var r CreateNetworkOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateNetworkOfferingResponse struct { Availability string `json:"availability"` Conservemode bool `json:"conservemode"` Created string `json:"created"` Details map[string]string `json:"details"` Displaytext string `json:"displaytext"` Egressdefaultpolicy bool `json:"egressdefaultpolicy"` Forvpc bool `json:"forvpc"` Guestiptype string `json:"guestiptype"` Id string `json:"id"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxconnections int `json:"maxconnections"` Name string `json:"name"` Networkrate int `json:"networkrate"` Service []CreateNetworkOfferingResponseService `json:"service"` Serviceofferingid string `json:"serviceofferingid"` Specifyipranges bool `json:"specifyipranges"` Specifyvlan bool `json:"specifyvlan"` State string `json:"state"` Supportspublicaccess bool `json:"supportspublicaccess"` Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"` Tags string `json:"tags"` Traffictype string `json:"traffictype"` } type CreateNetworkOfferingResponseService struct { Capability []CreateNetworkOfferingResponseServiceCapability `json:"capability"` Name string `json:"name"` Provider []CreateNetworkOfferingResponseServiceProvider `json:"provider"` } type CreateNetworkOfferingResponseServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type CreateNetworkOfferingResponseServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type DeleteNetworkOfferingParams struct { p map[string]interface{} } func (p *DeleteNetworkOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteNetworkOfferingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteNetworkOfferingParams instance, // as then you are sure you have configured all required params func (s *NetworkOfferingService) NewDeleteNetworkOfferingParams(id string) *DeleteNetworkOfferingParams { p := &DeleteNetworkOfferingParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a network offering. func (s *NetworkOfferingService) DeleteNetworkOffering(p *DeleteNetworkOfferingParams) (*DeleteNetworkOfferingResponse, error) { resp, err := s.cs.newRequest("deleteNetworkOffering", p.toURLValues()) if err != nil { return nil, err } var r DeleteNetworkOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteNetworkOfferingResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteNetworkOfferingResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteNetworkOfferingResponse return json.Unmarshal(b, (*alias)(r)) } type ListNetworkOfferingsParams struct { p map[string]interface{} } func (p *ListNetworkOfferingsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["availability"]; found { u.Set("availability", v.(string)) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["forvpc"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forvpc", vv) } if v, found := p.p["guestiptype"]; found { u.Set("guestiptype", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isdefault"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isdefault", vv) } if v, found := p.p["istagged"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("istagged", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["sourcenatsupported"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("sourcenatsupported", vv) } if v, found := p.p["specifyipranges"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("specifyipranges", vv) } if v, found := p.p["specifyvlan"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("specifyvlan", vv) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["supportedservices"]; found { vv := strings.Join(v.([]string), ",") u.Set("supportedservices", vv) } if v, found := p.p["tags"]; found { u.Set("tags", v.(string)) } if v, found := p.p["traffictype"]; found { u.Set("traffictype", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListNetworkOfferingsParams) SetAvailability(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["availability"] = v return } func (p *ListNetworkOfferingsParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *ListNetworkOfferingsParams) SetForvpc(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forvpc"] = v return } func (p *ListNetworkOfferingsParams) SetGuestiptype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["guestiptype"] = v return } func (p *ListNetworkOfferingsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListNetworkOfferingsParams) SetIsdefault(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isdefault"] = v return } func (p *ListNetworkOfferingsParams) SetIstagged(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["istagged"] = v return } func (p *ListNetworkOfferingsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNetworkOfferingsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListNetworkOfferingsParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListNetworkOfferingsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNetworkOfferingsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListNetworkOfferingsParams) SetSourcenatsupported(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sourcenatsupported"] = v return } func (p *ListNetworkOfferingsParams) SetSpecifyipranges(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["specifyipranges"] = v return } func (p *ListNetworkOfferingsParams) SetSpecifyvlan(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["specifyvlan"] = v return } func (p *ListNetworkOfferingsParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListNetworkOfferingsParams) SetSupportedservices(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["supportedservices"] = v return } func (p *ListNetworkOfferingsParams) SetTags(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListNetworkOfferingsParams) SetTraffictype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["traffictype"] = v return } func (p *ListNetworkOfferingsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListNetworkOfferingsParams instance, // as then you are sure you have configured all required params func (s *NetworkOfferingService) NewListNetworkOfferingsParams() *ListNetworkOfferingsParams { p := &ListNetworkOfferingsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkOfferingService) GetNetworkOfferingID(name string, opts ...OptionFunc) (string, int, error) { p := &ListNetworkOfferingsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListNetworkOfferings(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.NetworkOfferings[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.NetworkOfferings { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkOfferingService) GetNetworkOfferingByName(name string, opts ...OptionFunc) (*NetworkOffering, int, error) { id, count, err := s.GetNetworkOfferingID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetNetworkOfferingByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkOfferingService) GetNetworkOfferingByID(id string, opts ...OptionFunc) (*NetworkOffering, int, error) { p := &ListNetworkOfferingsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListNetworkOfferings(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.NetworkOfferings[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for NetworkOffering UUID: %s!", id) } // Lists all available network offerings. func (s *NetworkOfferingService) ListNetworkOfferings(p *ListNetworkOfferingsParams) (*ListNetworkOfferingsResponse, error) { resp, err := s.cs.newRequest("listNetworkOfferings", p.toURLValues()) if err != nil { return nil, err } var r ListNetworkOfferingsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNetworkOfferingsResponse struct { Count int `json:"count"` NetworkOfferings []*NetworkOffering `json:"networkoffering"` } type NetworkOffering struct { Availability string `json:"availability"` Conservemode bool `json:"conservemode"` Created string `json:"created"` Details map[string]string `json:"details"` Displaytext string `json:"displaytext"` Egressdefaultpolicy bool `json:"egressdefaultpolicy"` Forvpc bool `json:"forvpc"` Guestiptype string `json:"guestiptype"` Id string `json:"id"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxconnections int `json:"maxconnections"` Name string `json:"name"` Networkrate int `json:"networkrate"` Service []NetworkOfferingServiceInternal `json:"service"` Serviceofferingid string `json:"serviceofferingid"` Specifyipranges bool `json:"specifyipranges"` Specifyvlan bool `json:"specifyvlan"` State string `json:"state"` Supportspublicaccess bool `json:"supportspublicaccess"` Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"` Tags string `json:"tags"` Traffictype string `json:"traffictype"` } type NetworkOfferingServiceInternal struct { Capability []NetworkOfferingServiceInternalCapability `json:"capability"` Name string `json:"name"` Provider []NetworkOfferingServiceInternalProvider `json:"provider"` } type NetworkOfferingServiceInternalProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type NetworkOfferingServiceInternalCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type UpdateNetworkOfferingParams struct { p map[string]interface{} } func (p *UpdateNetworkOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["availability"]; found { u.Set("availability", v.(string)) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keepaliveenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("keepaliveenabled", vv) } if v, found := p.p["maxconnections"]; found { vv := strconv.Itoa(v.(int)) u.Set("maxconnections", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["sortkey"]; found { vv := strconv.Itoa(v.(int)) u.Set("sortkey", vv) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["tags"]; found { u.Set("tags", v.(string)) } return u } func (p *UpdateNetworkOfferingParams) SetAvailability(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["availability"] = v return } func (p *UpdateNetworkOfferingParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *UpdateNetworkOfferingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateNetworkOfferingParams) SetKeepaliveenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keepaliveenabled"] = v return } func (p *UpdateNetworkOfferingParams) SetMaxconnections(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxconnections"] = v return } func (p *UpdateNetworkOfferingParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateNetworkOfferingParams) SetSortkey(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sortkey"] = v return } func (p *UpdateNetworkOfferingParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *UpdateNetworkOfferingParams) SetTags(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new UpdateNetworkOfferingParams instance, // as then you are sure you have configured all required params func (s *NetworkOfferingService) NewUpdateNetworkOfferingParams() *UpdateNetworkOfferingParams { p := &UpdateNetworkOfferingParams{} p.p = make(map[string]interface{}) return p } // Updates a network offering. func (s *NetworkOfferingService) UpdateNetworkOffering(p *UpdateNetworkOfferingParams) (*UpdateNetworkOfferingResponse, error) { resp, err := s.cs.newRequest("updateNetworkOffering", p.toURLValues()) if err != nil { return nil, err } var r UpdateNetworkOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateNetworkOfferingResponse struct { Availability string `json:"availability"` Conservemode bool `json:"conservemode"` Created string `json:"created"` Details map[string]string `json:"details"` Displaytext string `json:"displaytext"` Egressdefaultpolicy bool `json:"egressdefaultpolicy"` Forvpc bool `json:"forvpc"` Guestiptype string `json:"guestiptype"` Id string `json:"id"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxconnections int `json:"maxconnections"` Name string `json:"name"` Networkrate int `json:"networkrate"` Service []UpdateNetworkOfferingResponseService `json:"service"` Serviceofferingid string `json:"serviceofferingid"` Specifyipranges bool `json:"specifyipranges"` Specifyvlan bool `json:"specifyvlan"` State string `json:"state"` Supportspublicaccess bool `json:"supportspublicaccess"` Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"` Tags string `json:"tags"` Traffictype string `json:"traffictype"` } type UpdateNetworkOfferingResponseService struct { Capability []UpdateNetworkOfferingResponseServiceCapability `json:"capability"` Name string `json:"name"` Provider []UpdateNetworkOfferingResponseServiceProvider `json:"provider"` } type UpdateNetworkOfferingResponseServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type UpdateNetworkOfferingResponseServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } go-cloudstack-2.9.0/cloudstack/NetworkService.go000066400000000000000000003704241364073403100217310ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AddNetworkServiceProviderParams struct { p map[string]interface{} } func (p *AddNetworkServiceProviderParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["destinationphysicalnetworkid"]; found { u.Set("destinationphysicalnetworkid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["servicelist"]; found { vv := strings.Join(v.([]string), ",") u.Set("servicelist", vv) } return u } func (p *AddNetworkServiceProviderParams) SetDestinationphysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["destinationphysicalnetworkid"] = v return } func (p *AddNetworkServiceProviderParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *AddNetworkServiceProviderParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddNetworkServiceProviderParams) SetServicelist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["servicelist"] = v return } // You should always use this function to get a new AddNetworkServiceProviderParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewAddNetworkServiceProviderParams(name string, physicalnetworkid string) *AddNetworkServiceProviderParams { p := &AddNetworkServiceProviderParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["physicalnetworkid"] = physicalnetworkid return p } // Adds a network serviceProvider to a physical network func (s *NetworkService) AddNetworkServiceProvider(p *AddNetworkServiceProviderParams) (*AddNetworkServiceProviderResponse, error) { resp, err := s.cs.newRequest("addNetworkServiceProvider", p.toURLValues()) if err != nil { return nil, err } var r AddNetworkServiceProviderResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddNetworkServiceProviderResponse struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type AddOpenDaylightControllerParams struct { p map[string]interface{} } func (p *AddOpenDaylightControllerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddOpenDaylightControllerParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddOpenDaylightControllerParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddOpenDaylightControllerParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddOpenDaylightControllerParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddOpenDaylightControllerParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewAddOpenDaylightControllerParams(password string, physicalnetworkid string, url string, username string) *AddOpenDaylightControllerParams { p := &AddOpenDaylightControllerParams{} p.p = make(map[string]interface{}) p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["url"] = url p.p["username"] = username return p } // Adds an OpenDyalight controler func (s *NetworkService) AddOpenDaylightController(p *AddOpenDaylightControllerParams) (*AddOpenDaylightControllerResponse, error) { resp, err := s.cs.newRequest("addOpenDaylightController", p.toURLValues()) if err != nil { return nil, err } var r AddOpenDaylightControllerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddOpenDaylightControllerResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Url string `json:"url"` Username string `json:"username"` } type CreateNetworkParams struct { p map[string]interface{} } func (p *CreateNetworkParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["aclid"]; found { u.Set("aclid", v.(string)) } if v, found := p.p["acltype"]; found { u.Set("acltype", v.(string)) } if v, found := p.p["bypassvlanoverlapcheck"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("bypassvlanoverlapcheck", vv) } if v, found := p.p["displaynetwork"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displaynetwork", vv) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["endip"]; found { u.Set("endip", v.(string)) } if v, found := p.p["endipv6"]; found { u.Set("endipv6", v.(string)) } if v, found := p.p["externalid"]; found { u.Set("externalid", v.(string)) } if v, found := p.p["gateway"]; found { u.Set("gateway", v.(string)) } if v, found := p.p["ip6cidr"]; found { u.Set("ip6cidr", v.(string)) } if v, found := p.p["ip6gateway"]; found { u.Set("ip6gateway", v.(string)) } if v, found := p.p["isolatedpvlan"]; found { u.Set("isolatedpvlan", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["netmask"]; found { u.Set("netmask", v.(string)) } if v, found := p.p["networkdomain"]; found { u.Set("networkdomain", v.(string)) } if v, found := p.p["networkofferingid"]; found { u.Set("networkofferingid", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["startip"]; found { u.Set("startip", v.(string)) } if v, found := p.p["startipv6"]; found { u.Set("startipv6", v.(string)) } if v, found := p.p["subdomainaccess"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("subdomainaccess", vv) } if v, found := p.p["vlan"]; found { u.Set("vlan", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreateNetworkParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateNetworkParams) SetAclid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["aclid"] = v return } func (p *CreateNetworkParams) SetAcltype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["acltype"] = v return } func (p *CreateNetworkParams) SetBypassvlanoverlapcheck(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bypassvlanoverlapcheck"] = v return } func (p *CreateNetworkParams) SetDisplaynetwork(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaynetwork"] = v return } func (p *CreateNetworkParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *CreateNetworkParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateNetworkParams) SetEndip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endip"] = v return } func (p *CreateNetworkParams) SetEndipv6(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endipv6"] = v return } func (p *CreateNetworkParams) SetExternalid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["externalid"] = v return } func (p *CreateNetworkParams) SetGateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gateway"] = v return } func (p *CreateNetworkParams) SetIp6cidr(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ip6cidr"] = v return } func (p *CreateNetworkParams) SetIp6gateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ip6gateway"] = v return } func (p *CreateNetworkParams) SetIsolatedpvlan(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isolatedpvlan"] = v return } func (p *CreateNetworkParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateNetworkParams) SetNetmask(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["netmask"] = v return } func (p *CreateNetworkParams) SetNetworkdomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdomain"] = v return } func (p *CreateNetworkParams) SetNetworkofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkofferingid"] = v return } func (p *CreateNetworkParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *CreateNetworkParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *CreateNetworkParams) SetStartip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startip"] = v return } func (p *CreateNetworkParams) SetStartipv6(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startipv6"] = v return } func (p *CreateNetworkParams) SetSubdomainaccess(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["subdomainaccess"] = v return } func (p *CreateNetworkParams) SetVlan(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } func (p *CreateNetworkParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } func (p *CreateNetworkParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreateNetworkParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewCreateNetworkParams(displaytext string, name string, networkofferingid string, zoneid string) *CreateNetworkParams { p := &CreateNetworkParams{} p.p = make(map[string]interface{}) p.p["displaytext"] = displaytext p.p["name"] = name p.p["networkofferingid"] = networkofferingid p.p["zoneid"] = zoneid return p } // Creates a network func (s *NetworkService) CreateNetwork(p *CreateNetworkParams) (*CreateNetworkResponse, error) { resp, err := s.cs.newRequest("createNetwork", p.toURLValues()) if err != nil { return nil, err } if resp, err = getRawValue(resp); err != nil { return nil, err } var r CreateNetworkResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateNetworkResponse struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []CreateNetworkResponseService `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type CreateNetworkResponseService struct { Capability []CreateNetworkResponseServiceCapability `json:"capability"` Name string `json:"name"` Provider []CreateNetworkResponseServiceProvider `json:"provider"` } type CreateNetworkResponseServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type CreateNetworkResponseServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type CreatePhysicalNetworkParams struct { p map[string]interface{} } func (p *CreatePhysicalNetworkParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["broadcastdomainrange"]; found { u.Set("broadcastdomainrange", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["isolationmethods"]; found { vv := strings.Join(v.([]string), ",") u.Set("isolationmethods", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkspeed"]; found { u.Set("networkspeed", v.(string)) } if v, found := p.p["tags"]; found { vv := strings.Join(v.([]string), ",") u.Set("tags", vv) } if v, found := p.p["vlan"]; found { u.Set("vlan", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreatePhysicalNetworkParams) SetBroadcastdomainrange(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["broadcastdomainrange"] = v return } func (p *CreatePhysicalNetworkParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreatePhysicalNetworkParams) SetIsolationmethods(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isolationmethods"] = v return } func (p *CreatePhysicalNetworkParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreatePhysicalNetworkParams) SetNetworkspeed(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkspeed"] = v return } func (p *CreatePhysicalNetworkParams) SetTags(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *CreatePhysicalNetworkParams) SetVlan(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } func (p *CreatePhysicalNetworkParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreatePhysicalNetworkParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewCreatePhysicalNetworkParams(name string, zoneid string) *CreatePhysicalNetworkParams { p := &CreatePhysicalNetworkParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["zoneid"] = zoneid return p } // Creates a physical network func (s *NetworkService) CreatePhysicalNetwork(p *CreatePhysicalNetworkParams) (*CreatePhysicalNetworkResponse, error) { resp, err := s.cs.newRequest("createPhysicalNetwork", p.toURLValues()) if err != nil { return nil, err } var r CreatePhysicalNetworkResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreatePhysicalNetworkResponse struct { Broadcastdomainrange string `json:"broadcastdomainrange"` Domainid string `json:"domainid"` Id string `json:"id"` Isolationmethods string `json:"isolationmethods"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Networkspeed string `json:"networkspeed"` State string `json:"state"` Tags string `json:"tags"` Vlan string `json:"vlan"` Zoneid string `json:"zoneid"` } type CreateServiceInstanceParams struct { p map[string]interface{} } func (p *CreateServiceInstanceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["leftnetworkid"]; found { u.Set("leftnetworkid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["rightnetworkid"]; found { u.Set("rightnetworkid", v.(string)) } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } if v, found := p.p["templateid"]; found { u.Set("templateid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreateServiceInstanceParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateServiceInstanceParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateServiceInstanceParams) SetLeftnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["leftnetworkid"] = v return } func (p *CreateServiceInstanceParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateServiceInstanceParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *CreateServiceInstanceParams) SetRightnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["rightnetworkid"] = v return } func (p *CreateServiceInstanceParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } func (p *CreateServiceInstanceParams) SetTemplateid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templateid"] = v return } func (p *CreateServiceInstanceParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreateServiceInstanceParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewCreateServiceInstanceParams(leftnetworkid string, name string, rightnetworkid string, serviceofferingid string, templateid string, zoneid string) *CreateServiceInstanceParams { p := &CreateServiceInstanceParams{} p.p = make(map[string]interface{}) p.p["leftnetworkid"] = leftnetworkid p.p["name"] = name p.p["rightnetworkid"] = rightnetworkid p.p["serviceofferingid"] = serviceofferingid p.p["templateid"] = templateid p.p["zoneid"] = zoneid return p } // Creates a system virtual-machine that implements network services func (s *NetworkService) CreateServiceInstance(p *CreateServiceInstanceParams) (*CreateServiceInstanceResponse, error) { resp, err := s.cs.newRequest("createServiceInstance", p.toURLValues()) if err != nil { return nil, err } var r CreateServiceInstanceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateServiceInstanceResponse struct { Account string `json:"account"` Displayname string `json:"displayname"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` } type CreateStorageNetworkIpRangeParams struct { p map[string]interface{} } func (p *CreateStorageNetworkIpRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["endip"]; found { u.Set("endip", v.(string)) } if v, found := p.p["gateway"]; found { u.Set("gateway", v.(string)) } if v, found := p.p["netmask"]; found { u.Set("netmask", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["startip"]; found { u.Set("startip", v.(string)) } if v, found := p.p["vlan"]; found { vv := strconv.Itoa(v.(int)) u.Set("vlan", vv) } return u } func (p *CreateStorageNetworkIpRangeParams) SetEndip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endip"] = v return } func (p *CreateStorageNetworkIpRangeParams) SetGateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gateway"] = v return } func (p *CreateStorageNetworkIpRangeParams) SetNetmask(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["netmask"] = v return } func (p *CreateStorageNetworkIpRangeParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *CreateStorageNetworkIpRangeParams) SetStartip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startip"] = v return } func (p *CreateStorageNetworkIpRangeParams) SetVlan(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } // You should always use this function to get a new CreateStorageNetworkIpRangeParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewCreateStorageNetworkIpRangeParams(gateway string, netmask string, podid string, startip string) *CreateStorageNetworkIpRangeParams { p := &CreateStorageNetworkIpRangeParams{} p.p = make(map[string]interface{}) p.p["gateway"] = gateway p.p["netmask"] = netmask p.p["podid"] = podid p.p["startip"] = startip return p } // Creates a Storage network IP range. func (s *NetworkService) CreateStorageNetworkIpRange(p *CreateStorageNetworkIpRangeParams) (*CreateStorageNetworkIpRangeResponse, error) { resp, err := s.cs.newRequest("createStorageNetworkIpRange", p.toURLValues()) if err != nil { return nil, err } var r CreateStorageNetworkIpRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateStorageNetworkIpRangeResponse struct { Endip string `json:"endip"` Gateway string `json:"gateway"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Netmask string `json:"netmask"` Networkid string `json:"networkid"` Podid string `json:"podid"` Startip string `json:"startip"` Vlan int `json:"vlan"` Zoneid string `json:"zoneid"` } type DedicatePublicIpRangeParams struct { p map[string]interface{} } func (p *DedicatePublicIpRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *DedicatePublicIpRangeParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DedicatePublicIpRangeParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DedicatePublicIpRangeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *DedicatePublicIpRangeParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new DedicatePublicIpRangeParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewDedicatePublicIpRangeParams(domainid string, id string) *DedicatePublicIpRangeParams { p := &DedicatePublicIpRangeParams{} p.p = make(map[string]interface{}) p.p["domainid"] = domainid p.p["id"] = id return p } // Dedicates a Public IP range to an account func (s *NetworkService) DedicatePublicIpRange(p *DedicatePublicIpRangeParams) (*DedicatePublicIpRangeResponse, error) { resp, err := s.cs.newRequest("dedicatePublicIpRange", p.toURLValues()) if err != nil { return nil, err } var r DedicatePublicIpRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DedicatePublicIpRangeResponse struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Endip string `json:"endip"` Endipv6 string `json:"endipv6"` Forsystemvms bool `json:"forsystemvms"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Netmask string `json:"netmask"` Networkid string `json:"networkid"` Physicalnetworkid string `json:"physicalnetworkid"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Startip string `json:"startip"` Startipv6 string `json:"startipv6"` Vlan string `json:"vlan"` Zoneid string `json:"zoneid"` } type DeleteNetworkParams struct { p map[string]interface{} } func (p *DeleteNetworkParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["forced"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forced", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteNetworkParams) SetForced(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forced"] = v return } func (p *DeleteNetworkParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteNetworkParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewDeleteNetworkParams(id string) *DeleteNetworkParams { p := &DeleteNetworkParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a network func (s *NetworkService) DeleteNetwork(p *DeleteNetworkParams) (*DeleteNetworkResponse, error) { resp, err := s.cs.newRequest("deleteNetwork", p.toURLValues()) if err != nil { return nil, err } var r DeleteNetworkResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteNetworkResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteNetworkServiceProviderParams struct { p map[string]interface{} } func (p *DeleteNetworkServiceProviderParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteNetworkServiceProviderParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteNetworkServiceProviderParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewDeleteNetworkServiceProviderParams(id string) *DeleteNetworkServiceProviderParams { p := &DeleteNetworkServiceProviderParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a Network Service Provider. func (s *NetworkService) DeleteNetworkServiceProvider(p *DeleteNetworkServiceProviderParams) (*DeleteNetworkServiceProviderResponse, error) { resp, err := s.cs.newRequest("deleteNetworkServiceProvider", p.toURLValues()) if err != nil { return nil, err } var r DeleteNetworkServiceProviderResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteNetworkServiceProviderResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteOpenDaylightControllerParams struct { p map[string]interface{} } func (p *DeleteOpenDaylightControllerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteOpenDaylightControllerParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteOpenDaylightControllerParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewDeleteOpenDaylightControllerParams(id string) *DeleteOpenDaylightControllerParams { p := &DeleteOpenDaylightControllerParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Removes an OpenDyalight controler func (s *NetworkService) DeleteOpenDaylightController(p *DeleteOpenDaylightControllerParams) (*DeleteOpenDaylightControllerResponse, error) { resp, err := s.cs.newRequest("deleteOpenDaylightController", p.toURLValues()) if err != nil { return nil, err } var r DeleteOpenDaylightControllerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteOpenDaylightControllerResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Url string `json:"url"` Username string `json:"username"` } type DeletePhysicalNetworkParams struct { p map[string]interface{} } func (p *DeletePhysicalNetworkParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeletePhysicalNetworkParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeletePhysicalNetworkParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewDeletePhysicalNetworkParams(id string) *DeletePhysicalNetworkParams { p := &DeletePhysicalNetworkParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a Physical Network. func (s *NetworkService) DeletePhysicalNetwork(p *DeletePhysicalNetworkParams) (*DeletePhysicalNetworkResponse, error) { resp, err := s.cs.newRequest("deletePhysicalNetwork", p.toURLValues()) if err != nil { return nil, err } var r DeletePhysicalNetworkResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeletePhysicalNetworkResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteStorageNetworkIpRangeParams struct { p map[string]interface{} } func (p *DeleteStorageNetworkIpRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteStorageNetworkIpRangeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteStorageNetworkIpRangeParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewDeleteStorageNetworkIpRangeParams(id string) *DeleteStorageNetworkIpRangeParams { p := &DeleteStorageNetworkIpRangeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a storage network IP Range. func (s *NetworkService) DeleteStorageNetworkIpRange(p *DeleteStorageNetworkIpRangeParams) (*DeleteStorageNetworkIpRangeResponse, error) { resp, err := s.cs.newRequest("deleteStorageNetworkIpRange", p.toURLValues()) if err != nil { return nil, err } var r DeleteStorageNetworkIpRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteStorageNetworkIpRangeResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListNetscalerLoadBalancerNetworksParams struct { p map[string]interface{} } func (p *ListNetscalerLoadBalancerNetworksParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["lbdeviceid"]; found { u.Set("lbdeviceid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListNetscalerLoadBalancerNetworksParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNetscalerLoadBalancerNetworksParams) SetLbdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbdeviceid"] = v return } func (p *ListNetscalerLoadBalancerNetworksParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNetscalerLoadBalancerNetworksParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListNetscalerLoadBalancerNetworksParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewListNetscalerLoadBalancerNetworksParams(lbdeviceid string) *ListNetscalerLoadBalancerNetworksParams { p := &ListNetscalerLoadBalancerNetworksParams{} p.p = make(map[string]interface{}) p.p["lbdeviceid"] = lbdeviceid return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetNetscalerLoadBalancerNetworkID(keyword string, lbdeviceid string, opts ...OptionFunc) (string, int, error) { p := &ListNetscalerLoadBalancerNetworksParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword p.p["lbdeviceid"] = lbdeviceid for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListNetscalerLoadBalancerNetworks(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.NetscalerLoadBalancerNetworks[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.NetscalerLoadBalancerNetworks { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // lists network that are using a netscaler load balancer device func (s *NetworkService) ListNetscalerLoadBalancerNetworks(p *ListNetscalerLoadBalancerNetworksParams) (*ListNetscalerLoadBalancerNetworksResponse, error) { resp, err := s.cs.newRequest("listNetscalerLoadBalancerNetworks", p.toURLValues()) if err != nil { return nil, err } var r ListNetscalerLoadBalancerNetworksResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNetscalerLoadBalancerNetworksResponse struct { Count int `json:"count"` NetscalerLoadBalancerNetworks []*NetscalerLoadBalancerNetwork `json:"netscalerloadbalancernetwork"` } type NetscalerLoadBalancerNetwork struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []NetscalerLoadBalancerNetworkService `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type NetscalerLoadBalancerNetworkService struct { Capability []NetscalerLoadBalancerNetworkServiceCapability `json:"capability"` Name string `json:"name"` Provider []NetscalerLoadBalancerNetworkServiceProvider `json:"provider"` } type NetscalerLoadBalancerNetworkServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type NetscalerLoadBalancerNetworkServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type ListNetworkIsolationMethodsParams struct { p map[string]interface{} } func (p *ListNetworkIsolationMethodsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListNetworkIsolationMethodsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNetworkIsolationMethodsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNetworkIsolationMethodsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListNetworkIsolationMethodsParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewListNetworkIsolationMethodsParams() *ListNetworkIsolationMethodsParams { p := &ListNetworkIsolationMethodsParams{} p.p = make(map[string]interface{}) return p } // Lists supported methods of network isolation func (s *NetworkService) ListNetworkIsolationMethods(p *ListNetworkIsolationMethodsParams) (*ListNetworkIsolationMethodsResponse, error) { resp, err := s.cs.newRequest("listNetworkIsolationMethods", p.toURLValues()) if err != nil { return nil, err } var r ListNetworkIsolationMethodsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNetworkIsolationMethodsResponse struct { Count int `json:"count"` NetworkIsolationMethods []*NetworkIsolationMethod `json:"networkisolationmethod"` } type NetworkIsolationMethod struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` } type ListNetworkServiceProvidersParams struct { p map[string]interface{} } func (p *ListNetworkServiceProvidersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } return u } func (p *ListNetworkServiceProvidersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNetworkServiceProvidersParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListNetworkServiceProvidersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNetworkServiceProvidersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListNetworkServiceProvidersParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *ListNetworkServiceProvidersParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } // You should always use this function to get a new ListNetworkServiceProvidersParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewListNetworkServiceProvidersParams() *ListNetworkServiceProvidersParams { p := &ListNetworkServiceProvidersParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetNetworkServiceProviderID(name string, opts ...OptionFunc) (string, int, error) { p := &ListNetworkServiceProvidersParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListNetworkServiceProviders(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.NetworkServiceProviders[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.NetworkServiceProviders { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // Lists network serviceproviders for a given physical network. func (s *NetworkService) ListNetworkServiceProviders(p *ListNetworkServiceProvidersParams) (*ListNetworkServiceProvidersResponse, error) { resp, err := s.cs.newRequest("listNetworkServiceProviders", p.toURLValues()) if err != nil { return nil, err } var r ListNetworkServiceProvidersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNetworkServiceProvidersResponse struct { Count int `json:"count"` NetworkServiceProviders []*NetworkServiceProvider `json:"networkserviceprovider"` } type NetworkServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type ListNetworksParams struct { p map[string]interface{} } func (p *ListNetworksParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["acltype"]; found { u.Set("acltype", v.(string)) } if v, found := p.p["canusefordeploy"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("canusefordeploy", vv) } if v, found := p.p["displaynetwork"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displaynetwork", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["forvpc"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forvpc", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["issystem"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("issystem", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["restartrequired"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("restartrequired", vv) } if v, found := p.p["specifyipranges"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("specifyipranges", vv) } if v, found := p.p["supportedservices"]; found { vv := strings.Join(v.([]string), ",") u.Set("supportedservices", vv) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["traffictype"]; found { u.Set("traffictype", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListNetworksParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListNetworksParams) SetAcltype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["acltype"] = v return } func (p *ListNetworksParams) SetCanusefordeploy(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["canusefordeploy"] = v return } func (p *ListNetworksParams) SetDisplaynetwork(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaynetwork"] = v return } func (p *ListNetworksParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListNetworksParams) SetForvpc(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forvpc"] = v return } func (p *ListNetworksParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListNetworksParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListNetworksParams) SetIssystem(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["issystem"] = v return } func (p *ListNetworksParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNetworksParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListNetworksParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNetworksParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListNetworksParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *ListNetworksParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListNetworksParams) SetRestartrequired(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["restartrequired"] = v return } func (p *ListNetworksParams) SetSpecifyipranges(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["specifyipranges"] = v return } func (p *ListNetworksParams) SetSupportedservices(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["supportedservices"] = v return } func (p *ListNetworksParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListNetworksParams) SetTraffictype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["traffictype"] = v return } func (p *ListNetworksParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } func (p *ListNetworksParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } func (p *ListNetworksParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListNetworksParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewListNetworksParams() *ListNetworksParams { p := &ListNetworksParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetNetworkID(keyword string, opts ...OptionFunc) (string, int, error) { p := &ListNetworksParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListNetworks(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.Networks[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Networks { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetNetworkByName(name string, opts ...OptionFunc) (*Network, int, error) { id, count, err := s.GetNetworkID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetNetworkByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetNetworkByID(id string, opts ...OptionFunc) (*Network, int, error) { p := &ListNetworksParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListNetworks(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Networks[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Network UUID: %s!", id) } // Lists all available networks. func (s *NetworkService) ListNetworks(p *ListNetworksParams) (*ListNetworksResponse, error) { resp, err := s.cs.newRequest("listNetworks", p.toURLValues()) if err != nil { return nil, err } var r ListNetworksResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNetworksResponse struct { Count int `json:"count"` Networks []*Network `json:"network"` } type Network struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []NetworkServiceInternal `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type NetworkServiceInternal struct { Capability []NetworkServiceInternalCapability `json:"capability"` Name string `json:"name"` Provider []NetworkServiceInternalProvider `json:"provider"` } type NetworkServiceInternalProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type NetworkServiceInternalCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type ListNiciraNvpDeviceNetworksParams struct { p map[string]interface{} } func (p *ListNiciraNvpDeviceNetworksParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["nvpdeviceid"]; found { u.Set("nvpdeviceid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListNiciraNvpDeviceNetworksParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNiciraNvpDeviceNetworksParams) SetNvpdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nvpdeviceid"] = v return } func (p *ListNiciraNvpDeviceNetworksParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNiciraNvpDeviceNetworksParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListNiciraNvpDeviceNetworksParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewListNiciraNvpDeviceNetworksParams(nvpdeviceid string) *ListNiciraNvpDeviceNetworksParams { p := &ListNiciraNvpDeviceNetworksParams{} p.p = make(map[string]interface{}) p.p["nvpdeviceid"] = nvpdeviceid return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetNiciraNvpDeviceNetworkID(keyword string, nvpdeviceid string, opts ...OptionFunc) (string, int, error) { p := &ListNiciraNvpDeviceNetworksParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword p.p["nvpdeviceid"] = nvpdeviceid for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListNiciraNvpDeviceNetworks(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.NiciraNvpDeviceNetworks[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.NiciraNvpDeviceNetworks { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // lists network that are using a nicira nvp device func (s *NetworkService) ListNiciraNvpDeviceNetworks(p *ListNiciraNvpDeviceNetworksParams) (*ListNiciraNvpDeviceNetworksResponse, error) { resp, err := s.cs.newRequest("listNiciraNvpDeviceNetworks", p.toURLValues()) if err != nil { return nil, err } var r ListNiciraNvpDeviceNetworksResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNiciraNvpDeviceNetworksResponse struct { Count int `json:"count"` NiciraNvpDeviceNetworks []*NiciraNvpDeviceNetwork `json:"niciranvpdevicenetwork"` } type NiciraNvpDeviceNetwork struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []NiciraNvpDeviceNetworkService `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type NiciraNvpDeviceNetworkService struct { Capability []NiciraNvpDeviceNetworkServiceCapability `json:"capability"` Name string `json:"name"` Provider []NiciraNvpDeviceNetworkServiceProvider `json:"provider"` } type NiciraNvpDeviceNetworkServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type NiciraNvpDeviceNetworkServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type ListOpenDaylightControllersParams struct { p map[string]interface{} } func (p *ListOpenDaylightControllersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } return u } func (p *ListOpenDaylightControllersParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListOpenDaylightControllersParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } // You should always use this function to get a new ListOpenDaylightControllersParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewListOpenDaylightControllersParams() *ListOpenDaylightControllersParams { p := &ListOpenDaylightControllersParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetOpenDaylightControllerByID(id string, opts ...OptionFunc) (*OpenDaylightController, int, error) { p := &ListOpenDaylightControllersParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListOpenDaylightControllers(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.OpenDaylightControllers[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for OpenDaylightController UUID: %s!", id) } // Lists OpenDyalight controllers func (s *NetworkService) ListOpenDaylightControllers(p *ListOpenDaylightControllersParams) (*ListOpenDaylightControllersResponse, error) { resp, err := s.cs.newRequest("listOpenDaylightControllers", p.toURLValues()) if err != nil { return nil, err } var r ListOpenDaylightControllersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListOpenDaylightControllersResponse struct { Count int `json:"count"` OpenDaylightControllers []*OpenDaylightController `json:"opendaylightcontroller"` } type OpenDaylightController struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Url string `json:"url"` Username string `json:"username"` } type ListPaloAltoFirewallNetworksParams struct { p map[string]interface{} } func (p *ListPaloAltoFirewallNetworksParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["lbdeviceid"]; found { u.Set("lbdeviceid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListPaloAltoFirewallNetworksParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListPaloAltoFirewallNetworksParams) SetLbdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lbdeviceid"] = v return } func (p *ListPaloAltoFirewallNetworksParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListPaloAltoFirewallNetworksParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListPaloAltoFirewallNetworksParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewListPaloAltoFirewallNetworksParams(lbdeviceid string) *ListPaloAltoFirewallNetworksParams { p := &ListPaloAltoFirewallNetworksParams{} p.p = make(map[string]interface{}) p.p["lbdeviceid"] = lbdeviceid return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetPaloAltoFirewallNetworkID(keyword string, lbdeviceid string, opts ...OptionFunc) (string, int, error) { p := &ListPaloAltoFirewallNetworksParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword p.p["lbdeviceid"] = lbdeviceid for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListPaloAltoFirewallNetworks(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.PaloAltoFirewallNetworks[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.PaloAltoFirewallNetworks { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // lists network that are using Palo Alto firewall device func (s *NetworkService) ListPaloAltoFirewallNetworks(p *ListPaloAltoFirewallNetworksParams) (*ListPaloAltoFirewallNetworksResponse, error) { resp, err := s.cs.newRequest("listPaloAltoFirewallNetworks", p.toURLValues()) if err != nil { return nil, err } var r ListPaloAltoFirewallNetworksResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListPaloAltoFirewallNetworksResponse struct { Count int `json:"count"` PaloAltoFirewallNetworks []*PaloAltoFirewallNetwork `json:"paloaltofirewallnetwork"` } type PaloAltoFirewallNetwork struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []PaloAltoFirewallNetworkService `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type PaloAltoFirewallNetworkService struct { Capability []PaloAltoFirewallNetworkServiceCapability `json:"capability"` Name string `json:"name"` Provider []PaloAltoFirewallNetworkServiceProvider `json:"provider"` } type PaloAltoFirewallNetworkServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type PaloAltoFirewallNetworkServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type ListPhysicalNetworksParams struct { p map[string]interface{} } func (p *ListPhysicalNetworksParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListPhysicalNetworksParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListPhysicalNetworksParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListPhysicalNetworksParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListPhysicalNetworksParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListPhysicalNetworksParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListPhysicalNetworksParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListPhysicalNetworksParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewListPhysicalNetworksParams() *ListPhysicalNetworksParams { p := &ListPhysicalNetworksParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetPhysicalNetworkID(name string, opts ...OptionFunc) (string, int, error) { p := &ListPhysicalNetworksParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListPhysicalNetworks(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.PhysicalNetworks[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.PhysicalNetworks { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetPhysicalNetworkByName(name string, opts ...OptionFunc) (*PhysicalNetwork, int, error) { id, count, err := s.GetPhysicalNetworkID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetPhysicalNetworkByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetPhysicalNetworkByID(id string, opts ...OptionFunc) (*PhysicalNetwork, int, error) { p := &ListPhysicalNetworksParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListPhysicalNetworks(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.PhysicalNetworks[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for PhysicalNetwork UUID: %s!", id) } // Lists physical networks func (s *NetworkService) ListPhysicalNetworks(p *ListPhysicalNetworksParams) (*ListPhysicalNetworksResponse, error) { resp, err := s.cs.newRequest("listPhysicalNetworks", p.toURLValues()) if err != nil { return nil, err } var r ListPhysicalNetworksResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListPhysicalNetworksResponse struct { Count int `json:"count"` PhysicalNetworks []*PhysicalNetwork `json:"physicalnetwork"` } type PhysicalNetwork struct { Broadcastdomainrange string `json:"broadcastdomainrange"` Domainid string `json:"domainid"` Id string `json:"id"` Isolationmethods string `json:"isolationmethods"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Networkspeed string `json:"networkspeed"` State string `json:"state"` Tags string `json:"tags"` Vlan string `json:"vlan"` Zoneid string `json:"zoneid"` } type ListStorageNetworkIpRangeParams struct { p map[string]interface{} } func (p *ListStorageNetworkIpRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListStorageNetworkIpRangeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListStorageNetworkIpRangeParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListStorageNetworkIpRangeParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListStorageNetworkIpRangeParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListStorageNetworkIpRangeParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListStorageNetworkIpRangeParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListStorageNetworkIpRangeParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewListStorageNetworkIpRangeParams() *ListStorageNetworkIpRangeParams { p := &ListStorageNetworkIpRangeParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *NetworkService) GetStorageNetworkIpRangeByID(id string, opts ...OptionFunc) (*StorageNetworkIpRange, int, error) { p := &ListStorageNetworkIpRangeParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListStorageNetworkIpRange(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.StorageNetworkIpRange[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for StorageNetworkIpRange UUID: %s!", id) } // List a storage network IP range. func (s *NetworkService) ListStorageNetworkIpRange(p *ListStorageNetworkIpRangeParams) (*ListStorageNetworkIpRangeResponse, error) { resp, err := s.cs.newRequest("listStorageNetworkIpRange", p.toURLValues()) if err != nil { return nil, err } var r ListStorageNetworkIpRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListStorageNetworkIpRangeResponse struct { Count int `json:"count"` StorageNetworkIpRange []*StorageNetworkIpRange `json:"storagenetworkiprange"` } type StorageNetworkIpRange struct { Endip string `json:"endip"` Gateway string `json:"gateway"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Netmask string `json:"netmask"` Networkid string `json:"networkid"` Podid string `json:"podid"` Startip string `json:"startip"` Vlan int `json:"vlan"` Zoneid string `json:"zoneid"` } type ListSupportedNetworkServicesParams struct { p map[string]interface{} } func (p *ListSupportedNetworkServicesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["provider"]; found { u.Set("provider", v.(string)) } if v, found := p.p["service"]; found { u.Set("service", v.(string)) } return u } func (p *ListSupportedNetworkServicesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListSupportedNetworkServicesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListSupportedNetworkServicesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListSupportedNetworkServicesParams) SetProvider(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["provider"] = v return } func (p *ListSupportedNetworkServicesParams) SetService(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["service"] = v return } // You should always use this function to get a new ListSupportedNetworkServicesParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewListSupportedNetworkServicesParams() *ListSupportedNetworkServicesParams { p := &ListSupportedNetworkServicesParams{} p.p = make(map[string]interface{}) return p } // Lists all network services provided by CloudStack or for the given Provider. func (s *NetworkService) ListSupportedNetworkServices(p *ListSupportedNetworkServicesParams) (*ListSupportedNetworkServicesResponse, error) { resp, err := s.cs.newRequest("listSupportedNetworkServices", p.toURLValues()) if err != nil { return nil, err } var r ListSupportedNetworkServicesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListSupportedNetworkServicesResponse struct { Count int `json:"count"` SupportedNetworkServices []*SupportedNetworkService `json:"supportednetworkservice"` } type SupportedNetworkService struct { Capability []SupportedNetworkServiceCapability `json:"capability"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Provider []SupportedNetworkServiceProvider `json:"provider"` } type SupportedNetworkServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type SupportedNetworkServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type ReleasePublicIpRangeParams struct { p map[string]interface{} } func (p *ReleasePublicIpRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ReleasePublicIpRangeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ReleasePublicIpRangeParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewReleasePublicIpRangeParams(id string) *ReleasePublicIpRangeParams { p := &ReleasePublicIpRangeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Releases a Public IP range back to the system pool func (s *NetworkService) ReleasePublicIpRange(p *ReleasePublicIpRangeParams) (*ReleasePublicIpRangeResponse, error) { resp, err := s.cs.newRequest("releasePublicIpRange", p.toURLValues()) if err != nil { return nil, err } var r ReleasePublicIpRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ReleasePublicIpRangeResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *ReleasePublicIpRangeResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias ReleasePublicIpRangeResponse return json.Unmarshal(b, (*alias)(r)) } type RestartNetworkParams struct { p map[string]interface{} } func (p *RestartNetworkParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["cleanup"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("cleanup", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["makeredundant"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("makeredundant", vv) } return u } func (p *RestartNetworkParams) SetCleanup(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cleanup"] = v return } func (p *RestartNetworkParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *RestartNetworkParams) SetMakeredundant(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["makeredundant"] = v return } // You should always use this function to get a new RestartNetworkParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewRestartNetworkParams(id string) *RestartNetworkParams { p := &RestartNetworkParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Restarts the network; includes 1) restarting network elements - virtual routers, DHCP servers 2) reapplying all public IPs 3) reapplying loadBalancing/portForwarding rules func (s *NetworkService) RestartNetwork(p *RestartNetworkParams) (*RestartNetworkResponse, error) { resp, err := s.cs.newRequest("restartNetwork", p.toURLValues()) if err != nil { return nil, err } var r RestartNetworkResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RestartNetworkResponse struct { Account string `json:"account"` Allocated string `json:"allocated"` Associatednetworkid string `json:"associatednetworkid"` Associatednetworkname string `json:"associatednetworkname"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` Isportable bool `json:"isportable"` Issourcenat bool `json:"issourcenat"` Isstaticnat bool `json:"isstaticnat"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Purpose string `json:"purpose"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualmachinedisplayname string `json:"virtualmachinedisplayname"` Virtualmachineid string `json:"virtualmachineid"` Virtualmachinename string `json:"virtualmachinename"` Vlanid string `json:"vlanid"` Vlanname string `json:"vlanname"` Vmipaddress string `json:"vmipaddress"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateNetworkParams struct { p map[string]interface{} } func (p *UpdateNetworkParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["changecidr"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("changecidr", vv) } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["displaynetwork"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displaynetwork", vv) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["forced"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forced", vv) } if v, found := p.p["guestvmcidr"]; found { u.Set("guestvmcidr", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkdomain"]; found { u.Set("networkdomain", v.(string)) } if v, found := p.p["networkofferingid"]; found { u.Set("networkofferingid", v.(string)) } if v, found := p.p["updateinsequence"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("updateinsequence", vv) } return u } func (p *UpdateNetworkParams) SetChangecidr(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["changecidr"] = v return } func (p *UpdateNetworkParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateNetworkParams) SetDisplaynetwork(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaynetwork"] = v return } func (p *UpdateNetworkParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *UpdateNetworkParams) SetForced(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forced"] = v return } func (p *UpdateNetworkParams) SetGuestvmcidr(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["guestvmcidr"] = v return } func (p *UpdateNetworkParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateNetworkParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateNetworkParams) SetNetworkdomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdomain"] = v return } func (p *UpdateNetworkParams) SetNetworkofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkofferingid"] = v return } func (p *UpdateNetworkParams) SetUpdateinsequence(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["updateinsequence"] = v return } // You should always use this function to get a new UpdateNetworkParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewUpdateNetworkParams(id string) *UpdateNetworkParams { p := &UpdateNetworkParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a network func (s *NetworkService) UpdateNetwork(p *UpdateNetworkParams) (*UpdateNetworkResponse, error) { resp, err := s.cs.newRequest("updateNetwork", p.toURLValues()) if err != nil { return nil, err } var r UpdateNetworkResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateNetworkResponse struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []UpdateNetworkResponseService `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type UpdateNetworkResponseService struct { Capability []UpdateNetworkResponseServiceCapability `json:"capability"` Name string `json:"name"` Provider []UpdateNetworkResponseServiceProvider `json:"provider"` } type UpdateNetworkResponseServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type UpdateNetworkResponseServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type UpdateNetworkServiceProviderParams struct { p map[string]interface{} } func (p *UpdateNetworkServiceProviderParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["servicelist"]; found { vv := strings.Join(v.([]string), ",") u.Set("servicelist", vv) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } return u } func (p *UpdateNetworkServiceProviderParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateNetworkServiceProviderParams) SetServicelist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["servicelist"] = v return } func (p *UpdateNetworkServiceProviderParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } // You should always use this function to get a new UpdateNetworkServiceProviderParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewUpdateNetworkServiceProviderParams(id string) *UpdateNetworkServiceProviderParams { p := &UpdateNetworkServiceProviderParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a network serviceProvider of a physical network func (s *NetworkService) UpdateNetworkServiceProvider(p *UpdateNetworkServiceProviderParams) (*UpdateNetworkServiceProviderResponse, error) { resp, err := s.cs.newRequest("updateNetworkServiceProvider", p.toURLValues()) if err != nil { return nil, err } var r UpdateNetworkServiceProviderResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateNetworkServiceProviderResponse struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type UpdatePhysicalNetworkParams struct { p map[string]interface{} } func (p *UpdatePhysicalNetworkParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["networkspeed"]; found { u.Set("networkspeed", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["tags"]; found { vv := strings.Join(v.([]string), ",") u.Set("tags", vv) } if v, found := p.p["vlan"]; found { u.Set("vlan", v.(string)) } return u } func (p *UpdatePhysicalNetworkParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdatePhysicalNetworkParams) SetNetworkspeed(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkspeed"] = v return } func (p *UpdatePhysicalNetworkParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *UpdatePhysicalNetworkParams) SetTags(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *UpdatePhysicalNetworkParams) SetVlan(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } // You should always use this function to get a new UpdatePhysicalNetworkParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewUpdatePhysicalNetworkParams(id string) *UpdatePhysicalNetworkParams { p := &UpdatePhysicalNetworkParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a physical network func (s *NetworkService) UpdatePhysicalNetwork(p *UpdatePhysicalNetworkParams) (*UpdatePhysicalNetworkResponse, error) { resp, err := s.cs.newRequest("updatePhysicalNetwork", p.toURLValues()) if err != nil { return nil, err } var r UpdatePhysicalNetworkResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdatePhysicalNetworkResponse struct { Broadcastdomainrange string `json:"broadcastdomainrange"` Domainid string `json:"domainid"` Id string `json:"id"` Isolationmethods string `json:"isolationmethods"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Networkspeed string `json:"networkspeed"` State string `json:"state"` Tags string `json:"tags"` Vlan string `json:"vlan"` Zoneid string `json:"zoneid"` } type UpdateStorageNetworkIpRangeParams struct { p map[string]interface{} } func (p *UpdateStorageNetworkIpRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["endip"]; found { u.Set("endip", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["netmask"]; found { u.Set("netmask", v.(string)) } if v, found := p.p["startip"]; found { u.Set("startip", v.(string)) } if v, found := p.p["vlan"]; found { vv := strconv.Itoa(v.(int)) u.Set("vlan", vv) } return u } func (p *UpdateStorageNetworkIpRangeParams) SetEndip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endip"] = v return } func (p *UpdateStorageNetworkIpRangeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateStorageNetworkIpRangeParams) SetNetmask(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["netmask"] = v return } func (p *UpdateStorageNetworkIpRangeParams) SetStartip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startip"] = v return } func (p *UpdateStorageNetworkIpRangeParams) SetVlan(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } // You should always use this function to get a new UpdateStorageNetworkIpRangeParams instance, // as then you are sure you have configured all required params func (s *NetworkService) NewUpdateStorageNetworkIpRangeParams(id string) *UpdateStorageNetworkIpRangeParams { p := &UpdateStorageNetworkIpRangeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Update a Storage network IP range, only allowed when no IPs in this range have been allocated. func (s *NetworkService) UpdateStorageNetworkIpRange(p *UpdateStorageNetworkIpRangeParams) (*UpdateStorageNetworkIpRangeResponse, error) { resp, err := s.cs.newRequest("updateStorageNetworkIpRange", p.toURLValues()) if err != nil { return nil, err } var r UpdateStorageNetworkIpRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateStorageNetworkIpRangeResponse struct { Endip string `json:"endip"` Gateway string `json:"gateway"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Netmask string `json:"netmask"` Networkid string `json:"networkid"` Podid string `json:"podid"` Startip string `json:"startip"` Vlan int `json:"vlan"` Zoneid string `json:"zoneid"` } go-cloudstack-2.9.0/cloudstack/NicService.go000066400000000000000000000423111364073403100210000ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type AddIpToNicParams struct { p map[string]interface{} } func (p *AddIpToNicParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["ipaddress"]; found { u.Set("ipaddress", v.(string)) } if v, found := p.p["nicid"]; found { u.Set("nicid", v.(string)) } return u } func (p *AddIpToNicParams) SetIpaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddress"] = v return } func (p *AddIpToNicParams) SetNicid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nicid"] = v return } // You should always use this function to get a new AddIpToNicParams instance, // as then you are sure you have configured all required params func (s *NicService) NewAddIpToNicParams(nicid string) *AddIpToNicParams { p := &AddIpToNicParams{} p.p = make(map[string]interface{}) p.p["nicid"] = nicid return p } // Assigns secondary IP to NIC func (s *NicService) AddIpToNic(p *AddIpToNicParams) (*AddIpToNicResponse, error) { resp, err := s.cs.newRequest("addIpToNic", p.toURLValues()) if err != nil { return nil, err } var r AddIpToNicResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddIpToNicResponse struct { Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Networkid string `json:"networkid"` Nicid string `json:"nicid"` Secondaryip []struct { Id string `json:"id"` Ipaddress string `json:"ipaddress"` } `json:"secondaryip"` Virtualmachineid string `json:"virtualmachineid"` } type ListNicsParams struct { p map[string]interface{} } func (p *ListNicsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["nicid"]; found { u.Set("nicid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *ListNicsParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListNicsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNicsParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListNicsParams) SetNicid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nicid"] = v return } func (p *ListNicsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNicsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListNicsParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new ListNicsParams instance, // as then you are sure you have configured all required params func (s *NicService) NewListNicsParams(virtualmachineid string) *ListNicsParams { p := &ListNicsParams{} p.p = make(map[string]interface{}) p.p["virtualmachineid"] = virtualmachineid return p } // list the vm nics IP to NIC func (s *NicService) ListNics(p *ListNicsParams) (*ListNicsResponse, error) { resp, err := s.cs.newRequest("listNics", p.toURLValues()) if err != nil { return nil, err } var r ListNicsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNicsResponse struct { Count int `json:"count"` Nics []*Nic `json:"nic"` } type Nic struct { Broadcasturi string `json:"broadcasturi"` Deviceid string `json:"deviceid"` Extradhcpoption []string `json:"extradhcpoption"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6address string `json:"ip6address"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Ipaddress string `json:"ipaddress"` Isdefault bool `json:"isdefault"` Isolationuri string `json:"isolationuri"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Macaddress string `json:"macaddress"` Netmask string `json:"netmask"` Networkid string `json:"networkid"` Networkname string `json:"networkname"` Nsxlogicalswitch string `json:"nsxlogicalswitch"` Nsxlogicalswitchport string `json:"nsxlogicalswitchport"` Secondaryip []struct { Id string `json:"id"` Ipaddress string `json:"ipaddress"` } `json:"secondaryip"` Traffictype string `json:"traffictype"` Type string `json:"type"` Virtualmachineid string `json:"virtualmachineid"` } type RemoveIpFromNicParams struct { p map[string]interface{} } func (p *RemoveIpFromNicParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RemoveIpFromNicParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RemoveIpFromNicParams instance, // as then you are sure you have configured all required params func (s *NicService) NewRemoveIpFromNicParams(id string) *RemoveIpFromNicParams { p := &RemoveIpFromNicParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Removes secondary IP from the NIC. func (s *NicService) RemoveIpFromNic(p *RemoveIpFromNicParams) (*RemoveIpFromNicResponse, error) { resp, err := s.cs.newRequest("removeIpFromNic", p.toURLValues()) if err != nil { return nil, err } var r RemoveIpFromNicResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RemoveIpFromNicResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type UpdateVmNicIpParams struct { p map[string]interface{} } func (p *UpdateVmNicIpParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["ipaddress"]; found { u.Set("ipaddress", v.(string)) } if v, found := p.p["nicid"]; found { u.Set("nicid", v.(string)) } return u } func (p *UpdateVmNicIpParams) SetIpaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddress"] = v return } func (p *UpdateVmNicIpParams) SetNicid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nicid"] = v return } // You should always use this function to get a new UpdateVmNicIpParams instance, // as then you are sure you have configured all required params func (s *NicService) NewUpdateVmNicIpParams(nicid string) *UpdateVmNicIpParams { p := &UpdateVmNicIpParams{} p.p = make(map[string]interface{}) p.p["nicid"] = nicid return p } // Update the default Ip of a VM Nic func (s *NicService) UpdateVmNicIp(p *UpdateVmNicIpParams) (*UpdateVmNicIpResponse, error) { resp, err := s.cs.newRequest("updateVmNicIp", p.toURLValues()) if err != nil { return nil, err } var r UpdateVmNicIpResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateVmNicIpResponse struct { Account string `json:"account"` Affinitygroup []UpdateVmNicIpResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []UpdateVmNicIpResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateVmNicIpResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []UpdateVmNicIpResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []UpdateVmNicIpResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type UpdateVmNicIpResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type UpdateVmNicIpResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *UpdateVmNicIpResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateVmNicIpResponse return json.Unmarshal(b, (*alias)(r)) } go-cloudstack-2.9.0/cloudstack/NiciraNVPService.go000066400000000000000000000215551364073403100220670ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type AddNiciraNvpDeviceParams struct { p map[string]interface{} } func (p *AddNiciraNvpDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostname"]; found { u.Set("hostname", v.(string)) } if v, found := p.p["l2gatewayserviceuuid"]; found { u.Set("l2gatewayserviceuuid", v.(string)) } if v, found := p.p["l3gatewayserviceuuid"]; found { u.Set("l3gatewayserviceuuid", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["transportzoneuuid"]; found { u.Set("transportzoneuuid", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddNiciraNvpDeviceParams) SetHostname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostname"] = v return } func (p *AddNiciraNvpDeviceParams) SetL2gatewayserviceuuid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["l2gatewayserviceuuid"] = v return } func (p *AddNiciraNvpDeviceParams) SetL3gatewayserviceuuid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["l3gatewayserviceuuid"] = v return } func (p *AddNiciraNvpDeviceParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddNiciraNvpDeviceParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddNiciraNvpDeviceParams) SetTransportzoneuuid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["transportzoneuuid"] = v return } func (p *AddNiciraNvpDeviceParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddNiciraNvpDeviceParams instance, // as then you are sure you have configured all required params func (s *NiciraNVPService) NewAddNiciraNvpDeviceParams(hostname string, password string, physicalnetworkid string, transportzoneuuid string, username string) *AddNiciraNvpDeviceParams { p := &AddNiciraNvpDeviceParams{} p.p = make(map[string]interface{}) p.p["hostname"] = hostname p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["transportzoneuuid"] = transportzoneuuid p.p["username"] = username return p } // Adds a Nicira NVP device func (s *NiciraNVPService) AddNiciraNvpDevice(p *AddNiciraNvpDeviceParams) (*AddNiciraNvpDeviceResponse, error) { resp, err := s.cs.newRequest("addNiciraNvpDevice", p.toURLValues()) if err != nil { return nil, err } var r AddNiciraNvpDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddNiciraNvpDeviceResponse struct { Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` L2gatewayserviceuuid string `json:"l2gatewayserviceuuid"` L3gatewayserviceuuid string `json:"l3gatewayserviceuuid"` Niciradevicename string `json:"niciradevicename"` Nvpdeviceid string `json:"nvpdeviceid"` Physicalnetworkid string `json:"physicalnetworkid"` Provider string `json:"provider"` Transportzoneuuid string `json:"transportzoneuuid"` } type DeleteNiciraNvpDeviceParams struct { p map[string]interface{} } func (p *DeleteNiciraNvpDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["nvpdeviceid"]; found { u.Set("nvpdeviceid", v.(string)) } return u } func (p *DeleteNiciraNvpDeviceParams) SetNvpdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nvpdeviceid"] = v return } // You should always use this function to get a new DeleteNiciraNvpDeviceParams instance, // as then you are sure you have configured all required params func (s *NiciraNVPService) NewDeleteNiciraNvpDeviceParams(nvpdeviceid string) *DeleteNiciraNvpDeviceParams { p := &DeleteNiciraNvpDeviceParams{} p.p = make(map[string]interface{}) p.p["nvpdeviceid"] = nvpdeviceid return p } // delete a nicira nvp device func (s *NiciraNVPService) DeleteNiciraNvpDevice(p *DeleteNiciraNvpDeviceParams) (*DeleteNiciraNvpDeviceResponse, error) { resp, err := s.cs.newRequest("deleteNiciraNvpDevice", p.toURLValues()) if err != nil { return nil, err } var r DeleteNiciraNvpDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteNiciraNvpDeviceResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListNiciraNvpDevicesParams struct { p map[string]interface{} } func (p *ListNiciraNvpDevicesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["nvpdeviceid"]; found { u.Set("nvpdeviceid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } return u } func (p *ListNiciraNvpDevicesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNiciraNvpDevicesParams) SetNvpdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nvpdeviceid"] = v return } func (p *ListNiciraNvpDevicesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNiciraNvpDevicesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListNiciraNvpDevicesParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } // You should always use this function to get a new ListNiciraNvpDevicesParams instance, // as then you are sure you have configured all required params func (s *NiciraNVPService) NewListNiciraNvpDevicesParams() *ListNiciraNvpDevicesParams { p := &ListNiciraNvpDevicesParams{} p.p = make(map[string]interface{}) return p } // Lists Nicira NVP devices func (s *NiciraNVPService) ListNiciraNvpDevices(p *ListNiciraNvpDevicesParams) (*ListNiciraNvpDevicesResponse, error) { resp, err := s.cs.newRequest("listNiciraNvpDevices", p.toURLValues()) if err != nil { return nil, err } var r ListNiciraNvpDevicesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNiciraNvpDevicesResponse struct { Count int `json:"count"` NiciraNvpDevices []*NiciraNvpDevice `json:"niciranvpdevice"` } type NiciraNvpDevice struct { Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` L2gatewayserviceuuid string `json:"l2gatewayserviceuuid"` L3gatewayserviceuuid string `json:"l3gatewayserviceuuid"` Niciradevicename string `json:"niciradevicename"` Nvpdeviceid string `json:"nvpdeviceid"` Physicalnetworkid string `json:"physicalnetworkid"` Provider string `json:"provider"` Transportzoneuuid string `json:"transportzoneuuid"` } go-cloudstack-2.9.0/cloudstack/NuageVSPService.go000066400000000000000000000314331364073403100217220ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type AddNuageVspDeviceParams struct { p map[string]interface{} } func (p *AddNuageVspDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["apiversion"]; found { u.Set("apiversion", v.(string)) } if v, found := p.p["hostname"]; found { u.Set("hostname", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["port"]; found { vv := strconv.Itoa(v.(int)) u.Set("port", vv) } if v, found := p.p["retrycount"]; found { vv := strconv.Itoa(v.(int)) u.Set("retrycount", vv) } if v, found := p.p["retryinterval"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("retryinterval", vv) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddNuageVspDeviceParams) SetApiversion(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["apiversion"] = v return } func (p *AddNuageVspDeviceParams) SetHostname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostname"] = v return } func (p *AddNuageVspDeviceParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddNuageVspDeviceParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddNuageVspDeviceParams) SetPort(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["port"] = v return } func (p *AddNuageVspDeviceParams) SetRetrycount(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["retrycount"] = v return } func (p *AddNuageVspDeviceParams) SetRetryinterval(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["retryinterval"] = v return } func (p *AddNuageVspDeviceParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddNuageVspDeviceParams instance, // as then you are sure you have configured all required params func (s *NuageVSPService) NewAddNuageVspDeviceParams(hostname string, password string, physicalnetworkid string, port int, username string) *AddNuageVspDeviceParams { p := &AddNuageVspDeviceParams{} p.p = make(map[string]interface{}) p.p["hostname"] = hostname p.p["password"] = password p.p["physicalnetworkid"] = physicalnetworkid p.p["port"] = port p.p["username"] = username return p } // Adds a Nuage VSP device func (s *NuageVSPService) AddNuageVspDevice(p *AddNuageVspDeviceParams) (*AddNuageVspDeviceResponse, error) { resp, err := s.cs.newRequest("addNuageVspDevice", p.toURLValues()) if err != nil { return nil, err } var r AddNuageVspDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddNuageVspDeviceResponse struct { Apiversion string `json:"apiversion"` Cmsid string `json:"cmsid"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nuagedevicename string `json:"nuagedevicename"` Physicalnetworkid string `json:"physicalnetworkid"` Port int `json:"port"` Provider string `json:"provider"` Retrycount int `json:"retrycount"` Retryinterval int64 `json:"retryinterval"` Vspdeviceid string `json:"vspdeviceid"` } type DeleteNuageVspDeviceParams struct { p map[string]interface{} } func (p *DeleteNuageVspDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["vspdeviceid"]; found { u.Set("vspdeviceid", v.(string)) } return u } func (p *DeleteNuageVspDeviceParams) SetVspdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vspdeviceid"] = v return } // You should always use this function to get a new DeleteNuageVspDeviceParams instance, // as then you are sure you have configured all required params func (s *NuageVSPService) NewDeleteNuageVspDeviceParams(vspdeviceid string) *DeleteNuageVspDeviceParams { p := &DeleteNuageVspDeviceParams{} p.p = make(map[string]interface{}) p.p["vspdeviceid"] = vspdeviceid return p } // delete a nuage vsp device func (s *NuageVSPService) DeleteNuageVspDevice(p *DeleteNuageVspDeviceParams) (*DeleteNuageVspDeviceResponse, error) { resp, err := s.cs.newRequest("deleteNuageVspDevice", p.toURLValues()) if err != nil { return nil, err } var r DeleteNuageVspDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteNuageVspDeviceResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListNuageVspDevicesParams struct { p map[string]interface{} } func (p *ListNuageVspDevicesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["vspdeviceid"]; found { u.Set("vspdeviceid", v.(string)) } return u } func (p *ListNuageVspDevicesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListNuageVspDevicesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListNuageVspDevicesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListNuageVspDevicesParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *ListNuageVspDevicesParams) SetVspdeviceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vspdeviceid"] = v return } // You should always use this function to get a new ListNuageVspDevicesParams instance, // as then you are sure you have configured all required params func (s *NuageVSPService) NewListNuageVspDevicesParams() *ListNuageVspDevicesParams { p := &ListNuageVspDevicesParams{} p.p = make(map[string]interface{}) return p } // Lists Nuage VSP devices func (s *NuageVSPService) ListNuageVspDevices(p *ListNuageVspDevicesParams) (*ListNuageVspDevicesResponse, error) { resp, err := s.cs.newRequest("listNuageVspDevices", p.toURLValues()) if err != nil { return nil, err } var r ListNuageVspDevicesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListNuageVspDevicesResponse struct { Count int `json:"count"` NuageVspDevices []*NuageVspDevice `json:"nuagevspdevice"` } type NuageVspDevice struct { Apiversion string `json:"apiversion"` Cmsid string `json:"cmsid"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nuagedevicename string `json:"nuagedevicename"` Physicalnetworkid string `json:"physicalnetworkid"` Port int `json:"port"` Provider string `json:"provider"` Retrycount int `json:"retrycount"` Retryinterval int64 `json:"retryinterval"` Vspdeviceid string `json:"vspdeviceid"` } type UpdateNuageVspDeviceParams struct { p map[string]interface{} } func (p *UpdateNuageVspDeviceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["apiversion"]; found { u.Set("apiversion", v.(string)) } if v, found := p.p["hostname"]; found { u.Set("hostname", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["port"]; found { vv := strconv.Itoa(v.(int)) u.Set("port", vv) } if v, found := p.p["retrycount"]; found { vv := strconv.Itoa(v.(int)) u.Set("retrycount", vv) } if v, found := p.p["retryinterval"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("retryinterval", vv) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *UpdateNuageVspDeviceParams) SetApiversion(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["apiversion"] = v return } func (p *UpdateNuageVspDeviceParams) SetHostname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostname"] = v return } func (p *UpdateNuageVspDeviceParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *UpdateNuageVspDeviceParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *UpdateNuageVspDeviceParams) SetPort(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["port"] = v return } func (p *UpdateNuageVspDeviceParams) SetRetrycount(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["retrycount"] = v return } func (p *UpdateNuageVspDeviceParams) SetRetryinterval(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["retryinterval"] = v return } func (p *UpdateNuageVspDeviceParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new UpdateNuageVspDeviceParams instance, // as then you are sure you have configured all required params func (s *NuageVSPService) NewUpdateNuageVspDeviceParams(physicalnetworkid string) *UpdateNuageVspDeviceParams { p := &UpdateNuageVspDeviceParams{} p.p = make(map[string]interface{}) p.p["physicalnetworkid"] = physicalnetworkid return p } // Update a Nuage VSP device func (s *NuageVSPService) UpdateNuageVspDevice(p *UpdateNuageVspDeviceParams) (*UpdateNuageVspDeviceResponse, error) { resp, err := s.cs.newRequest("updateNuageVspDevice", p.toURLValues()) if err != nil { return nil, err } var r UpdateNuageVspDeviceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateNuageVspDeviceResponse struct { Apiversion string `json:"apiversion"` Cmsid string `json:"cmsid"` Hostname string `json:"hostname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nuagedevicename string `json:"nuagedevicename"` Physicalnetworkid string `json:"physicalnetworkid"` Port int `json:"port"` Provider string `json:"provider"` Retrycount int `json:"retrycount"` Retryinterval int64 `json:"retryinterval"` Vspdeviceid string `json:"vspdeviceid"` } go-cloudstack-2.9.0/cloudstack/OutofbandManagementService.go000066400000000000000000000222451364073403100242110ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type ChangeOutOfBandManagementPasswordParams struct { p map[string]interface{} } func (p *ChangeOutOfBandManagementPasswordParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } return u } func (p *ChangeOutOfBandManagementPasswordParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *ChangeOutOfBandManagementPasswordParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } // You should always use this function to get a new ChangeOutOfBandManagementPasswordParams instance, // as then you are sure you have configured all required params func (s *OutofbandManagementService) NewChangeOutOfBandManagementPasswordParams(hostid string) *ChangeOutOfBandManagementPasswordParams { p := &ChangeOutOfBandManagementPasswordParams{} p.p = make(map[string]interface{}) p.p["hostid"] = hostid return p } // Changes out-of-band management interface password on the host and updates the interface configuration in CloudStack if the operation succeeds, else reverts the old password func (s *OutofbandManagementService) ChangeOutOfBandManagementPassword(p *ChangeOutOfBandManagementPasswordParams) (*ChangeOutOfBandManagementPasswordResponse, error) { resp, err := s.cs.newRequest("changeOutOfBandManagementPassword", p.toURLValues()) if err != nil { return nil, err } var r ChangeOutOfBandManagementPasswordResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ChangeOutOfBandManagementPasswordResponse struct { Action string `json:"action"` Address string `json:"address"` Description string `json:"description"` Driver string `json:"driver"` Enabled bool `json:"enabled"` Hostid string `json:"hostid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Password string `json:"password"` Port string `json:"port"` Powerstate string `json:"powerstate"` Status bool `json:"status"` Username string `json:"username"` } type ConfigureOutOfBandManagementParams struct { p map[string]interface{} } func (p *ConfigureOutOfBandManagementParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["address"]; found { u.Set("address", v.(string)) } if v, found := p.p["driver"]; found { u.Set("driver", v.(string)) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["port"]; found { u.Set("port", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *ConfigureOutOfBandManagementParams) SetAddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["address"] = v return } func (p *ConfigureOutOfBandManagementParams) SetDriver(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["driver"] = v return } func (p *ConfigureOutOfBandManagementParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *ConfigureOutOfBandManagementParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *ConfigureOutOfBandManagementParams) SetPort(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["port"] = v return } func (p *ConfigureOutOfBandManagementParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new ConfigureOutOfBandManagementParams instance, // as then you are sure you have configured all required params func (s *OutofbandManagementService) NewConfigureOutOfBandManagementParams(address string, driver string, hostid string, password string, port string, username string) *ConfigureOutOfBandManagementParams { p := &ConfigureOutOfBandManagementParams{} p.p = make(map[string]interface{}) p.p["address"] = address p.p["driver"] = driver p.p["hostid"] = hostid p.p["password"] = password p.p["port"] = port p.p["username"] = username return p } // Configures a host's out-of-band management interface func (s *OutofbandManagementService) ConfigureOutOfBandManagement(p *ConfigureOutOfBandManagementParams) (*OutOfBandManagementResponse, error) { resp, err := s.cs.newRequest("configureOutOfBandManagement", p.toURLValues()) if err != nil { return nil, err } var r OutOfBandManagementResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type OutOfBandManagementResponse struct { Action string `json:"action"` Address string `json:"address"` Description string `json:"description"` Driver string `json:"driver"` Enabled bool `json:"enabled"` Hostid string `json:"hostid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Password string `json:"password"` Port string `json:"port"` Powerstate string `json:"powerstate"` Status bool `json:"status"` Username string `json:"username"` } type IssueOutOfBandManagementPowerActionParams struct { p map[string]interface{} } func (p *IssueOutOfBandManagementPowerActionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["action"]; found { u.Set("action", v.(string)) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["timeout"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("timeout", vv) } return u } func (p *IssueOutOfBandManagementPowerActionParams) SetAction(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["action"] = v return } func (p *IssueOutOfBandManagementPowerActionParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *IssueOutOfBandManagementPowerActionParams) SetTimeout(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["timeout"] = v return } // You should always use this function to get a new IssueOutOfBandManagementPowerActionParams instance, // as then you are sure you have configured all required params func (s *OutofbandManagementService) NewIssueOutOfBandManagementPowerActionParams(action string, hostid string) *IssueOutOfBandManagementPowerActionParams { p := &IssueOutOfBandManagementPowerActionParams{} p.p = make(map[string]interface{}) p.p["action"] = action p.p["hostid"] = hostid return p } // Initiates the specified power action to the host's out-of-band management interface func (s *OutofbandManagementService) IssueOutOfBandManagementPowerAction(p *IssueOutOfBandManagementPowerActionParams) (*IssueOutOfBandManagementPowerActionResponse, error) { resp, err := s.cs.newRequest("issueOutOfBandManagementPowerAction", p.toURLValues()) if err != nil { return nil, err } var r IssueOutOfBandManagementPowerActionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type IssueOutOfBandManagementPowerActionResponse struct { Action string `json:"action"` Address string `json:"address"` Description string `json:"description"` Driver string `json:"driver"` Enabled bool `json:"enabled"` Hostid string `json:"hostid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Password string `json:"password"` Port string `json:"port"` Powerstate string `json:"powerstate"` Status bool `json:"status"` Username string `json:"username"` } go-cloudstack-2.9.0/cloudstack/OvsElementService.go000066400000000000000000000145541364073403100223600ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type ConfigureOvsElementParams struct { p map[string]interface{} } func (p *ConfigureOvsElementParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["enabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("enabled", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ConfigureOvsElementParams) SetEnabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enabled"] = v return } func (p *ConfigureOvsElementParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ConfigureOvsElementParams instance, // as then you are sure you have configured all required params func (s *OvsElementService) NewConfigureOvsElementParams(enabled bool, id string) *ConfigureOvsElementParams { p := &ConfigureOvsElementParams{} p.p = make(map[string]interface{}) p.p["enabled"] = enabled p.p["id"] = id return p } // Configures an ovs element. func (s *OvsElementService) ConfigureOvsElement(p *ConfigureOvsElementParams) (*OvsElementResponse, error) { resp, err := s.cs.newRequest("configureOvsElement", p.toURLValues()) if err != nil { return nil, err } var r OvsElementResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type OvsElementResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Enabled bool `json:"enabled"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nspid string `json:"nspid"` Project string `json:"project"` Projectid string `json:"projectid"` } type ListOvsElementsParams struct { p map[string]interface{} } func (p *ListOvsElementsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["enabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("enabled", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["nspid"]; found { u.Set("nspid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListOvsElementsParams) SetEnabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enabled"] = v return } func (p *ListOvsElementsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListOvsElementsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListOvsElementsParams) SetNspid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nspid"] = v return } func (p *ListOvsElementsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListOvsElementsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListOvsElementsParams instance, // as then you are sure you have configured all required params func (s *OvsElementService) NewListOvsElementsParams() *ListOvsElementsParams { p := &ListOvsElementsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *OvsElementService) GetOvsElementByID(id string, opts ...OptionFunc) (*OvsElement, int, error) { p := &ListOvsElementsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListOvsElements(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.OvsElements[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for OvsElement UUID: %s!", id) } // Lists all available ovs elements. func (s *OvsElementService) ListOvsElements(p *ListOvsElementsParams) (*ListOvsElementsResponse, error) { resp, err := s.cs.newRequest("listOvsElements", p.toURLValues()) if err != nil { return nil, err } var r ListOvsElementsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListOvsElementsResponse struct { Count int `json:"count"` OvsElements []*OvsElement `json:"ovselement"` } type OvsElement struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Enabled bool `json:"enabled"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nspid string `json:"nspid"` Project string `json:"project"` Projectid string `json:"projectid"` } go-cloudstack-2.9.0/cloudstack/PodService.go000066400000000000000000000545671364073403100210310ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreatePodParams struct { p map[string]interface{} } func (p *CreatePodParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["endip"]; found { u.Set("endip", v.(string)) } if v, found := p.p["gateway"]; found { u.Set("gateway", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["netmask"]; found { u.Set("netmask", v.(string)) } if v, found := p.p["startip"]; found { u.Set("startip", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreatePodParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *CreatePodParams) SetEndip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endip"] = v return } func (p *CreatePodParams) SetGateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gateway"] = v return } func (p *CreatePodParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreatePodParams) SetNetmask(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["netmask"] = v return } func (p *CreatePodParams) SetStartip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startip"] = v return } func (p *CreatePodParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreatePodParams instance, // as then you are sure you have configured all required params func (s *PodService) NewCreatePodParams(gateway string, name string, netmask string, startip string, zoneid string) *CreatePodParams { p := &CreatePodParams{} p.p = make(map[string]interface{}) p.p["gateway"] = gateway p.p["name"] = name p.p["netmask"] = netmask p.p["startip"] = startip p.p["zoneid"] = zoneid return p } // Creates a new Pod. func (s *PodService) CreatePod(p *CreatePodParams) (*CreatePodResponse, error) { resp, err := s.cs.newRequest("createPod", p.toURLValues()) if err != nil { return nil, err } var r CreatePodResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreatePodResponse struct { Allocationstate string `json:"allocationstate"` Capacity []CreatePodResponseCapacity `json:"capacity"` Endip []string `json:"endip"` Forsystemvms []string `json:"forsystemvms"` Gateway string `json:"gateway"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Netmask string `json:"netmask"` Startip []string `json:"startip"` Vlanid []string `json:"vlanid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type CreatePodResponseCapacity struct { Capacityallocated int64 `json:"capacityallocated"` Capacitytotal int64 `json:"capacitytotal"` Capacityused int64 `json:"capacityused"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Name string `json:"name"` Percentused string `json:"percentused"` Podid string `json:"podid"` Podname string `json:"podname"` Type int `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DedicatePodParams struct { p map[string]interface{} } func (p *DedicatePodParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } return u } func (p *DedicatePodParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DedicatePodParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DedicatePodParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } // You should always use this function to get a new DedicatePodParams instance, // as then you are sure you have configured all required params func (s *PodService) NewDedicatePodParams(domainid string, podid string) *DedicatePodParams { p := &DedicatePodParams{} p.p = make(map[string]interface{}) p.p["domainid"] = domainid p.p["podid"] = podid return p } // Dedicates a Pod. func (s *PodService) DedicatePod(p *DedicatePodParams) (*DedicatePodResponse, error) { resp, err := s.cs.newRequest("dedicatePod", p.toURLValues()) if err != nil { return nil, err } var r DedicatePodResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DedicatePodResponse struct { Accountid string `json:"accountid"` Affinitygroupid string `json:"affinitygroupid"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Podid string `json:"podid"` Podname string `json:"podname"` } type DeletePodParams struct { p map[string]interface{} } func (p *DeletePodParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeletePodParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeletePodParams instance, // as then you are sure you have configured all required params func (s *PodService) NewDeletePodParams(id string) *DeletePodParams { p := &DeletePodParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a Pod. func (s *PodService) DeletePod(p *DeletePodParams) (*DeletePodResponse, error) { resp, err := s.cs.newRequest("deletePod", p.toURLValues()) if err != nil { return nil, err } var r DeletePodResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeletePodResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeletePodResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeletePodResponse return json.Unmarshal(b, (*alias)(r)) } type ListDedicatedPodsParams struct { p map[string]interface{} } func (p *ListDedicatedPodsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["affinitygroupid"]; found { u.Set("affinitygroupid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } return u } func (p *ListDedicatedPodsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListDedicatedPodsParams) SetAffinitygroupid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["affinitygroupid"] = v return } func (p *ListDedicatedPodsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListDedicatedPodsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListDedicatedPodsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListDedicatedPodsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListDedicatedPodsParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } // You should always use this function to get a new ListDedicatedPodsParams instance, // as then you are sure you have configured all required params func (s *PodService) NewListDedicatedPodsParams() *ListDedicatedPodsParams { p := &ListDedicatedPodsParams{} p.p = make(map[string]interface{}) return p } // Lists dedicated pods. func (s *PodService) ListDedicatedPods(p *ListDedicatedPodsParams) (*ListDedicatedPodsResponse, error) { resp, err := s.cs.newRequest("listDedicatedPods", p.toURLValues()) if err != nil { return nil, err } var r ListDedicatedPodsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListDedicatedPodsResponse struct { Count int `json:"count"` DedicatedPods []*DedicatedPod `json:"dedicatedpod"` } type DedicatedPod struct { Accountid string `json:"accountid"` Affinitygroupid string `json:"affinitygroupid"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Podid string `json:"podid"` Podname string `json:"podname"` } type ListPodsParams struct { p map[string]interface{} } func (p *ListPodsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["showcapacities"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("showcapacities", vv) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListPodsParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *ListPodsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListPodsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListPodsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListPodsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListPodsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListPodsParams) SetShowcapacities(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["showcapacities"] = v return } func (p *ListPodsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListPodsParams instance, // as then you are sure you have configured all required params func (s *PodService) NewListPodsParams() *ListPodsParams { p := &ListPodsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *PodService) GetPodID(name string, opts ...OptionFunc) (string, int, error) { p := &ListPodsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListPods(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Pods[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Pods { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *PodService) GetPodByName(name string, opts ...OptionFunc) (*Pod, int, error) { id, count, err := s.GetPodID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetPodByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *PodService) GetPodByID(id string, opts ...OptionFunc) (*Pod, int, error) { p := &ListPodsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListPods(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Pods[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Pod UUID: %s!", id) } // Lists all Pods. func (s *PodService) ListPods(p *ListPodsParams) (*ListPodsResponse, error) { resp, err := s.cs.newRequest("listPods", p.toURLValues()) if err != nil { return nil, err } var r ListPodsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListPodsResponse struct { Count int `json:"count"` Pods []*Pod `json:"pod"` } type Pod struct { Allocationstate string `json:"allocationstate"` Capacity []PodCapacity `json:"capacity"` Endip []string `json:"endip"` Forsystemvms []string `json:"forsystemvms"` Gateway string `json:"gateway"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Netmask string `json:"netmask"` Startip []string `json:"startip"` Vlanid []string `json:"vlanid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type PodCapacity struct { Capacityallocated int64 `json:"capacityallocated"` Capacitytotal int64 `json:"capacitytotal"` Capacityused int64 `json:"capacityused"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Name string `json:"name"` Percentused string `json:"percentused"` Podid string `json:"podid"` Podname string `json:"podname"` Type int `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ReleaseDedicatedPodParams struct { p map[string]interface{} } func (p *ReleaseDedicatedPodParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } return u } func (p *ReleaseDedicatedPodParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } // You should always use this function to get a new ReleaseDedicatedPodParams instance, // as then you are sure you have configured all required params func (s *PodService) NewReleaseDedicatedPodParams(podid string) *ReleaseDedicatedPodParams { p := &ReleaseDedicatedPodParams{} p.p = make(map[string]interface{}) p.p["podid"] = podid return p } // Release the dedication for the pod func (s *PodService) ReleaseDedicatedPod(p *ReleaseDedicatedPodParams) (*ReleaseDedicatedPodResponse, error) { resp, err := s.cs.newRequest("releaseDedicatedPod", p.toURLValues()) if err != nil { return nil, err } var r ReleaseDedicatedPodResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ReleaseDedicatedPodResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type UpdatePodParams struct { p map[string]interface{} } func (p *UpdatePodParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["endip"]; found { u.Set("endip", v.(string)) } if v, found := p.p["gateway"]; found { u.Set("gateway", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["netmask"]; found { u.Set("netmask", v.(string)) } if v, found := p.p["startip"]; found { u.Set("startip", v.(string)) } return u } func (p *UpdatePodParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *UpdatePodParams) SetEndip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endip"] = v return } func (p *UpdatePodParams) SetGateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gateway"] = v return } func (p *UpdatePodParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdatePodParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdatePodParams) SetNetmask(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["netmask"] = v return } func (p *UpdatePodParams) SetStartip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startip"] = v return } // You should always use this function to get a new UpdatePodParams instance, // as then you are sure you have configured all required params func (s *PodService) NewUpdatePodParams(id string) *UpdatePodParams { p := &UpdatePodParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a Pod. func (s *PodService) UpdatePod(p *UpdatePodParams) (*UpdatePodResponse, error) { resp, err := s.cs.newRequest("updatePod", p.toURLValues()) if err != nil { return nil, err } var r UpdatePodResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdatePodResponse struct { Allocationstate string `json:"allocationstate"` Capacity []UpdatePodResponseCapacity `json:"capacity"` Endip []string `json:"endip"` Forsystemvms []string `json:"forsystemvms"` Gateway string `json:"gateway"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Netmask string `json:"netmask"` Startip []string `json:"startip"` Vlanid []string `json:"vlanid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdatePodResponseCapacity struct { Capacityallocated int64 `json:"capacityallocated"` Capacitytotal int64 `json:"capacitytotal"` Capacityused int64 `json:"capacityused"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Name string `json:"name"` Percentused string `json:"percentused"` Podid string `json:"podid"` Podname string `json:"podname"` Type int `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/PoolService.go000066400000000000000000000547501364073403100212120ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateStoragePoolParams struct { p map[string]interface{} } func (p *CreateStoragePoolParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["capacitybytes"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("capacitybytes", vv) } if v, found := p.p["capacityiops"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("capacityiops", vv) } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["managed"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("managed", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["provider"]; found { u.Set("provider", v.(string)) } if v, found := p.p["scope"]; found { u.Set("scope", v.(string)) } if v, found := p.p["tags"]; found { u.Set("tags", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreateStoragePoolParams) SetCapacitybytes(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["capacitybytes"] = v return } func (p *CreateStoragePoolParams) SetCapacityiops(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["capacityiops"] = v return } func (p *CreateStoragePoolParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *CreateStoragePoolParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *CreateStoragePoolParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *CreateStoragePoolParams) SetManaged(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["managed"] = v return } func (p *CreateStoragePoolParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateStoragePoolParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *CreateStoragePoolParams) SetProvider(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["provider"] = v return } func (p *CreateStoragePoolParams) SetScope(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["scope"] = v return } func (p *CreateStoragePoolParams) SetTags(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *CreateStoragePoolParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *CreateStoragePoolParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreateStoragePoolParams instance, // as then you are sure you have configured all required params func (s *PoolService) NewCreateStoragePoolParams(name string, url string, zoneid string) *CreateStoragePoolParams { p := &CreateStoragePoolParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["url"] = url p.p["zoneid"] = zoneid return p } // Creates a storage pool. func (s *PoolService) CreateStoragePool(p *CreateStoragePoolParams) (*CreateStoragePoolResponse, error) { resp, err := s.cs.newRequest("createStoragePool", p.toURLValues()) if err != nil { return nil, err } var r CreateStoragePoolResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateStoragePoolResponse struct { Allocatediops int64 `json:"allocatediops"` Capacityiops int64 `json:"capacityiops"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Disksizeused int64 `json:"disksizeused"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Overprovisionfactor string `json:"overprovisionfactor"` Path string `json:"path"` Podid string `json:"podid"` Podname string `json:"podname"` Provider string `json:"provider"` Scope string `json:"scope"` State string `json:"state"` Storagecapabilities map[string]string `json:"storagecapabilities"` Suitableformigration bool `json:"suitableformigration"` Tags string `json:"tags"` Type string `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DeleteStoragePoolParams struct { p map[string]interface{} } func (p *DeleteStoragePoolParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["forced"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forced", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteStoragePoolParams) SetForced(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forced"] = v return } func (p *DeleteStoragePoolParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteStoragePoolParams instance, // as then you are sure you have configured all required params func (s *PoolService) NewDeleteStoragePoolParams(id string) *DeleteStoragePoolParams { p := &DeleteStoragePoolParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a storage pool. func (s *PoolService) DeleteStoragePool(p *DeleteStoragePoolParams) (*DeleteStoragePoolResponse, error) { resp, err := s.cs.newRequest("deleteStoragePool", p.toURLValues()) if err != nil { return nil, err } var r DeleteStoragePoolResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteStoragePoolResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteStoragePoolResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteStoragePoolResponse return json.Unmarshal(b, (*alias)(r)) } type FindStoragePoolsForMigrationParams struct { p map[string]interface{} } func (p *FindStoragePoolsForMigrationParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *FindStoragePoolsForMigrationParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *FindStoragePoolsForMigrationParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *FindStoragePoolsForMigrationParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *FindStoragePoolsForMigrationParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new FindStoragePoolsForMigrationParams instance, // as then you are sure you have configured all required params func (s *PoolService) NewFindStoragePoolsForMigrationParams(id string) *FindStoragePoolsForMigrationParams { p := &FindStoragePoolsForMigrationParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Lists storage pools available for migration of a volume. func (s *PoolService) FindStoragePoolsForMigration(p *FindStoragePoolsForMigrationParams) (*FindStoragePoolsForMigrationResponse, error) { resp, err := s.cs.newRequest("findStoragePoolsForMigration", p.toURLValues()) if err != nil { return nil, err } var r FindStoragePoolsForMigrationResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type FindStoragePoolsForMigrationResponse struct { Allocatediops int64 `json:"allocatediops"` Capacityiops int64 `json:"capacityiops"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Disksizeused int64 `json:"disksizeused"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Overprovisionfactor string `json:"overprovisionfactor"` Path string `json:"path"` Podid string `json:"podid"` Podname string `json:"podname"` Provider string `json:"provider"` Scope string `json:"scope"` State string `json:"state"` Storagecapabilities map[string]string `json:"storagecapabilities"` Suitableformigration bool `json:"suitableformigration"` Tags string `json:"tags"` Type string `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListStoragePoolsParams struct { p map[string]interface{} } func (p *ListStoragePoolsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ipaddress"]; found { u.Set("ipaddress", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["path"]; found { u.Set("path", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["scope"]; found { u.Set("scope", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListStoragePoolsParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *ListStoragePoolsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListStoragePoolsParams) SetIpaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddress"] = v return } func (p *ListStoragePoolsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListStoragePoolsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListStoragePoolsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListStoragePoolsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListStoragePoolsParams) SetPath(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["path"] = v return } func (p *ListStoragePoolsParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListStoragePoolsParams) SetScope(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["scope"] = v return } func (p *ListStoragePoolsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListStoragePoolsParams instance, // as then you are sure you have configured all required params func (s *PoolService) NewListStoragePoolsParams() *ListStoragePoolsParams { p := &ListStoragePoolsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *PoolService) GetStoragePoolID(name string, opts ...OptionFunc) (string, int, error) { p := &ListStoragePoolsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListStoragePools(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.StoragePools[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.StoragePools { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *PoolService) GetStoragePoolByName(name string, opts ...OptionFunc) (*StoragePool, int, error) { id, count, err := s.GetStoragePoolID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetStoragePoolByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *PoolService) GetStoragePoolByID(id string, opts ...OptionFunc) (*StoragePool, int, error) { p := &ListStoragePoolsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListStoragePools(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.StoragePools[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for StoragePool UUID: %s!", id) } // Lists storage pools. func (s *PoolService) ListStoragePools(p *ListStoragePoolsParams) (*ListStoragePoolsResponse, error) { resp, err := s.cs.newRequest("listStoragePools", p.toURLValues()) if err != nil { return nil, err } var r ListStoragePoolsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListStoragePoolsResponse struct { Count int `json:"count"` StoragePools []*StoragePool `json:"storagepool"` } type StoragePool struct { Allocatediops int64 `json:"allocatediops"` Capacityiops int64 `json:"capacityiops"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Disksizeused int64 `json:"disksizeused"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Overprovisionfactor string `json:"overprovisionfactor"` Path string `json:"path"` Podid string `json:"podid"` Podname string `json:"podname"` Provider string `json:"provider"` Scope string `json:"scope"` State string `json:"state"` Storagecapabilities map[string]string `json:"storagecapabilities"` Suitableformigration bool `json:"suitableformigration"` Tags string `json:"tags"` Type string `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateStoragePoolParams struct { p map[string]interface{} } func (p *UpdateStoragePoolParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["capacitybytes"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("capacitybytes", vv) } if v, found := p.p["capacityiops"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("capacityiops", vv) } if v, found := p.p["enabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("enabled", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["tags"]; found { vv := strings.Join(v.([]string), ",") u.Set("tags", vv) } return u } func (p *UpdateStoragePoolParams) SetCapacitybytes(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["capacitybytes"] = v return } func (p *UpdateStoragePoolParams) SetCapacityiops(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["capacityiops"] = v return } func (p *UpdateStoragePoolParams) SetEnabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enabled"] = v return } func (p *UpdateStoragePoolParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateStoragePoolParams) SetTags(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new UpdateStoragePoolParams instance, // as then you are sure you have configured all required params func (s *PoolService) NewUpdateStoragePoolParams(id string) *UpdateStoragePoolParams { p := &UpdateStoragePoolParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a storage pool. func (s *PoolService) UpdateStoragePool(p *UpdateStoragePoolParams) (*UpdateStoragePoolResponse, error) { resp, err := s.cs.newRequest("updateStoragePool", p.toURLValues()) if err != nil { return nil, err } var r UpdateStoragePoolResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateStoragePoolResponse struct { Allocatediops int64 `json:"allocatediops"` Capacityiops int64 `json:"capacityiops"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Disksizeused int64 `json:"disksizeused"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Overprovisionfactor string `json:"overprovisionfactor"` Path string `json:"path"` Podid string `json:"podid"` Podname string `json:"podname"` Provider string `json:"provider"` Scope string `json:"scope"` State string `json:"state"` Storagecapabilities map[string]string `json:"storagecapabilities"` Suitableformigration bool `json:"suitableformigration"` Tags string `json:"tags"` Type string `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/PortableIPService.go000066400000000000000000000255501364073403100222760ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreatePortableIpRangeParams struct { p map[string]interface{} } func (p *CreatePortableIpRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["endip"]; found { u.Set("endip", v.(string)) } if v, found := p.p["gateway"]; found { u.Set("gateway", v.(string)) } if v, found := p.p["netmask"]; found { u.Set("netmask", v.(string)) } if v, found := p.p["regionid"]; found { vv := strconv.Itoa(v.(int)) u.Set("regionid", vv) } if v, found := p.p["startip"]; found { u.Set("startip", v.(string)) } if v, found := p.p["vlan"]; found { u.Set("vlan", v.(string)) } return u } func (p *CreatePortableIpRangeParams) SetEndip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endip"] = v return } func (p *CreatePortableIpRangeParams) SetGateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gateway"] = v return } func (p *CreatePortableIpRangeParams) SetNetmask(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["netmask"] = v return } func (p *CreatePortableIpRangeParams) SetRegionid(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["regionid"] = v return } func (p *CreatePortableIpRangeParams) SetStartip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startip"] = v return } func (p *CreatePortableIpRangeParams) SetVlan(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } // You should always use this function to get a new CreatePortableIpRangeParams instance, // as then you are sure you have configured all required params func (s *PortableIPService) NewCreatePortableIpRangeParams(endip string, gateway string, netmask string, regionid int, startip string) *CreatePortableIpRangeParams { p := &CreatePortableIpRangeParams{} p.p = make(map[string]interface{}) p.p["endip"] = endip p.p["gateway"] = gateway p.p["netmask"] = netmask p.p["regionid"] = regionid p.p["startip"] = startip return p } // adds a range of portable public IP's to a region func (s *PortableIPService) CreatePortableIpRange(p *CreatePortableIpRangeParams) (*CreatePortableIpRangeResponse, error) { resp, err := s.cs.newRequest("createPortableIpRange", p.toURLValues()) if err != nil { return nil, err } var r CreatePortableIpRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreatePortableIpRangeResponse struct { Endip string `json:"endip"` Gateway string `json:"gateway"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Netmask string `json:"netmask"` Portableipaddress []CreatePortableIpRangeResponsePortableipaddress `json:"portableipaddress"` Regionid int `json:"regionid"` Startip string `json:"startip"` Vlan string `json:"vlan"` } type CreatePortableIpRangeResponsePortableipaddress struct { Accountid string `json:"accountid"` Allocated string `json:"allocated"` Domainid string `json:"domainid"` Ipaddress string `json:"ipaddress"` Networkid string `json:"networkid"` Physicalnetworkid string `json:"physicalnetworkid"` Regionid int `json:"regionid"` State string `json:"state"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` } type DeletePortableIpRangeParams struct { p map[string]interface{} } func (p *DeletePortableIpRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeletePortableIpRangeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeletePortableIpRangeParams instance, // as then you are sure you have configured all required params func (s *PortableIPService) NewDeletePortableIpRangeParams(id string) *DeletePortableIpRangeParams { p := &DeletePortableIpRangeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // deletes a range of portable public IP's associated with a region func (s *PortableIPService) DeletePortableIpRange(p *DeletePortableIpRangeParams) (*DeletePortableIpRangeResponse, error) { resp, err := s.cs.newRequest("deletePortableIpRange", p.toURLValues()) if err != nil { return nil, err } var r DeletePortableIpRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeletePortableIpRangeResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListPortableIpRangesParams struct { p map[string]interface{} } func (p *ListPortableIpRangesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["regionid"]; found { vv := strconv.Itoa(v.(int)) u.Set("regionid", vv) } return u } func (p *ListPortableIpRangesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListPortableIpRangesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListPortableIpRangesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListPortableIpRangesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListPortableIpRangesParams) SetRegionid(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["regionid"] = v return } // You should always use this function to get a new ListPortableIpRangesParams instance, // as then you are sure you have configured all required params func (s *PortableIPService) NewListPortableIpRangesParams() *ListPortableIpRangesParams { p := &ListPortableIpRangesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *PortableIPService) GetPortableIpRangeByID(id string, opts ...OptionFunc) (*PortableIpRange, int, error) { p := &ListPortableIpRangesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListPortableIpRanges(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.PortableIpRanges[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for PortableIpRange UUID: %s!", id) } // list portable IP ranges func (s *PortableIPService) ListPortableIpRanges(p *ListPortableIpRangesParams) (*ListPortableIpRangesResponse, error) { resp, err := s.cs.newRequest("listPortableIpRanges", p.toURLValues()) if err != nil { return nil, err } var r ListPortableIpRangesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListPortableIpRangesResponse struct { Count int `json:"count"` PortableIpRanges []*PortableIpRange `json:"portableiprange"` } type PortableIpRange struct { Endip string `json:"endip"` Gateway string `json:"gateway"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Netmask string `json:"netmask"` Portableipaddress []PortableIpRangePortableipaddress `json:"portableipaddress"` Regionid int `json:"regionid"` Startip string `json:"startip"` Vlan string `json:"vlan"` } type PortableIpRangePortableipaddress struct { Accountid string `json:"accountid"` Allocated string `json:"allocated"` Domainid string `json:"domainid"` Ipaddress string `json:"ipaddress"` Networkid string `json:"networkid"` Physicalnetworkid string `json:"physicalnetworkid"` Regionid int `json:"regionid"` State string `json:"state"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` } go-cloudstack-2.9.0/cloudstack/ProjectService.go000066400000000000000000001111701364073403100216750ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type ActivateProjectParams struct { p map[string]interface{} } func (p *ActivateProjectParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ActivateProjectParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ActivateProjectParams instance, // as then you are sure you have configured all required params func (s *ProjectService) NewActivateProjectParams(id string) *ActivateProjectParams { p := &ActivateProjectParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Activates a project func (s *ProjectService) ActivateProject(p *ActivateProjectParams) (*ActivateProjectResponse, error) { resp, err := s.cs.newRequest("activateProject", p.toURLValues()) if err != nil { return nil, err } var r ActivateProjectResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ActivateProjectResponse struct { Account string `json:"account"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectaccountname string `json:"projectaccountname"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Tags []Tags `json:"tags"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type CreateProjectParams struct { p map[string]interface{} } func (p *CreateProjectParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } return u } func (p *CreateProjectParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateProjectParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *CreateProjectParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateProjectParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } // You should always use this function to get a new CreateProjectParams instance, // as then you are sure you have configured all required params func (s *ProjectService) NewCreateProjectParams(displaytext string, name string) *CreateProjectParams { p := &CreateProjectParams{} p.p = make(map[string]interface{}) p.p["displaytext"] = displaytext p.p["name"] = name return p } // Creates a project func (s *ProjectService) CreateProject(p *CreateProjectParams) (*CreateProjectResponse, error) { resp, err := s.cs.newRequest("createProject", p.toURLValues()) if err != nil { return nil, err } var r CreateProjectResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateProjectResponse struct { Account string `json:"account"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectaccountname string `json:"projectaccountname"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Tags []Tags `json:"tags"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type DeleteProjectParams struct { p map[string]interface{} } func (p *DeleteProjectParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteProjectParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteProjectParams instance, // as then you are sure you have configured all required params func (s *ProjectService) NewDeleteProjectParams(id string) *DeleteProjectParams { p := &DeleteProjectParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a project func (s *ProjectService) DeleteProject(p *DeleteProjectParams) (*DeleteProjectResponse, error) { resp, err := s.cs.newRequest("deleteProject", p.toURLValues()) if err != nil { return nil, err } var r DeleteProjectResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteProjectResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteProjectInvitationParams struct { p map[string]interface{} } func (p *DeleteProjectInvitationParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteProjectInvitationParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteProjectInvitationParams instance, // as then you are sure you have configured all required params func (s *ProjectService) NewDeleteProjectInvitationParams(id string) *DeleteProjectInvitationParams { p := &DeleteProjectInvitationParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes project invitation func (s *ProjectService) DeleteProjectInvitation(p *DeleteProjectInvitationParams) (*DeleteProjectInvitationResponse, error) { resp, err := s.cs.newRequest("deleteProjectInvitation", p.toURLValues()) if err != nil { return nil, err } var r DeleteProjectInvitationResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteProjectInvitationResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListProjectInvitationsParams struct { p map[string]interface{} } func (p *ListProjectInvitationsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["activeonly"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("activeonly", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } return u } func (p *ListProjectInvitationsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListProjectInvitationsParams) SetActiveonly(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["activeonly"] = v return } func (p *ListProjectInvitationsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListProjectInvitationsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListProjectInvitationsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListProjectInvitationsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListProjectInvitationsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListProjectInvitationsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListProjectInvitationsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListProjectInvitationsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListProjectInvitationsParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } // You should always use this function to get a new ListProjectInvitationsParams instance, // as then you are sure you have configured all required params func (s *ProjectService) NewListProjectInvitationsParams() *ListProjectInvitationsParams { p := &ListProjectInvitationsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ProjectService) GetProjectInvitationByID(id string, opts ...OptionFunc) (*ProjectInvitation, int, error) { p := &ListProjectInvitationsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListProjectInvitations(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.ProjectInvitations[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for ProjectInvitation UUID: %s!", id) } // Lists project invitations and provides detailed information for listed invitations func (s *ProjectService) ListProjectInvitations(p *ListProjectInvitationsParams) (*ListProjectInvitationsResponse, error) { resp, err := s.cs.newRequest("listProjectInvitations", p.toURLValues()) if err != nil { return nil, err } var r ListProjectInvitationsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListProjectInvitationsResponse struct { Count int `json:"count"` ProjectInvitations []*ProjectInvitation `json:"projectinvitation"` } type ProjectInvitation struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` State string `json:"state"` } type ListProjectsParams struct { p map[string]interface{} } func (p *ListProjectsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } return u } func (p *ListProjectsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListProjectsParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *ListProjectsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListProjectsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListProjectsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListProjectsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListProjectsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListProjectsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListProjectsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListProjectsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListProjectsParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListProjectsParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new ListProjectsParams instance, // as then you are sure you have configured all required params func (s *ProjectService) NewListProjectsParams() *ListProjectsParams { p := &ListProjectsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ProjectService) GetProjectID(name string, opts ...OptionFunc) (string, int, error) { p := &ListProjectsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListProjects(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Projects[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Projects { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ProjectService) GetProjectByName(name string, opts ...OptionFunc) (*Project, int, error) { id, count, err := s.GetProjectID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetProjectByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ProjectService) GetProjectByID(id string, opts ...OptionFunc) (*Project, int, error) { p := &ListProjectsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListProjects(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Projects[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Project UUID: %s!", id) } // Lists projects and provides detailed information for listed projects func (s *ProjectService) ListProjects(p *ListProjectsParams) (*ListProjectsResponse, error) { resp, err := s.cs.newRequest("listProjects", p.toURLValues()) if err != nil { return nil, err } var r ListProjectsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListProjectsResponse struct { Count int `json:"count"` Projects []*Project `json:"project"` } type Project struct { Account string `json:"account"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectaccountname string `json:"projectaccountname"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Tags []Tags `json:"tags"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type SuspendProjectParams struct { p map[string]interface{} } func (p *SuspendProjectParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *SuspendProjectParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new SuspendProjectParams instance, // as then you are sure you have configured all required params func (s *ProjectService) NewSuspendProjectParams(id string) *SuspendProjectParams { p := &SuspendProjectParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Suspends a project func (s *ProjectService) SuspendProject(p *SuspendProjectParams) (*SuspendProjectResponse, error) { resp, err := s.cs.newRequest("suspendProject", p.toURLValues()) if err != nil { return nil, err } var r SuspendProjectResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type SuspendProjectResponse struct { Account string `json:"account"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectaccountname string `json:"projectaccountname"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Tags []Tags `json:"tags"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type UpdateProjectParams struct { p map[string]interface{} } func (p *UpdateProjectParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateProjectParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *UpdateProjectParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *UpdateProjectParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateProjectParams instance, // as then you are sure you have configured all required params func (s *ProjectService) NewUpdateProjectParams(id string) *UpdateProjectParams { p := &UpdateProjectParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a project func (s *ProjectService) UpdateProject(p *UpdateProjectParams) (*UpdateProjectResponse, error) { resp, err := s.cs.newRequest("updateProject", p.toURLValues()) if err != nil { return nil, err } var r UpdateProjectResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateProjectResponse struct { Account string `json:"account"` Cpuavailable string `json:"cpuavailable"` Cpulimit string `json:"cpulimit"` Cputotal int64 `json:"cputotal"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Ipavailable string `json:"ipavailable"` Iplimit string `json:"iplimit"` Iptotal int64 `json:"iptotal"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memoryavailable string `json:"memoryavailable"` Memorylimit string `json:"memorylimit"` Memorytotal int64 `json:"memorytotal"` Name string `json:"name"` Networkavailable string `json:"networkavailable"` Networklimit string `json:"networklimit"` Networktotal int64 `json:"networktotal"` Primarystorageavailable string `json:"primarystorageavailable"` Primarystoragelimit string `json:"primarystoragelimit"` Primarystoragetotal int64 `json:"primarystoragetotal"` Projectaccountname string `json:"projectaccountname"` Secondarystorageavailable string `json:"secondarystorageavailable"` Secondarystoragelimit string `json:"secondarystoragelimit"` Secondarystoragetotal float64 `json:"secondarystoragetotal"` Snapshotavailable string `json:"snapshotavailable"` Snapshotlimit string `json:"snapshotlimit"` Snapshottotal int64 `json:"snapshottotal"` State string `json:"state"` Tags []Tags `json:"tags"` Templateavailable string `json:"templateavailable"` Templatelimit string `json:"templatelimit"` Templatetotal int64 `json:"templatetotal"` Vmavailable string `json:"vmavailable"` Vmlimit string `json:"vmlimit"` Vmrunning int `json:"vmrunning"` Vmstopped int `json:"vmstopped"` Vmtotal int64 `json:"vmtotal"` Volumeavailable string `json:"volumeavailable"` Volumelimit string `json:"volumelimit"` Volumetotal int64 `json:"volumetotal"` Vpcavailable string `json:"vpcavailable"` Vpclimit string `json:"vpclimit"` Vpctotal int64 `json:"vpctotal"` } type UpdateProjectInvitationParams struct { p map[string]interface{} } func (p *UpdateProjectInvitationParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["accept"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("accept", vv) } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["token"]; found { u.Set("token", v.(string)) } return u } func (p *UpdateProjectInvitationParams) SetAccept(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accept"] = v return } func (p *UpdateProjectInvitationParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *UpdateProjectInvitationParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *UpdateProjectInvitationParams) SetToken(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["token"] = v return } // You should always use this function to get a new UpdateProjectInvitationParams instance, // as then you are sure you have configured all required params func (s *ProjectService) NewUpdateProjectInvitationParams(projectid string) *UpdateProjectInvitationParams { p := &UpdateProjectInvitationParams{} p.p = make(map[string]interface{}) p.p["projectid"] = projectid return p } // Accepts or declines project invitation func (s *ProjectService) UpdateProjectInvitation(p *UpdateProjectInvitationParams) (*UpdateProjectInvitationResponse, error) { resp, err := s.cs.newRequest("updateProjectInvitation", p.toURLValues()) if err != nil { return nil, err } var r UpdateProjectInvitationResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateProjectInvitationResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } go-cloudstack-2.9.0/cloudstack/QuotaService.go000066400000000000000000000031711364073403100213610ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" ) type QuotaIsEnabledParams struct { p map[string]interface{} } func (p *QuotaIsEnabledParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } return u } // You should always use this function to get a new QuotaIsEnabledParams instance, // as then you are sure you have configured all required params func (s *QuotaService) NewQuotaIsEnabledParams() *QuotaIsEnabledParams { p := &QuotaIsEnabledParams{} p.p = make(map[string]interface{}) return p } // Return true if the plugin is enabled func (s *QuotaService) QuotaIsEnabled(p *QuotaIsEnabledParams) (*QuotaIsEnabledResponse, error) { resp, err := s.cs.newRequest("quotaIsEnabled", p.toURLValues()) if err != nil { return nil, err } var r QuotaIsEnabledResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type QuotaIsEnabledResponse struct { Isenabled bool `json:"isenabled"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } go-cloudstack-2.9.0/cloudstack/RegionService.go000066400000000000000000000206361364073403100215200ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type AddRegionParams struct { p map[string]interface{} } func (p *AddRegionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["endpoint"]; found { u.Set("endpoint", v.(string)) } if v, found := p.p["id"]; found { vv := strconv.Itoa(v.(int)) u.Set("id", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } return u } func (p *AddRegionParams) SetEndpoint(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endpoint"] = v return } func (p *AddRegionParams) SetId(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *AddRegionParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } // You should always use this function to get a new AddRegionParams instance, // as then you are sure you have configured all required params func (s *RegionService) NewAddRegionParams(endpoint string, id int, name string) *AddRegionParams { p := &AddRegionParams{} p.p = make(map[string]interface{}) p.p["endpoint"] = endpoint p.p["id"] = id p.p["name"] = name return p } // Adds a Region func (s *RegionService) AddRegion(p *AddRegionParams) (*AddRegionResponse, error) { resp, err := s.cs.newRequest("addRegion", p.toURLValues()) if err != nil { return nil, err } var r AddRegionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddRegionResponse struct { Endpoint string `json:"endpoint"` Gslbserviceenabled bool `json:"gslbserviceenabled"` Id int `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Portableipserviceenabled bool `json:"portableipserviceenabled"` } type ListRegionsParams struct { p map[string]interface{} } func (p *ListRegionsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { vv := strconv.Itoa(v.(int)) u.Set("id", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListRegionsParams) SetId(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListRegionsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListRegionsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListRegionsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListRegionsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListRegionsParams instance, // as then you are sure you have configured all required params func (s *RegionService) NewListRegionsParams() *ListRegionsParams { p := &ListRegionsParams{} p.p = make(map[string]interface{}) return p } // Lists Regions func (s *RegionService) ListRegions(p *ListRegionsParams) (*ListRegionsResponse, error) { resp, err := s.cs.newRequest("listRegions", p.toURLValues()) if err != nil { return nil, err } var r ListRegionsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListRegionsResponse struct { Count int `json:"count"` Regions []*Region `json:"region"` } type Region struct { Endpoint string `json:"endpoint"` Gslbserviceenabled bool `json:"gslbserviceenabled"` Id int `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Portableipserviceenabled bool `json:"portableipserviceenabled"` } type RemoveRegionParams struct { p map[string]interface{} } func (p *RemoveRegionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { vv := strconv.Itoa(v.(int)) u.Set("id", vv) } return u } func (p *RemoveRegionParams) SetId(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RemoveRegionParams instance, // as then you are sure you have configured all required params func (s *RegionService) NewRemoveRegionParams(id int) *RemoveRegionParams { p := &RemoveRegionParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Removes specified region func (s *RegionService) RemoveRegion(p *RemoveRegionParams) (*RemoveRegionResponse, error) { resp, err := s.cs.newRequest("removeRegion", p.toURLValues()) if err != nil { return nil, err } var r RemoveRegionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type RemoveRegionResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *RemoveRegionResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias RemoveRegionResponse return json.Unmarshal(b, (*alias)(r)) } type UpdateRegionParams struct { p map[string]interface{} } func (p *UpdateRegionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["endpoint"]; found { u.Set("endpoint", v.(string)) } if v, found := p.p["id"]; found { vv := strconv.Itoa(v.(int)) u.Set("id", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } return u } func (p *UpdateRegionParams) SetEndpoint(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endpoint"] = v return } func (p *UpdateRegionParams) SetId(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateRegionParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } // You should always use this function to get a new UpdateRegionParams instance, // as then you are sure you have configured all required params func (s *RegionService) NewUpdateRegionParams(id int) *UpdateRegionParams { p := &UpdateRegionParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a region func (s *RegionService) UpdateRegion(p *UpdateRegionParams) (*UpdateRegionResponse, error) { resp, err := s.cs.newRequest("updateRegion", p.toURLValues()) if err != nil { return nil, err } var r UpdateRegionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateRegionResponse struct { Endpoint string `json:"endpoint"` Gslbserviceenabled bool `json:"gslbserviceenabled"` Id int `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Portableipserviceenabled bool `json:"portableipserviceenabled"` } go-cloudstack-2.9.0/cloudstack/ResourcemetadataService.go000066400000000000000000000266211364073403100235650ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" ) type AddResourceDetailParams struct { p map[string]interface{} } func (p *AddResourceDetailParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].key", i), k) u.Set(fmt.Sprintf("details[%d].value", i), m[k]) } } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["resourceid"]; found { u.Set("resourceid", v.(string)) } if v, found := p.p["resourcetype"]; found { u.Set("resourcetype", v.(string)) } return u } func (p *AddResourceDetailParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *AddResourceDetailParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *AddResourceDetailParams) SetResourceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourceid"] = v return } func (p *AddResourceDetailParams) SetResourcetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcetype"] = v return } // You should always use this function to get a new AddResourceDetailParams instance, // as then you are sure you have configured all required params func (s *ResourcemetadataService) NewAddResourceDetailParams(details map[string]string, resourceid string, resourcetype string) *AddResourceDetailParams { p := &AddResourceDetailParams{} p.p = make(map[string]interface{}) p.p["details"] = details p.p["resourceid"] = resourceid p.p["resourcetype"] = resourcetype return p } // Adds detail for the Resource. func (s *ResourcemetadataService) AddResourceDetail(p *AddResourceDetailParams) (*AddResourceDetailResponse, error) { resp, err := s.cs.newRequest("addResourceDetail", p.toURLValues()) if err != nil { return nil, err } var r AddResourceDetailResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddResourceDetailResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type GetVolumeSnapshotDetailsParams struct { p map[string]interface{} } func (p *GetVolumeSnapshotDetailsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["snapshotid"]; found { u.Set("snapshotid", v.(string)) } return u } func (p *GetVolumeSnapshotDetailsParams) SetSnapshotid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["snapshotid"] = v return } // You should always use this function to get a new GetVolumeSnapshotDetailsParams instance, // as then you are sure you have configured all required params func (s *ResourcemetadataService) NewGetVolumeSnapshotDetailsParams(snapshotid string) *GetVolumeSnapshotDetailsParams { p := &GetVolumeSnapshotDetailsParams{} p.p = make(map[string]interface{}) p.p["snapshotid"] = snapshotid return p } // Get Volume Snapshot Details func (s *ResourcemetadataService) GetVolumeSnapshotDetails(p *GetVolumeSnapshotDetailsParams) (*GetVolumeSnapshotDetailsResponse, error) { resp, err := s.cs.newRequest("getVolumeSnapshotDetails", p.toURLValues()) if err != nil { return nil, err } var r GetVolumeSnapshotDetailsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetVolumeSnapshotDetailsResponse struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` VolumeiScsiName string `json:"volumeiScsiName"` } type ListResourceDetailsParams struct { p map[string]interface{} } func (p *ListResourceDetailsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["key"]; found { u.Set("key", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["resourceid"]; found { u.Set("resourceid", v.(string)) } if v, found := p.p["resourcetype"]; found { u.Set("resourcetype", v.(string)) } if v, found := p.p["value"]; found { u.Set("value", v.(string)) } return u } func (p *ListResourceDetailsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListResourceDetailsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListResourceDetailsParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListResourceDetailsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListResourceDetailsParams) SetKey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["key"] = v return } func (p *ListResourceDetailsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListResourceDetailsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListResourceDetailsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListResourceDetailsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListResourceDetailsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListResourceDetailsParams) SetResourceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourceid"] = v return } func (p *ListResourceDetailsParams) SetResourcetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcetype"] = v return } func (p *ListResourceDetailsParams) SetValue(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["value"] = v return } // You should always use this function to get a new ListResourceDetailsParams instance, // as then you are sure you have configured all required params func (s *ResourcemetadataService) NewListResourceDetailsParams(resourcetype string) *ListResourceDetailsParams { p := &ListResourceDetailsParams{} p.p = make(map[string]interface{}) p.p["resourcetype"] = resourcetype return p } // List resource detail(s) func (s *ResourcemetadataService) ListResourceDetails(p *ListResourceDetailsParams) (*ListResourceDetailsResponse, error) { resp, err := s.cs.newRequest("listResourceDetails", p.toURLValues()) if err != nil { return nil, err } var r ListResourceDetailsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListResourceDetailsResponse struct { Count int `json:"count"` ResourceDetails []*ResourceDetail `json:"resourcedetail"` } type ResourceDetail struct { Account string `json:"account"` Customer string `json:"customer"` Domain string `json:"domain"` Domainid string `json:"domainid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Key string `json:"key"` Project string `json:"project"` Projectid string `json:"projectid"` Resourceid string `json:"resourceid"` Resourcetype string `json:"resourcetype"` Value string `json:"value"` } type RemoveResourceDetailParams struct { p map[string]interface{} } func (p *RemoveResourceDetailParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["key"]; found { u.Set("key", v.(string)) } if v, found := p.p["resourceid"]; found { u.Set("resourceid", v.(string)) } if v, found := p.p["resourcetype"]; found { u.Set("resourcetype", v.(string)) } return u } func (p *RemoveResourceDetailParams) SetKey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["key"] = v return } func (p *RemoveResourceDetailParams) SetResourceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourceid"] = v return } func (p *RemoveResourceDetailParams) SetResourcetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcetype"] = v return } // You should always use this function to get a new RemoveResourceDetailParams instance, // as then you are sure you have configured all required params func (s *ResourcemetadataService) NewRemoveResourceDetailParams(resourceid string, resourcetype string) *RemoveResourceDetailParams { p := &RemoveResourceDetailParams{} p.p = make(map[string]interface{}) p.p["resourceid"] = resourceid p.p["resourcetype"] = resourcetype return p } // Removes detail for the Resource. func (s *ResourcemetadataService) RemoveResourceDetail(p *RemoveResourceDetailParams) (*RemoveResourceDetailResponse, error) { resp, err := s.cs.newRequest("removeResourceDetail", p.toURLValues()) if err != nil { return nil, err } var r RemoveResourceDetailResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RemoveResourceDetailResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } go-cloudstack-2.9.0/cloudstack/ResourcetagsService.go000066400000000000000000000301701364073403100227350ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateTagsParams struct { p map[string]interface{} } func (p *CreateTagsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customer"]; found { u.Set("customer", v.(string)) } if v, found := p.p["resourceids"]; found { vv := strings.Join(v.([]string), ",") u.Set("resourceids", vv) } if v, found := p.p["resourcetype"]; found { u.Set("resourcetype", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } return u } func (p *CreateTagsParams) SetCustomer(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customer"] = v return } func (p *CreateTagsParams) SetResourceids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourceids"] = v return } func (p *CreateTagsParams) SetResourcetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcetype"] = v return } func (p *CreateTagsParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new CreateTagsParams instance, // as then you are sure you have configured all required params func (s *ResourcetagsService) NewCreateTagsParams(resourceids []string, resourcetype string, tags map[string]string) *CreateTagsParams { p := &CreateTagsParams{} p.p = make(map[string]interface{}) p.p["resourceids"] = resourceids p.p["resourcetype"] = resourcetype p.p["tags"] = tags return p } // Creates resource tag(s) func (s *ResourcetagsService) CreateTags(p *CreateTagsParams) (*CreateTagsResponse, error) { resp, err := s.cs.newRequest("createTags", p.toURLValues()) if err != nil { return nil, err } var r CreateTagsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateTagsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteTagsParams struct { p map[string]interface{} } func (p *DeleteTagsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["resourceids"]; found { vv := strings.Join(v.([]string), ",") u.Set("resourceids", vv) } if v, found := p.p["resourcetype"]; found { u.Set("resourcetype", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } return u } func (p *DeleteTagsParams) SetResourceids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourceids"] = v return } func (p *DeleteTagsParams) SetResourcetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcetype"] = v return } func (p *DeleteTagsParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new DeleteTagsParams instance, // as then you are sure you have configured all required params func (s *ResourcetagsService) NewDeleteTagsParams(resourceids []string, resourcetype string) *DeleteTagsParams { p := &DeleteTagsParams{} p.p = make(map[string]interface{}) p.p["resourceids"] = resourceids p.p["resourcetype"] = resourcetype return p } // Deleting resource tag(s) func (s *ResourcetagsService) DeleteTags(p *DeleteTagsParams) (*DeleteTagsResponse, error) { resp, err := s.cs.newRequest("deleteTags", p.toURLValues()) if err != nil { return nil, err } var r DeleteTagsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteTagsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListStorageTagsParams struct { p map[string]interface{} } func (p *ListStorageTagsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListStorageTagsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListStorageTagsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListStorageTagsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListStorageTagsParams instance, // as then you are sure you have configured all required params func (s *ResourcetagsService) NewListStorageTagsParams() *ListStorageTagsParams { p := &ListStorageTagsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ResourcetagsService) GetStorageTagID(keyword string, opts ...OptionFunc) (string, int, error) { p := &ListStorageTagsParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListStorageTags(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.StorageTags[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.StorageTags { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // Lists storage tags func (s *ResourcetagsService) ListStorageTags(p *ListStorageTagsParams) (*ListStorageTagsResponse, error) { resp, err := s.cs.newRequest("listStorageTags", p.toURLValues()) if err != nil { return nil, err } var r ListStorageTagsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListStorageTagsResponse struct { Count int `json:"count"` StorageTags []*StorageTag `json:"storagetag"` } type StorageTag struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Poolid int64 `json:"poolid"` } type ListTagsParams struct { p map[string]interface{} } func (p *ListTagsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["customer"]; found { u.Set("customer", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["key"]; found { u.Set("key", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["resourceid"]; found { u.Set("resourceid", v.(string)) } if v, found := p.p["resourcetype"]; found { u.Set("resourcetype", v.(string)) } if v, found := p.p["value"]; found { u.Set("value", v.(string)) } return u } func (p *ListTagsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListTagsParams) SetCustomer(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customer"] = v return } func (p *ListTagsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListTagsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListTagsParams) SetKey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["key"] = v return } func (p *ListTagsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListTagsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListTagsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListTagsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListTagsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListTagsParams) SetResourceid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourceid"] = v return } func (p *ListTagsParams) SetResourcetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["resourcetype"] = v return } func (p *ListTagsParams) SetValue(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["value"] = v return } // You should always use this function to get a new ListTagsParams instance, // as then you are sure you have configured all required params func (s *ResourcetagsService) NewListTagsParams() *ListTagsParams { p := &ListTagsParams{} p.p = make(map[string]interface{}) return p } // List resource tag(s) func (s *ResourcetagsService) ListTags(p *ListTagsParams) (*ListTagsResponse, error) { resp, err := s.cs.newRequest("listTags", p.toURLValues()) if err != nil { return nil, err } var r ListTagsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListTagsResponse struct { Count int `json:"count"` Tags []*Tag `json:"tag"` } type Tag struct { Account string `json:"account"` Customer string `json:"customer"` Domain string `json:"domain"` Domainid string `json:"domainid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Key string `json:"key"` Project string `json:"project"` Projectid string `json:"projectid"` Resourceid string `json:"resourceid"` Resourcetype string `json:"resourcetype"` Value string `json:"value"` } go-cloudstack-2.9.0/cloudstack/RoleService.go000066400000000000000000000434251364073403100211770ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateRoleParams struct { p map[string]interface{} } func (p *CreateRoleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *CreateRoleParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateRoleParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateRoleParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new CreateRoleParams instance, // as then you are sure you have configured all required params func (s *RoleService) NewCreateRoleParams(name string, roleType string) *CreateRoleParams { p := &CreateRoleParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["type"] = roleType return p } // Creates a role func (s *RoleService) CreateRole(p *CreateRoleParams) (*CreateRoleResponse, error) { resp, err := s.cs.newRequest("createRole", p.toURLValues()) if err != nil { return nil, err } var r CreateRoleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateRoleResponse struct { Description string `json:"description"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Type string `json:"type"` } type CreateRolePermissionParams struct { p map[string]interface{} } func (p *CreateRolePermissionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["permission"]; found { u.Set("permission", v.(string)) } if v, found := p.p["roleid"]; found { u.Set("roleid", v.(string)) } if v, found := p.p["rule"]; found { u.Set("rule", v.(string)) } return u } func (p *CreateRolePermissionParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateRolePermissionParams) SetPermission(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["permission"] = v return } func (p *CreateRolePermissionParams) SetRoleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["roleid"] = v return } func (p *CreateRolePermissionParams) SetRule(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["rule"] = v return } // You should always use this function to get a new CreateRolePermissionParams instance, // as then you are sure you have configured all required params func (s *RoleService) NewCreateRolePermissionParams(permission string, roleid string, rule string) *CreateRolePermissionParams { p := &CreateRolePermissionParams{} p.p = make(map[string]interface{}) p.p["permission"] = permission p.p["roleid"] = roleid p.p["rule"] = rule return p } // Adds a API permission to a role func (s *RoleService) CreateRolePermission(p *CreateRolePermissionParams) (*CreateRolePermissionResponse, error) { resp, err := s.cs.newRequest("createRolePermission", p.toURLValues()) if err != nil { return nil, err } var r CreateRolePermissionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateRolePermissionResponse struct { Description string `json:"description"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Permission string `json:"permission"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Rule string `json:"rule"` } type DeleteRoleParams struct { p map[string]interface{} } func (p *DeleteRoleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteRoleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteRoleParams instance, // as then you are sure you have configured all required params func (s *RoleService) NewDeleteRoleParams(id string) *DeleteRoleParams { p := &DeleteRoleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a role func (s *RoleService) DeleteRole(p *DeleteRoleParams) (*DeleteRoleResponse, error) { resp, err := s.cs.newRequest("deleteRole", p.toURLValues()) if err != nil { return nil, err } var r DeleteRoleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteRoleResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteRoleResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteRoleResponse return json.Unmarshal(b, (*alias)(r)) } type DeleteRolePermissionParams struct { p map[string]interface{} } func (p *DeleteRolePermissionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteRolePermissionParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteRolePermissionParams instance, // as then you are sure you have configured all required params func (s *RoleService) NewDeleteRolePermissionParams(id string) *DeleteRolePermissionParams { p := &DeleteRolePermissionParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a role permission func (s *RoleService) DeleteRolePermission(p *DeleteRolePermissionParams) (*DeleteRolePermissionResponse, error) { resp, err := s.cs.newRequest("deleteRolePermission", p.toURLValues()) if err != nil { return nil, err } var r DeleteRolePermissionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteRolePermissionResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteRolePermissionResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteRolePermissionResponse return json.Unmarshal(b, (*alias)(r)) } type ListRolePermissionsParams struct { p map[string]interface{} } func (p *ListRolePermissionsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["roleid"]; found { u.Set("roleid", v.(string)) } return u } func (p *ListRolePermissionsParams) SetRoleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["roleid"] = v return } // You should always use this function to get a new ListRolePermissionsParams instance, // as then you are sure you have configured all required params func (s *RoleService) NewListRolePermissionsParams() *ListRolePermissionsParams { p := &ListRolePermissionsParams{} p.p = make(map[string]interface{}) return p } // Lists role permissions func (s *RoleService) ListRolePermissions(p *ListRolePermissionsParams) (*ListRolePermissionsResponse, error) { resp, err := s.cs.newRequest("listRolePermissions", p.toURLValues()) if err != nil { return nil, err } var r ListRolePermissionsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListRolePermissionsResponse struct { Count int `json:"count"` RolePermissions []*RolePermission `json:"rolepermission"` } type RolePermission struct { Description string `json:"description"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Permission string `json:"permission"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Rule string `json:"rule"` } type ListRolesParams struct { p map[string]interface{} } func (p *ListRolesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *ListRolesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListRolesParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListRolesParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new ListRolesParams instance, // as then you are sure you have configured all required params func (s *RoleService) NewListRolesParams() *ListRolesParams { p := &ListRolesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *RoleService) GetRoleID(name string, opts ...OptionFunc) (string, int, error) { p := &ListRolesParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListRoles(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Roles[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Roles { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *RoleService) GetRoleByName(name string, opts ...OptionFunc) (*Role, int, error) { id, count, err := s.GetRoleID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetRoleByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *RoleService) GetRoleByID(id string, opts ...OptionFunc) (*Role, int, error) { p := &ListRolesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListRoles(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Roles[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Role UUID: %s!", id) } // Lists dynamic roles in CloudStack func (s *RoleService) ListRoles(p *ListRolesParams) (*ListRolesResponse, error) { resp, err := s.cs.newRequest("listRoles", p.toURLValues()) if err != nil { return nil, err } var r ListRolesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListRolesResponse struct { Count int `json:"count"` Roles []*Role `json:"role"` } type Role struct { Description string `json:"description"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Type string `json:"type"` } type UpdateRoleParams struct { p map[string]interface{} } func (p *UpdateRoleParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *UpdateRoleParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *UpdateRoleParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateRoleParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateRoleParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new UpdateRoleParams instance, // as then you are sure you have configured all required params func (s *RoleService) NewUpdateRoleParams(id string) *UpdateRoleParams { p := &UpdateRoleParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a role func (s *RoleService) UpdateRole(p *UpdateRoleParams) (*UpdateRoleResponse, error) { resp, err := s.cs.newRequest("updateRole", p.toURLValues()) if err != nil { return nil, err } var r UpdateRoleResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateRoleResponse struct { Description string `json:"description"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Type string `json:"type"` } type UpdateRolePermissionParams struct { p map[string]interface{} } func (p *UpdateRolePermissionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["permission"]; found { u.Set("permission", v.(string)) } if v, found := p.p["roleid"]; found { u.Set("roleid", v.(string)) } if v, found := p.p["ruleid"]; found { u.Set("ruleid", v.(string)) } if v, found := p.p["ruleorder"]; found { vv := strings.Join(v.([]string), ",") u.Set("ruleorder", vv) } return u } func (p *UpdateRolePermissionParams) SetPermission(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["permission"] = v return } func (p *UpdateRolePermissionParams) SetRoleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["roleid"] = v return } func (p *UpdateRolePermissionParams) SetRuleid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ruleid"] = v return } func (p *UpdateRolePermissionParams) SetRuleorder(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ruleorder"] = v return } // You should always use this function to get a new UpdateRolePermissionParams instance, // as then you are sure you have configured all required params func (s *RoleService) NewUpdateRolePermissionParams(roleid string) *UpdateRolePermissionParams { p := &UpdateRolePermissionParams{} p.p = make(map[string]interface{}) p.p["roleid"] = roleid return p } // Updates a role permission order func (s *RoleService) UpdateRolePermission(p *UpdateRolePermissionParams) (*UpdateRolePermissionResponse, error) { resp, err := s.cs.newRequest("updateRolePermission", p.toURLValues()) if err != nil { return nil, err } var r UpdateRolePermissionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateRolePermissionResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *UpdateRolePermissionResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateRolePermissionResponse return json.Unmarshal(b, (*alias)(r)) } go-cloudstack-2.9.0/cloudstack/RouterService.go000066400000000000000000001115541364073403100215550ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type ChangeServiceForRouterParams struct { p map[string]interface{} } func (p *ChangeServiceForRouterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } return u } func (p *ChangeServiceForRouterParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ChangeServiceForRouterParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } // You should always use this function to get a new ChangeServiceForRouterParams instance, // as then you are sure you have configured all required params func (s *RouterService) NewChangeServiceForRouterParams(id string, serviceofferingid string) *ChangeServiceForRouterParams { p := &ChangeServiceForRouterParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["serviceofferingid"] = serviceofferingid return p } // Upgrades domain router to a new service offering func (s *RouterService) ChangeServiceForRouter(p *ChangeServiceForRouterParams) (*ChangeServiceForRouterResponse, error) { resp, err := s.cs.newRequest("changeServiceForRouter", p.toURLValues()) if err != nil { return nil, err } var r ChangeServiceForRouterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ChangeServiceForRouterResponse struct { Account string `json:"account"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Guestipaddress string `json:"guestipaddress"` Guestmacaddress string `json:"guestmacaddress"` Guestnetmask string `json:"guestnetmask"` Guestnetworkid string `json:"guestnetworkid"` Guestnetworkname string `json:"guestnetworkname"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` Isredundantrouter bool `json:"isredundantrouter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Linklocalnetworkid string `json:"linklocalnetworkid"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Nic []Nic `json:"nic"` Podid string `json:"podid"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicnetworkid string `json:"publicnetworkid"` Redundantstate string `json:"redundantstate"` Requiresupgrade bool `json:"requiresupgrade"` Role string `json:"role"` Scriptsversion string `json:"scriptsversion"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` State string `json:"state"` Templateid string `json:"templateid"` Version string `json:"version"` Vpcid string `json:"vpcid"` Vpcname string `json:"vpcname"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ConfigureVirtualRouterElementParams struct { p map[string]interface{} } func (p *ConfigureVirtualRouterElementParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["enabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("enabled", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ConfigureVirtualRouterElementParams) SetEnabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enabled"] = v return } func (p *ConfigureVirtualRouterElementParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ConfigureVirtualRouterElementParams instance, // as then you are sure you have configured all required params func (s *RouterService) NewConfigureVirtualRouterElementParams(enabled bool, id string) *ConfigureVirtualRouterElementParams { p := &ConfigureVirtualRouterElementParams{} p.p = make(map[string]interface{}) p.p["enabled"] = enabled p.p["id"] = id return p } // Configures a virtual router element. func (s *RouterService) ConfigureVirtualRouterElement(p *ConfigureVirtualRouterElementParams) (*VirtualRouterElementResponse, error) { resp, err := s.cs.newRequest("configureVirtualRouterElement", p.toURLValues()) if err != nil { return nil, err } var r VirtualRouterElementResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type VirtualRouterElementResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Enabled bool `json:"enabled"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nspid string `json:"nspid"` Project string `json:"project"` Projectid string `json:"projectid"` } type CreateVirtualRouterElementParams struct { p map[string]interface{} } func (p *CreateVirtualRouterElementParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["nspid"]; found { u.Set("nspid", v.(string)) } if v, found := p.p["providertype"]; found { u.Set("providertype", v.(string)) } return u } func (p *CreateVirtualRouterElementParams) SetNspid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nspid"] = v return } func (p *CreateVirtualRouterElementParams) SetProvidertype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["providertype"] = v return } // You should always use this function to get a new CreateVirtualRouterElementParams instance, // as then you are sure you have configured all required params func (s *RouterService) NewCreateVirtualRouterElementParams(nspid string) *CreateVirtualRouterElementParams { p := &CreateVirtualRouterElementParams{} p.p = make(map[string]interface{}) p.p["nspid"] = nspid return p } // Create a virtual router element. func (s *RouterService) CreateVirtualRouterElement(p *CreateVirtualRouterElementParams) (*CreateVirtualRouterElementResponse, error) { resp, err := s.cs.newRequest("createVirtualRouterElement", p.toURLValues()) if err != nil { return nil, err } var r CreateVirtualRouterElementResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateVirtualRouterElementResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Enabled bool `json:"enabled"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nspid string `json:"nspid"` Project string `json:"project"` Projectid string `json:"projectid"` } type DestroyRouterParams struct { p map[string]interface{} } func (p *DestroyRouterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DestroyRouterParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DestroyRouterParams instance, // as then you are sure you have configured all required params func (s *RouterService) NewDestroyRouterParams(id string) *DestroyRouterParams { p := &DestroyRouterParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Destroys a router. func (s *RouterService) DestroyRouter(p *DestroyRouterParams) (*DestroyRouterResponse, error) { resp, err := s.cs.newRequest("destroyRouter", p.toURLValues()) if err != nil { return nil, err } var r DestroyRouterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DestroyRouterResponse struct { Account string `json:"account"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Guestipaddress string `json:"guestipaddress"` Guestmacaddress string `json:"guestmacaddress"` Guestnetmask string `json:"guestnetmask"` Guestnetworkid string `json:"guestnetworkid"` Guestnetworkname string `json:"guestnetworkname"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` Isredundantrouter bool `json:"isredundantrouter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Linklocalnetworkid string `json:"linklocalnetworkid"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Nic []Nic `json:"nic"` Podid string `json:"podid"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicnetworkid string `json:"publicnetworkid"` Redundantstate string `json:"redundantstate"` Requiresupgrade bool `json:"requiresupgrade"` Role string `json:"role"` Scriptsversion string `json:"scriptsversion"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` State string `json:"state"` Templateid string `json:"templateid"` Version string `json:"version"` Vpcid string `json:"vpcid"` Vpcname string `json:"vpcname"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListRoutersParams struct { p map[string]interface{} } func (p *ListRoutersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["forvpc"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forvpc", vv) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["version"]; found { u.Set("version", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListRoutersParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListRoutersParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *ListRoutersParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListRoutersParams) SetForvpc(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forvpc"] = v return } func (p *ListRoutersParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *ListRoutersParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListRoutersParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListRoutersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListRoutersParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListRoutersParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListRoutersParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListRoutersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListRoutersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListRoutersParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListRoutersParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListRoutersParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListRoutersParams) SetVersion(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["version"] = v return } func (p *ListRoutersParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } func (p *ListRoutersParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListRoutersParams instance, // as then you are sure you have configured all required params func (s *RouterService) NewListRoutersParams() *ListRoutersParams { p := &ListRoutersParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *RouterService) GetRouterID(name string, opts ...OptionFunc) (string, int, error) { p := &ListRoutersParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListRouters(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Routers[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Routers { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *RouterService) GetRouterByName(name string, opts ...OptionFunc) (*Router, int, error) { id, count, err := s.GetRouterID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetRouterByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *RouterService) GetRouterByID(id string, opts ...OptionFunc) (*Router, int, error) { p := &ListRoutersParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListRouters(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Routers[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Router UUID: %s!", id) } // List routers. func (s *RouterService) ListRouters(p *ListRoutersParams) (*ListRoutersResponse, error) { resp, err := s.cs.newRequest("listRouters", p.toURLValues()) if err != nil { return nil, err } var r ListRoutersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListRoutersResponse struct { Count int `json:"count"` Routers []*Router `json:"router"` } type Router struct { Account string `json:"account"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Guestipaddress string `json:"guestipaddress"` Guestmacaddress string `json:"guestmacaddress"` Guestnetmask string `json:"guestnetmask"` Guestnetworkid string `json:"guestnetworkid"` Guestnetworkname string `json:"guestnetworkname"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` Isredundantrouter bool `json:"isredundantrouter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Linklocalnetworkid string `json:"linklocalnetworkid"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Nic []Nic `json:"nic"` Podid string `json:"podid"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicnetworkid string `json:"publicnetworkid"` Redundantstate string `json:"redundantstate"` Requiresupgrade bool `json:"requiresupgrade"` Role string `json:"role"` Scriptsversion string `json:"scriptsversion"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` State string `json:"state"` Templateid string `json:"templateid"` Version string `json:"version"` Vpcid string `json:"vpcid"` Vpcname string `json:"vpcname"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListVirtualRouterElementsParams struct { p map[string]interface{} } func (p *ListVirtualRouterElementsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["enabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("enabled", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["nspid"]; found { u.Set("nspid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListVirtualRouterElementsParams) SetEnabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enabled"] = v return } func (p *ListVirtualRouterElementsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListVirtualRouterElementsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVirtualRouterElementsParams) SetNspid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nspid"] = v return } func (p *ListVirtualRouterElementsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVirtualRouterElementsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListVirtualRouterElementsParams instance, // as then you are sure you have configured all required params func (s *RouterService) NewListVirtualRouterElementsParams() *ListVirtualRouterElementsParams { p := &ListVirtualRouterElementsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *RouterService) GetVirtualRouterElementByID(id string, opts ...OptionFunc) (*VirtualRouterElement, int, error) { p := &ListVirtualRouterElementsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListVirtualRouterElements(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.VirtualRouterElements[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for VirtualRouterElement UUID: %s!", id) } // Lists all available virtual router elements. func (s *RouterService) ListVirtualRouterElements(p *ListVirtualRouterElementsParams) (*ListVirtualRouterElementsResponse, error) { resp, err := s.cs.newRequest("listVirtualRouterElements", p.toURLValues()) if err != nil { return nil, err } var r ListVirtualRouterElementsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVirtualRouterElementsResponse struct { Count int `json:"count"` VirtualRouterElements []*VirtualRouterElement `json:"virtualrouterelement"` } type VirtualRouterElement struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Enabled bool `json:"enabled"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Nspid string `json:"nspid"` Project string `json:"project"` Projectid string `json:"projectid"` } type RebootRouterParams struct { p map[string]interface{} } func (p *RebootRouterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RebootRouterParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RebootRouterParams instance, // as then you are sure you have configured all required params func (s *RouterService) NewRebootRouterParams(id string) *RebootRouterParams { p := &RebootRouterParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Starts a router. func (s *RouterService) RebootRouter(p *RebootRouterParams) (*RebootRouterResponse, error) { resp, err := s.cs.newRequest("rebootRouter", p.toURLValues()) if err != nil { return nil, err } var r RebootRouterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RebootRouterResponse struct { Account string `json:"account"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Guestipaddress string `json:"guestipaddress"` Guestmacaddress string `json:"guestmacaddress"` Guestnetmask string `json:"guestnetmask"` Guestnetworkid string `json:"guestnetworkid"` Guestnetworkname string `json:"guestnetworkname"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` Isredundantrouter bool `json:"isredundantrouter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Linklocalnetworkid string `json:"linklocalnetworkid"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Nic []Nic `json:"nic"` Podid string `json:"podid"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicnetworkid string `json:"publicnetworkid"` Redundantstate string `json:"redundantstate"` Requiresupgrade bool `json:"requiresupgrade"` Role string `json:"role"` Scriptsversion string `json:"scriptsversion"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` State string `json:"state"` Templateid string `json:"templateid"` Version string `json:"version"` Vpcid string `json:"vpcid"` Vpcname string `json:"vpcname"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type StartRouterParams struct { p map[string]interface{} } func (p *StartRouterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *StartRouterParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new StartRouterParams instance, // as then you are sure you have configured all required params func (s *RouterService) NewStartRouterParams(id string) *StartRouterParams { p := &StartRouterParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Starts a router. func (s *RouterService) StartRouter(p *StartRouterParams) (*StartRouterResponse, error) { resp, err := s.cs.newRequest("startRouter", p.toURLValues()) if err != nil { return nil, err } var r StartRouterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type StartRouterResponse struct { Account string `json:"account"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Guestipaddress string `json:"guestipaddress"` Guestmacaddress string `json:"guestmacaddress"` Guestnetmask string `json:"guestnetmask"` Guestnetworkid string `json:"guestnetworkid"` Guestnetworkname string `json:"guestnetworkname"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` Isredundantrouter bool `json:"isredundantrouter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Linklocalnetworkid string `json:"linklocalnetworkid"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Nic []Nic `json:"nic"` Podid string `json:"podid"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicnetworkid string `json:"publicnetworkid"` Redundantstate string `json:"redundantstate"` Requiresupgrade bool `json:"requiresupgrade"` Role string `json:"role"` Scriptsversion string `json:"scriptsversion"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` State string `json:"state"` Templateid string `json:"templateid"` Version string `json:"version"` Vpcid string `json:"vpcid"` Vpcname string `json:"vpcname"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type StopRouterParams struct { p map[string]interface{} } func (p *StopRouterParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["forced"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forced", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *StopRouterParams) SetForced(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forced"] = v return } func (p *StopRouterParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new StopRouterParams instance, // as then you are sure you have configured all required params func (s *RouterService) NewStopRouterParams(id string) *StopRouterParams { p := &StopRouterParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Stops a router. func (s *RouterService) StopRouter(p *StopRouterParams) (*StopRouterResponse, error) { resp, err := s.cs.newRequest("stopRouter", p.toURLValues()) if err != nil { return nil, err } var r StopRouterResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type StopRouterResponse struct { Account string `json:"account"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Guestipaddress string `json:"guestipaddress"` Guestmacaddress string `json:"guestmacaddress"` Guestnetmask string `json:"guestnetmask"` Guestnetworkid string `json:"guestnetworkid"` Guestnetworkname string `json:"guestnetworkname"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` Isredundantrouter bool `json:"isredundantrouter"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Linklocalnetworkid string `json:"linklocalnetworkid"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Nic []Nic `json:"nic"` Podid string `json:"podid"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicnetworkid string `json:"publicnetworkid"` Redundantstate string `json:"redundantstate"` Requiresupgrade bool `json:"requiresupgrade"` Role string `json:"role"` Scriptsversion string `json:"scriptsversion"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` State string `json:"state"` Templateid string `json:"templateid"` Version string `json:"version"` Vpcid string `json:"vpcid"` Vpcname string `json:"vpcname"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/SSHService.go000066400000000000000000000551751364073403100207400ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type CreateSSHKeyPairParams struct { p map[string]interface{} } func (p *CreateSSHKeyPairParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *CreateSSHKeyPairParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateSSHKeyPairParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateSSHKeyPairParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateSSHKeyPairParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new CreateSSHKeyPairParams instance, // as then you are sure you have configured all required params func (s *SSHService) NewCreateSSHKeyPairParams(name string) *CreateSSHKeyPairParams { p := &CreateSSHKeyPairParams{} p.p = make(map[string]interface{}) p.p["name"] = name return p } // Create a new keypair and returns the private key func (s *SSHService) CreateSSHKeyPair(p *CreateSSHKeyPairParams) (*CreateSSHKeyPairResponse, error) { resp, err := s.cs.newRequest("createSSHKeyPair", p.toURLValues()) if err != nil { return nil, err } if resp, err = getRawValue(resp); err != nil { return nil, err } var r CreateSSHKeyPairResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateSSHKeyPairResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fingerprint string `json:"fingerprint"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Privatekey string `json:"privatekey"` } type DeleteSSHKeyPairParams struct { p map[string]interface{} } func (p *DeleteSSHKeyPairParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *DeleteSSHKeyPairParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DeleteSSHKeyPairParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DeleteSSHKeyPairParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *DeleteSSHKeyPairParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new DeleteSSHKeyPairParams instance, // as then you are sure you have configured all required params func (s *SSHService) NewDeleteSSHKeyPairParams(name string) *DeleteSSHKeyPairParams { p := &DeleteSSHKeyPairParams{} p.p = make(map[string]interface{}) p.p["name"] = name return p } // Deletes a keypair by name func (s *SSHService) DeleteSSHKeyPair(p *DeleteSSHKeyPairParams) (*DeleteSSHKeyPairResponse, error) { resp, err := s.cs.newRequest("deleteSSHKeyPair", p.toURLValues()) if err != nil { return nil, err } var r DeleteSSHKeyPairResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteSSHKeyPairResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteSSHKeyPairResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteSSHKeyPairResponse return json.Unmarshal(b, (*alias)(r)) } type ListSSHKeyPairsParams struct { p map[string]interface{} } func (p *ListSSHKeyPairsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fingerprint"]; found { u.Set("fingerprint", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *ListSSHKeyPairsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListSSHKeyPairsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListSSHKeyPairsParams) SetFingerprint(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fingerprint"] = v return } func (p *ListSSHKeyPairsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListSSHKeyPairsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListSSHKeyPairsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListSSHKeyPairsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListSSHKeyPairsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListSSHKeyPairsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListSSHKeyPairsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new ListSSHKeyPairsParams instance, // as then you are sure you have configured all required params func (s *SSHService) NewListSSHKeyPairsParams() *ListSSHKeyPairsParams { p := &ListSSHKeyPairsParams{} p.p = make(map[string]interface{}) return p } // List registered keypairs func (s *SSHService) ListSSHKeyPairs(p *ListSSHKeyPairsParams) (*ListSSHKeyPairsResponse, error) { resp, err := s.cs.newRequest("listSSHKeyPairs", p.toURLValues()) if err != nil { return nil, err } var r ListSSHKeyPairsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListSSHKeyPairsResponse struct { Count int `json:"count"` SSHKeyPairs []*SSHKeyPair `json:"sshkeypair"` } type SSHKeyPair struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fingerprint string `json:"fingerprint"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` } type RegisterSSHKeyPairParams struct { p map[string]interface{} } func (p *RegisterSSHKeyPairParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["publickey"]; found { u.Set("publickey", v.(string)) } return u } func (p *RegisterSSHKeyPairParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *RegisterSSHKeyPairParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *RegisterSSHKeyPairParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *RegisterSSHKeyPairParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *RegisterSSHKeyPairParams) SetPublickey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publickey"] = v return } // You should always use this function to get a new RegisterSSHKeyPairParams instance, // as then you are sure you have configured all required params func (s *SSHService) NewRegisterSSHKeyPairParams(name string, publickey string) *RegisterSSHKeyPairParams { p := &RegisterSSHKeyPairParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["publickey"] = publickey return p } // Register a public key in a keypair under a certain name func (s *SSHService) RegisterSSHKeyPair(p *RegisterSSHKeyPairParams) (*RegisterSSHKeyPairResponse, error) { resp, err := s.cs.newRequest("registerSSHKeyPair", p.toURLValues()) if err != nil { return nil, err } if resp, err = getRawValue(resp); err != nil { return nil, err } var r RegisterSSHKeyPairResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type RegisterSSHKeyPairResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fingerprint string `json:"fingerprint"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` } type ResetSSHKeyForVirtualMachineParams struct { p map[string]interface{} } func (p *ResetSSHKeyForVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keypair"]; found { u.Set("keypair", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *ResetSSHKeyForVirtualMachineParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ResetSSHKeyForVirtualMachineParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ResetSSHKeyForVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ResetSSHKeyForVirtualMachineParams) SetKeypair(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keypair"] = v return } func (p *ResetSSHKeyForVirtualMachineParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new ResetSSHKeyForVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *SSHService) NewResetSSHKeyForVirtualMachineParams(id string, keypair string) *ResetSSHKeyForVirtualMachineParams { p := &ResetSSHKeyForVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["keypair"] = keypair return p } // Resets the SSH Key for virtual machine. The virtual machine must be in a "Stopped" state. [async] func (s *SSHService) ResetSSHKeyForVirtualMachine(p *ResetSSHKeyForVirtualMachineParams) (*ResetSSHKeyForVirtualMachineResponse, error) { resp, err := s.cs.newRequest("resetSSHKeyForVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r ResetSSHKeyForVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ResetSSHKeyForVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []ResetSSHKeyForVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []ResetSSHKeyForVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ResetSSHKeyForVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []ResetSSHKeyForVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []ResetSSHKeyForVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type ResetSSHKeyForVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type ResetSSHKeyForVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *ResetSSHKeyForVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias ResetSSHKeyForVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } go-cloudstack-2.9.0/cloudstack/SecurityGroupService.go000066400000000000000000000721251364073403100231210ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) // Helper function for maintaining backwards compatibility func convertAuthorizeSecurityGroupIngressResponse(b []byte) ([]byte, error) { var raw struct { Ingressrule []interface{} `json:"ingressrule"` } if err := json.Unmarshal(b, &raw); err != nil { return nil, err } if len(raw.Ingressrule) != 1 { return b, nil } return json.Marshal(raw.Ingressrule[0]) } // Helper function for maintaining backwards compatibility func convertAuthorizeSecurityGroupEgressResponse(b []byte) ([]byte, error) { var raw struct { Egressrule []interface{} `json:"egressrule"` } if err := json.Unmarshal(b, &raw); err != nil { return nil, err } if len(raw.Egressrule) != 1 { return b, nil } return json.Marshal(raw.Egressrule[0]) } type AuthorizeSecurityGroupEgressParams struct { p map[string]interface{} } func (p *AuthorizeSecurityGroupEgressParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["cidrlist"]; found { vv := strings.Join(v.([]string), ",") u.Set("cidrlist", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["endport"]; found { vv := strconv.Itoa(v.(int)) u.Set("endport", vv) } if v, found := p.p["icmpcode"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmpcode", vv) } if v, found := p.p["icmptype"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmptype", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["securitygroupid"]; found { u.Set("securitygroupid", v.(string)) } if v, found := p.p["securitygroupname"]; found { u.Set("securitygroupname", v.(string)) } if v, found := p.p["startport"]; found { vv := strconv.Itoa(v.(int)) u.Set("startport", vv) } if v, found := p.p["usersecuritygrouplist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("usersecuritygrouplist[%d].account", i), k) u.Set(fmt.Sprintf("usersecuritygrouplist[%d].group", i), m[k]) } } return u } func (p *AuthorizeSecurityGroupEgressParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetCidrlist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetEndport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endport"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetIcmpcode(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmpcode"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetIcmptype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmptype"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetSecuritygroupid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupid"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetSecuritygroupname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupname"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetStartport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startport"] = v return } func (p *AuthorizeSecurityGroupEgressParams) SetUsersecuritygrouplist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["usersecuritygrouplist"] = v return } // You should always use this function to get a new AuthorizeSecurityGroupEgressParams instance, // as then you are sure you have configured all required params func (s *SecurityGroupService) NewAuthorizeSecurityGroupEgressParams() *AuthorizeSecurityGroupEgressParams { p := &AuthorizeSecurityGroupEgressParams{} p.p = make(map[string]interface{}) return p } // Authorizes a particular egress rule for this security group func (s *SecurityGroupService) AuthorizeSecurityGroupEgress(p *AuthorizeSecurityGroupEgressParams) (*AuthorizeSecurityGroupEgressResponse, error) { resp, err := s.cs.newRequest("authorizeSecurityGroupEgress", p.toURLValues()) if err != nil { return nil, err } var r AuthorizeSecurityGroupEgressResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } b, err = convertAuthorizeSecurityGroupEgressResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AuthorizeSecurityGroupEgressResponse struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type AuthorizeSecurityGroupIngressParams struct { p map[string]interface{} } func (p *AuthorizeSecurityGroupIngressParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["cidrlist"]; found { vv := strings.Join(v.([]string), ",") u.Set("cidrlist", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["endport"]; found { vv := strconv.Itoa(v.(int)) u.Set("endport", vv) } if v, found := p.p["icmpcode"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmpcode", vv) } if v, found := p.p["icmptype"]; found { vv := strconv.Itoa(v.(int)) u.Set("icmptype", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["protocol"]; found { u.Set("protocol", v.(string)) } if v, found := p.p["securitygroupid"]; found { u.Set("securitygroupid", v.(string)) } if v, found := p.p["securitygroupname"]; found { u.Set("securitygroupname", v.(string)) } if v, found := p.p["startport"]; found { vv := strconv.Itoa(v.(int)) u.Set("startport", vv) } if v, found := p.p["usersecuritygrouplist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("usersecuritygrouplist[%d].account", i), k) u.Set(fmt.Sprintf("usersecuritygrouplist[%d].group", i), m[k]) } } return u } func (p *AuthorizeSecurityGroupIngressParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetCidrlist(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetEndport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endport"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetIcmpcode(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmpcode"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetIcmptype(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["icmptype"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetProtocol(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["protocol"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetSecuritygroupid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupid"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetSecuritygroupname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupname"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetStartport(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startport"] = v return } func (p *AuthorizeSecurityGroupIngressParams) SetUsersecuritygrouplist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["usersecuritygrouplist"] = v return } // You should always use this function to get a new AuthorizeSecurityGroupIngressParams instance, // as then you are sure you have configured all required params func (s *SecurityGroupService) NewAuthorizeSecurityGroupIngressParams() *AuthorizeSecurityGroupIngressParams { p := &AuthorizeSecurityGroupIngressParams{} p.p = make(map[string]interface{}) return p } // Authorizes a particular ingress rule for this security group func (s *SecurityGroupService) AuthorizeSecurityGroupIngress(p *AuthorizeSecurityGroupIngressParams) (*AuthorizeSecurityGroupIngressResponse, error) { resp, err := s.cs.newRequest("authorizeSecurityGroupIngress", p.toURLValues()) if err != nil { return nil, err } var r AuthorizeSecurityGroupIngressResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } b, err = convertAuthorizeSecurityGroupIngressResponse(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AuthorizeSecurityGroupIngressResponse struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type CreateSecurityGroupParams struct { p map[string]interface{} } func (p *CreateSecurityGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *CreateSecurityGroupParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateSecurityGroupParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateSecurityGroupParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateSecurityGroupParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateSecurityGroupParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new CreateSecurityGroupParams instance, // as then you are sure you have configured all required params func (s *SecurityGroupService) NewCreateSecurityGroupParams(name string) *CreateSecurityGroupParams { p := &CreateSecurityGroupParams{} p.p = make(map[string]interface{}) p.p["name"] = name return p } // Creates a security group func (s *SecurityGroupService) CreateSecurityGroup(p *CreateSecurityGroupParams) (*CreateSecurityGroupResponse, error) { resp, err := s.cs.newRequest("createSecurityGroup", p.toURLValues()) if err != nil { return nil, err } if resp, err = getRawValue(resp); err != nil { return nil, err } var r CreateSecurityGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateSecurityGroupResponse struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []CreateSecurityGroupResponseRule `json:"egressrule"` Id string `json:"id"` Ingressrule []CreateSecurityGroupResponseRule `json:"ingressrule"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type CreateSecurityGroupResponseRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type DeleteSecurityGroupParams struct { p map[string]interface{} } func (p *DeleteSecurityGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *DeleteSecurityGroupParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DeleteSecurityGroupParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DeleteSecurityGroupParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *DeleteSecurityGroupParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *DeleteSecurityGroupParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new DeleteSecurityGroupParams instance, // as then you are sure you have configured all required params func (s *SecurityGroupService) NewDeleteSecurityGroupParams() *DeleteSecurityGroupParams { p := &DeleteSecurityGroupParams{} p.p = make(map[string]interface{}) return p } // Deletes security group func (s *SecurityGroupService) DeleteSecurityGroup(p *DeleteSecurityGroupParams) (*DeleteSecurityGroupResponse, error) { resp, err := s.cs.newRequest("deleteSecurityGroup", p.toURLValues()) if err != nil { return nil, err } var r DeleteSecurityGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteSecurityGroupResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteSecurityGroupResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteSecurityGroupResponse return json.Unmarshal(b, (*alias)(r)) } type ListSecurityGroupsParams struct { p map[string]interface{} } func (p *ListSecurityGroupsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["securitygroupname"]; found { u.Set("securitygroupname", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *ListSecurityGroupsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListSecurityGroupsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListSecurityGroupsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListSecurityGroupsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListSecurityGroupsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListSecurityGroupsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListSecurityGroupsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListSecurityGroupsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListSecurityGroupsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListSecurityGroupsParams) SetSecuritygroupname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupname"] = v return } func (p *ListSecurityGroupsParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListSecurityGroupsParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new ListSecurityGroupsParams instance, // as then you are sure you have configured all required params func (s *SecurityGroupService) NewListSecurityGroupsParams() *ListSecurityGroupsParams { p := &ListSecurityGroupsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SecurityGroupService) GetSecurityGroupID(keyword string, opts ...OptionFunc) (string, int, error) { p := &ListSecurityGroupsParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListSecurityGroups(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.SecurityGroups[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.SecurityGroups { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SecurityGroupService) GetSecurityGroupByName(name string, opts ...OptionFunc) (*SecurityGroup, int, error) { id, count, err := s.GetSecurityGroupID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetSecurityGroupByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SecurityGroupService) GetSecurityGroupByID(id string, opts ...OptionFunc) (*SecurityGroup, int, error) { p := &ListSecurityGroupsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListSecurityGroups(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.SecurityGroups[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for SecurityGroup UUID: %s!", id) } // Lists security groups func (s *SecurityGroupService) ListSecurityGroups(p *ListSecurityGroupsParams) (*ListSecurityGroupsResponse, error) { resp, err := s.cs.newRequest("listSecurityGroups", p.toURLValues()) if err != nil { return nil, err } var r ListSecurityGroupsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListSecurityGroupsResponse struct { Count int `json:"count"` SecurityGroups []*SecurityGroup `json:"securitygroup"` } type SecurityGroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []SecurityGroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []SecurityGroupRule `json:"ingressrule"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type SecurityGroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type RevokeSecurityGroupEgressParams struct { p map[string]interface{} } func (p *RevokeSecurityGroupEgressParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RevokeSecurityGroupEgressParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RevokeSecurityGroupEgressParams instance, // as then you are sure you have configured all required params func (s *SecurityGroupService) NewRevokeSecurityGroupEgressParams(id string) *RevokeSecurityGroupEgressParams { p := &RevokeSecurityGroupEgressParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a particular egress rule from this security group func (s *SecurityGroupService) RevokeSecurityGroupEgress(p *RevokeSecurityGroupEgressParams) (*RevokeSecurityGroupEgressResponse, error) { resp, err := s.cs.newRequest("revokeSecurityGroupEgress", p.toURLValues()) if err != nil { return nil, err } var r RevokeSecurityGroupEgressResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RevokeSecurityGroupEgressResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type RevokeSecurityGroupIngressParams struct { p map[string]interface{} } func (p *RevokeSecurityGroupIngressParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RevokeSecurityGroupIngressParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RevokeSecurityGroupIngressParams instance, // as then you are sure you have configured all required params func (s *SecurityGroupService) NewRevokeSecurityGroupIngressParams(id string) *RevokeSecurityGroupIngressParams { p := &RevokeSecurityGroupIngressParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a particular ingress rule from this security group func (s *SecurityGroupService) RevokeSecurityGroupIngress(p *RevokeSecurityGroupIngressParams) (*RevokeSecurityGroupIngressResponse, error) { resp, err := s.cs.newRequest("revokeSecurityGroupIngress", p.toURLValues()) if err != nil { return nil, err } var r RevokeSecurityGroupIngressResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RevokeSecurityGroupIngressResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } go-cloudstack-2.9.0/cloudstack/ServiceOfferingService.go000066400000000000000000000715621364073403100233610ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateServiceOfferingParams struct { p map[string]interface{} } func (p *CreateServiceOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["bytesreadrate"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("bytesreadrate", vv) } if v, found := p.p["bytesreadratemax"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("bytesreadratemax", vv) } if v, found := p.p["bytesreadratemaxlength"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("bytesreadratemaxlength", vv) } if v, found := p.p["byteswriterate"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("byteswriterate", vv) } if v, found := p.p["byteswriteratemax"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("byteswriteratemax", vv) } if v, found := p.p["byteswriteratemaxlength"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("byteswriteratemaxlength", vv) } if v, found := p.p["cpunumber"]; found { vv := strconv.Itoa(v.(int)) u.Set("cpunumber", vv) } if v, found := p.p["cpuspeed"]; found { vv := strconv.Itoa(v.(int)) u.Set("cpuspeed", vv) } if v, found := p.p["customizediops"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("customizediops", vv) } if v, found := p.p["deploymentplanner"]; found { u.Set("deploymentplanner", v.(string)) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["hosttags"]; found { u.Set("hosttags", v.(string)) } if v, found := p.p["hypervisorsnapshotreserve"]; found { vv := strconv.Itoa(v.(int)) u.Set("hypervisorsnapshotreserve", vv) } if v, found := p.p["iopsreadrate"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopsreadrate", vv) } if v, found := p.p["iopsreadratemax"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopsreadratemax", vv) } if v, found := p.p["iopsreadratemaxlength"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopsreadratemaxlength", vv) } if v, found := p.p["iopswriterate"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopswriterate", vv) } if v, found := p.p["iopswriteratemax"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopswriteratemax", vv) } if v, found := p.p["iopswriteratemaxlength"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("iopswriteratemaxlength", vv) } if v, found := p.p["issystem"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("issystem", vv) } if v, found := p.p["isvolatile"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isvolatile", vv) } if v, found := p.p["limitcpuuse"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("limitcpuuse", vv) } if v, found := p.p["maxiops"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("maxiops", vv) } if v, found := p.p["memory"]; found { vv := strconv.Itoa(v.(int)) u.Set("memory", vv) } if v, found := p.p["miniops"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("miniops", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkrate"]; found { vv := strconv.Itoa(v.(int)) u.Set("networkrate", vv) } if v, found := p.p["offerha"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("offerha", vv) } if v, found := p.p["provisioningtype"]; found { u.Set("provisioningtype", v.(string)) } if v, found := p.p["serviceofferingdetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("serviceofferingdetails[%d].key", i), k) u.Set(fmt.Sprintf("serviceofferingdetails[%d].value", i), m[k]) } } if v, found := p.p["storagetype"]; found { u.Set("storagetype", v.(string)) } if v, found := p.p["systemvmtype"]; found { u.Set("systemvmtype", v.(string)) } if v, found := p.p["tags"]; found { u.Set("tags", v.(string)) } return u } func (p *CreateServiceOfferingParams) SetBytesreadrate(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bytesreadrate"] = v return } func (p *CreateServiceOfferingParams) SetBytesreadratemax(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bytesreadratemax"] = v return } func (p *CreateServiceOfferingParams) SetBytesreadratemaxlength(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bytesreadratemaxlength"] = v return } func (p *CreateServiceOfferingParams) SetByteswriterate(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["byteswriterate"] = v return } func (p *CreateServiceOfferingParams) SetByteswriteratemax(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["byteswriteratemax"] = v return } func (p *CreateServiceOfferingParams) SetByteswriteratemaxlength(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["byteswriteratemaxlength"] = v return } func (p *CreateServiceOfferingParams) SetCpunumber(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cpunumber"] = v return } func (p *CreateServiceOfferingParams) SetCpuspeed(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cpuspeed"] = v return } func (p *CreateServiceOfferingParams) SetCustomizediops(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customizediops"] = v return } func (p *CreateServiceOfferingParams) SetDeploymentplanner(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["deploymentplanner"] = v return } func (p *CreateServiceOfferingParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *CreateServiceOfferingParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateServiceOfferingParams) SetHosttags(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hosttags"] = v return } func (p *CreateServiceOfferingParams) SetHypervisorsnapshotreserve(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisorsnapshotreserve"] = v return } func (p *CreateServiceOfferingParams) SetIopsreadrate(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopsreadrate"] = v return } func (p *CreateServiceOfferingParams) SetIopsreadratemax(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopsreadratemax"] = v return } func (p *CreateServiceOfferingParams) SetIopsreadratemaxlength(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopsreadratemaxlength"] = v return } func (p *CreateServiceOfferingParams) SetIopswriterate(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopswriterate"] = v return } func (p *CreateServiceOfferingParams) SetIopswriteratemax(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopswriteratemax"] = v return } func (p *CreateServiceOfferingParams) SetIopswriteratemaxlength(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iopswriteratemaxlength"] = v return } func (p *CreateServiceOfferingParams) SetIssystem(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["issystem"] = v return } func (p *CreateServiceOfferingParams) SetIsvolatile(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isvolatile"] = v return } func (p *CreateServiceOfferingParams) SetLimitcpuuse(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["limitcpuuse"] = v return } func (p *CreateServiceOfferingParams) SetMaxiops(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxiops"] = v return } func (p *CreateServiceOfferingParams) SetMemory(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["memory"] = v return } func (p *CreateServiceOfferingParams) SetMiniops(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["miniops"] = v return } func (p *CreateServiceOfferingParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateServiceOfferingParams) SetNetworkrate(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkrate"] = v return } func (p *CreateServiceOfferingParams) SetOfferha(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["offerha"] = v return } func (p *CreateServiceOfferingParams) SetProvisioningtype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["provisioningtype"] = v return } func (p *CreateServiceOfferingParams) SetServiceofferingdetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingdetails"] = v return } func (p *CreateServiceOfferingParams) SetStoragetype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storagetype"] = v return } func (p *CreateServiceOfferingParams) SetSystemvmtype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["systemvmtype"] = v return } func (p *CreateServiceOfferingParams) SetTags(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new CreateServiceOfferingParams instance, // as then you are sure you have configured all required params func (s *ServiceOfferingService) NewCreateServiceOfferingParams(displaytext string, name string) *CreateServiceOfferingParams { p := &CreateServiceOfferingParams{} p.p = make(map[string]interface{}) p.p["displaytext"] = displaytext p.p["name"] = name return p } // Creates a service offering. func (s *ServiceOfferingService) CreateServiceOffering(p *CreateServiceOfferingParams) (*CreateServiceOfferingResponse, error) { resp, err := s.cs.newRequest("createServiceOffering", p.toURLValues()) if err != nil { return nil, err } if resp, err = getRawValue(resp); err != nil { return nil, err } var r CreateServiceOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateServiceOfferingResponse struct { Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Created string `json:"created"` Defaultuse bool `json:"defaultuse"` Deploymentplanner string `json:"deploymentplanner"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesReadRateMax int64 `json:"diskBytesReadRateMax"` DiskBytesReadRateMaxLength int64 `json:"diskBytesReadRateMaxLength"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskBytesWriteRateMax int64 `json:"diskBytesWriteRateMax"` DiskBytesWriteRateMaxLength int64 `json:"diskBytesWriteRateMaxLength"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsReadRateMax int64 `json:"diskIopsReadRateMax"` DiskIopsReadRateMaxLength int64 `json:"diskIopsReadRateMaxLength"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` DiskIopsWriteRateMax int64 `json:"diskIopsWriteRateMax"` DiskIopsWriteRateMaxLength int64 `json:"diskIopsWriteRateMaxLength"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hosttags string `json:"hosttags"` Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"` Id string `json:"id"` Iscustomized bool `json:"iscustomized"` Iscustomizediops bool `json:"iscustomizediops"` Issystem bool `json:"issystem"` Isvolatile bool `json:"isvolatile"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Limitcpuuse bool `json:"limitcpuuse"` Maxiops int64 `json:"maxiops"` Memory int `json:"memory"` Miniops int64 `json:"miniops"` Name string `json:"name"` Networkrate int `json:"networkrate"` Offerha bool `json:"offerha"` Provisioningtype string `json:"provisioningtype"` Serviceofferingdetails map[string]string `json:"serviceofferingdetails"` Storagetype string `json:"storagetype"` Systemvmtype string `json:"systemvmtype"` Tags string `json:"tags"` } type DeleteServiceOfferingParams struct { p map[string]interface{} } func (p *DeleteServiceOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteServiceOfferingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteServiceOfferingParams instance, // as then you are sure you have configured all required params func (s *ServiceOfferingService) NewDeleteServiceOfferingParams(id string) *DeleteServiceOfferingParams { p := &DeleteServiceOfferingParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a service offering. func (s *ServiceOfferingService) DeleteServiceOffering(p *DeleteServiceOfferingParams) (*DeleteServiceOfferingResponse, error) { resp, err := s.cs.newRequest("deleteServiceOffering", p.toURLValues()) if err != nil { return nil, err } var r DeleteServiceOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteServiceOfferingResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteServiceOfferingResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteServiceOfferingResponse return json.Unmarshal(b, (*alias)(r)) } type ListServiceOfferingsParams struct { p map[string]interface{} } func (p *ListServiceOfferingsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["issystem"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("issystem", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["systemvmtype"]; found { u.Set("systemvmtype", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *ListServiceOfferingsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListServiceOfferingsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListServiceOfferingsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListServiceOfferingsParams) SetIssystem(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["issystem"] = v return } func (p *ListServiceOfferingsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListServiceOfferingsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListServiceOfferingsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListServiceOfferingsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListServiceOfferingsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListServiceOfferingsParams) SetSystemvmtype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["systemvmtype"] = v return } func (p *ListServiceOfferingsParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new ListServiceOfferingsParams instance, // as then you are sure you have configured all required params func (s *ServiceOfferingService) NewListServiceOfferingsParams() *ListServiceOfferingsParams { p := &ListServiceOfferingsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ServiceOfferingService) GetServiceOfferingID(name string, opts ...OptionFunc) (string, int, error) { p := &ListServiceOfferingsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListServiceOfferings(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.ServiceOfferings[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.ServiceOfferings { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ServiceOfferingService) GetServiceOfferingByName(name string, opts ...OptionFunc) (*ServiceOffering, int, error) { id, count, err := s.GetServiceOfferingID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetServiceOfferingByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ServiceOfferingService) GetServiceOfferingByID(id string, opts ...OptionFunc) (*ServiceOffering, int, error) { p := &ListServiceOfferingsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListServiceOfferings(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.ServiceOfferings[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for ServiceOffering UUID: %s!", id) } // Lists all available service offerings. func (s *ServiceOfferingService) ListServiceOfferings(p *ListServiceOfferingsParams) (*ListServiceOfferingsResponse, error) { resp, err := s.cs.newRequest("listServiceOfferings", p.toURLValues()) if err != nil { return nil, err } var r ListServiceOfferingsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListServiceOfferingsResponse struct { Count int `json:"count"` ServiceOfferings []*ServiceOffering `json:"serviceoffering"` } type ServiceOffering struct { Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Created string `json:"created"` Defaultuse bool `json:"defaultuse"` Deploymentplanner string `json:"deploymentplanner"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesReadRateMax int64 `json:"diskBytesReadRateMax"` DiskBytesReadRateMaxLength int64 `json:"diskBytesReadRateMaxLength"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskBytesWriteRateMax int64 `json:"diskBytesWriteRateMax"` DiskBytesWriteRateMaxLength int64 `json:"diskBytesWriteRateMaxLength"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsReadRateMax int64 `json:"diskIopsReadRateMax"` DiskIopsReadRateMaxLength int64 `json:"diskIopsReadRateMaxLength"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` DiskIopsWriteRateMax int64 `json:"diskIopsWriteRateMax"` DiskIopsWriteRateMaxLength int64 `json:"diskIopsWriteRateMaxLength"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hosttags string `json:"hosttags"` Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"` Id string `json:"id"` Iscustomized bool `json:"iscustomized"` Iscustomizediops bool `json:"iscustomizediops"` Issystem bool `json:"issystem"` Isvolatile bool `json:"isvolatile"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Limitcpuuse bool `json:"limitcpuuse"` Maxiops int64 `json:"maxiops"` Memory int `json:"memory"` Miniops int64 `json:"miniops"` Name string `json:"name"` Networkrate int `json:"networkrate"` Offerha bool `json:"offerha"` Provisioningtype string `json:"provisioningtype"` Serviceofferingdetails map[string]string `json:"serviceofferingdetails"` Storagetype string `json:"storagetype"` Systemvmtype string `json:"systemvmtype"` Tags string `json:"tags"` } type UpdateServiceOfferingParams struct { p map[string]interface{} } func (p *UpdateServiceOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["sortkey"]; found { vv := strconv.Itoa(v.(int)) u.Set("sortkey", vv) } return u } func (p *UpdateServiceOfferingParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *UpdateServiceOfferingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateServiceOfferingParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateServiceOfferingParams) SetSortkey(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sortkey"] = v return } // You should always use this function to get a new UpdateServiceOfferingParams instance, // as then you are sure you have configured all required params func (s *ServiceOfferingService) NewUpdateServiceOfferingParams(id string) *UpdateServiceOfferingParams { p := &UpdateServiceOfferingParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a service offering. func (s *ServiceOfferingService) UpdateServiceOffering(p *UpdateServiceOfferingParams) (*UpdateServiceOfferingResponse, error) { resp, err := s.cs.newRequest("updateServiceOffering", p.toURLValues()) if err != nil { return nil, err } var r UpdateServiceOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateServiceOfferingResponse struct { Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Created string `json:"created"` Defaultuse bool `json:"defaultuse"` Deploymentplanner string `json:"deploymentplanner"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesReadRateMax int64 `json:"diskBytesReadRateMax"` DiskBytesReadRateMaxLength int64 `json:"diskBytesReadRateMaxLength"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskBytesWriteRateMax int64 `json:"diskBytesWriteRateMax"` DiskBytesWriteRateMaxLength int64 `json:"diskBytesWriteRateMaxLength"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsReadRateMax int64 `json:"diskIopsReadRateMax"` DiskIopsReadRateMaxLength int64 `json:"diskIopsReadRateMaxLength"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` DiskIopsWriteRateMax int64 `json:"diskIopsWriteRateMax"` DiskIopsWriteRateMaxLength int64 `json:"diskIopsWriteRateMaxLength"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hosttags string `json:"hosttags"` Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"` Id string `json:"id"` Iscustomized bool `json:"iscustomized"` Iscustomizediops bool `json:"iscustomizediops"` Issystem bool `json:"issystem"` Isvolatile bool `json:"isvolatile"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Limitcpuuse bool `json:"limitcpuuse"` Maxiops int64 `json:"maxiops"` Memory int `json:"memory"` Miniops int64 `json:"miniops"` Name string `json:"name"` Networkrate int `json:"networkrate"` Offerha bool `json:"offerha"` Provisioningtype string `json:"provisioningtype"` Serviceofferingdetails map[string]string `json:"serviceofferingdetails"` Storagetype string `json:"storagetype"` Systemvmtype string `json:"systemvmtype"` Tags string `json:"tags"` } go-cloudstack-2.9.0/cloudstack/SnapshotService.go000066400000000000000000001426771364073403100221060ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateSnapshotParams struct { p map[string]interface{} } func (p *CreateSnapshotParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["asyncbackup"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("asyncbackup", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["locationtype"]; found { u.Set("locationtype", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["policyid"]; found { u.Set("policyid", v.(string)) } if v, found := p.p["quiescevm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("quiescevm", vv) } if v, found := p.p["volumeid"]; found { u.Set("volumeid", v.(string)) } return u } func (p *CreateSnapshotParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateSnapshotParams) SetAsyncbackup(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["asyncbackup"] = v return } func (p *CreateSnapshotParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateSnapshotParams) SetLocationtype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["locationtype"] = v return } func (p *CreateSnapshotParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateSnapshotParams) SetPolicyid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["policyid"] = v return } func (p *CreateSnapshotParams) SetQuiescevm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["quiescevm"] = v return } func (p *CreateSnapshotParams) SetVolumeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["volumeid"] = v return } // You should always use this function to get a new CreateSnapshotParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewCreateSnapshotParams(volumeid string) *CreateSnapshotParams { p := &CreateSnapshotParams{} p.p = make(map[string]interface{}) p.p["volumeid"] = volumeid return p } // Creates an instant snapshot of a volume. func (s *SnapshotService) CreateSnapshot(p *CreateSnapshotParams) (*CreateSnapshotResponse, error) { resp, err := s.cs.newRequest("createSnapshot", p.toURLValues()) if err != nil { return nil, err } var r CreateSnapshotResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateSnapshotResponse struct { Account string `json:"account"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Intervaltype string `json:"intervaltype"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Locationtype string `json:"locationtype"` Name string `json:"name"` Osdisplayname string `json:"osdisplayname"` Ostypeid string `json:"ostypeid"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Revertable bool `json:"revertable"` Snapshottype string `json:"snapshottype"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualsize int64 `json:"virtualsize"` Volumeid string `json:"volumeid"` Volumename string `json:"volumename"` Volumetype string `json:"volumetype"` Zoneid string `json:"zoneid"` } func (r *CreateSnapshotResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias CreateSnapshotResponse return json.Unmarshal(b, (*alias)(r)) } type CreateSnapshotPolicyParams struct { p map[string]interface{} } func (p *CreateSnapshotPolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["intervaltype"]; found { u.Set("intervaltype", v.(string)) } if v, found := p.p["maxsnaps"]; found { vv := strconv.Itoa(v.(int)) u.Set("maxsnaps", vv) } if v, found := p.p["schedule"]; found { u.Set("schedule", v.(string)) } if v, found := p.p["timezone"]; found { u.Set("timezone", v.(string)) } if v, found := p.p["volumeid"]; found { u.Set("volumeid", v.(string)) } return u } func (p *CreateSnapshotPolicyParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateSnapshotPolicyParams) SetIntervaltype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["intervaltype"] = v return } func (p *CreateSnapshotPolicyParams) SetMaxsnaps(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxsnaps"] = v return } func (p *CreateSnapshotPolicyParams) SetSchedule(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["schedule"] = v return } func (p *CreateSnapshotPolicyParams) SetTimezone(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["timezone"] = v return } func (p *CreateSnapshotPolicyParams) SetVolumeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["volumeid"] = v return } // You should always use this function to get a new CreateSnapshotPolicyParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewCreateSnapshotPolicyParams(intervaltype string, maxsnaps int, schedule string, timezone string, volumeid string) *CreateSnapshotPolicyParams { p := &CreateSnapshotPolicyParams{} p.p = make(map[string]interface{}) p.p["intervaltype"] = intervaltype p.p["maxsnaps"] = maxsnaps p.p["schedule"] = schedule p.p["timezone"] = timezone p.p["volumeid"] = volumeid return p } // Creates a snapshot policy for the account. func (s *SnapshotService) CreateSnapshotPolicy(p *CreateSnapshotPolicyParams) (*CreateSnapshotPolicyResponse, error) { resp, err := s.cs.newRequest("createSnapshotPolicy", p.toURLValues()) if err != nil { return nil, err } var r CreateSnapshotPolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateSnapshotPolicyResponse struct { Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Intervaltype int `json:"intervaltype"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxsnaps int `json:"maxsnaps"` Schedule string `json:"schedule"` Timezone string `json:"timezone"` Volumeid string `json:"volumeid"` } type CreateVMSnapshotParams struct { p map[string]interface{} } func (p *CreateVMSnapshotParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["description"]; found { u.Set("description", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["quiescevm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("quiescevm", vv) } if v, found := p.p["snapshotmemory"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("snapshotmemory", vv) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *CreateVMSnapshotParams) SetDescription(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["description"] = v return } func (p *CreateVMSnapshotParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateVMSnapshotParams) SetQuiescevm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["quiescevm"] = v return } func (p *CreateVMSnapshotParams) SetSnapshotmemory(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["snapshotmemory"] = v return } func (p *CreateVMSnapshotParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new CreateVMSnapshotParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewCreateVMSnapshotParams(virtualmachineid string) *CreateVMSnapshotParams { p := &CreateVMSnapshotParams{} p.p = make(map[string]interface{}) p.p["virtualmachineid"] = virtualmachineid return p } // Creates snapshot for a vm. func (s *SnapshotService) CreateVMSnapshot(p *CreateVMSnapshotParams) (*CreateVMSnapshotResponse, error) { resp, err := s.cs.newRequest("createVMSnapshot", p.toURLValues()) if err != nil { return nil, err } var r CreateVMSnapshotResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateVMSnapshotResponse struct { Account string `json:"account"` Created string `json:"created"` Current bool `json:"current"` Description string `json:"description"` Displayname string `json:"displayname"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Parent string `json:"parent"` ParentName string `json:"parentName"` Project string `json:"project"` Projectid string `json:"projectid"` State string `json:"state"` Type string `json:"type"` Virtualmachineid string `json:"virtualmachineid"` Zoneid string `json:"zoneid"` } type DeleteSnapshotParams struct { p map[string]interface{} } func (p *DeleteSnapshotParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteSnapshotParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteSnapshotParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewDeleteSnapshotParams(id string) *DeleteSnapshotParams { p := &DeleteSnapshotParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a snapshot of a disk volume. func (s *SnapshotService) DeleteSnapshot(p *DeleteSnapshotParams) (*DeleteSnapshotResponse, error) { resp, err := s.cs.newRequest("deleteSnapshot", p.toURLValues()) if err != nil { return nil, err } var r DeleteSnapshotResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteSnapshotResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteSnapshotPoliciesParams struct { p map[string]interface{} } func (p *DeleteSnapshotPoliciesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ids"]; found { vv := strings.Join(v.([]string), ",") u.Set("ids", vv) } return u } func (p *DeleteSnapshotPoliciesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *DeleteSnapshotPoliciesParams) SetIds(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ids"] = v return } // You should always use this function to get a new DeleteSnapshotPoliciesParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewDeleteSnapshotPoliciesParams() *DeleteSnapshotPoliciesParams { p := &DeleteSnapshotPoliciesParams{} p.p = make(map[string]interface{}) return p } // Deletes snapshot policies for the account. func (s *SnapshotService) DeleteSnapshotPolicies(p *DeleteSnapshotPoliciesParams) (*DeleteSnapshotPoliciesResponse, error) { resp, err := s.cs.newRequest("deleteSnapshotPolicies", p.toURLValues()) if err != nil { return nil, err } var r DeleteSnapshotPoliciesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteSnapshotPoliciesResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteSnapshotPoliciesResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteSnapshotPoliciesResponse return json.Unmarshal(b, (*alias)(r)) } type DeleteVMSnapshotParams struct { p map[string]interface{} } func (p *DeleteVMSnapshotParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["vmsnapshotid"]; found { u.Set("vmsnapshotid", v.(string)) } return u } func (p *DeleteVMSnapshotParams) SetVmsnapshotid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmsnapshotid"] = v return } // You should always use this function to get a new DeleteVMSnapshotParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewDeleteVMSnapshotParams(vmsnapshotid string) *DeleteVMSnapshotParams { p := &DeleteVMSnapshotParams{} p.p = make(map[string]interface{}) p.p["vmsnapshotid"] = vmsnapshotid return p } // Deletes a vmsnapshot. func (s *SnapshotService) DeleteVMSnapshot(p *DeleteVMSnapshotParams) (*DeleteVMSnapshotResponse, error) { resp, err := s.cs.newRequest("deleteVMSnapshot", p.toURLValues()) if err != nil { return nil, err } var r DeleteVMSnapshotResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteVMSnapshotResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListSnapshotPoliciesParams struct { p map[string]interface{} } func (p *ListSnapshotPoliciesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["volumeid"]; found { u.Set("volumeid", v.(string)) } return u } func (p *ListSnapshotPoliciesParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListSnapshotPoliciesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListSnapshotPoliciesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListSnapshotPoliciesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListSnapshotPoliciesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListSnapshotPoliciesParams) SetVolumeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["volumeid"] = v return } // You should always use this function to get a new ListSnapshotPoliciesParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewListSnapshotPoliciesParams() *ListSnapshotPoliciesParams { p := &ListSnapshotPoliciesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SnapshotService) GetSnapshotPolicyByID(id string, opts ...OptionFunc) (*SnapshotPolicy, int, error) { p := &ListSnapshotPoliciesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListSnapshotPolicies(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.SnapshotPolicies[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for SnapshotPolicy UUID: %s!", id) } // Lists snapshot policies. func (s *SnapshotService) ListSnapshotPolicies(p *ListSnapshotPoliciesParams) (*ListSnapshotPoliciesResponse, error) { resp, err := s.cs.newRequest("listSnapshotPolicies", p.toURLValues()) if err != nil { return nil, err } var r ListSnapshotPoliciesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListSnapshotPoliciesResponse struct { Count int `json:"count"` SnapshotPolicies []*SnapshotPolicy `json:"snapshotpolicy"` } type SnapshotPolicy struct { Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Intervaltype int `json:"intervaltype"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxsnaps int `json:"maxsnaps"` Schedule string `json:"schedule"` Timezone string `json:"timezone"` Volumeid string `json:"volumeid"` } type ListSnapshotsParams struct { p map[string]interface{} } func (p *ListSnapshotsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ids"]; found { vv := strings.Join(v.([]string), ",") u.Set("ids", vv) } if v, found := p.p["intervaltype"]; found { u.Set("intervaltype", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["snapshottype"]; found { u.Set("snapshottype", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["volumeid"]; found { u.Set("volumeid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListSnapshotsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListSnapshotsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListSnapshotsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListSnapshotsParams) SetIds(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ids"] = v return } func (p *ListSnapshotsParams) SetIntervaltype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["intervaltype"] = v return } func (p *ListSnapshotsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListSnapshotsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListSnapshotsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListSnapshotsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListSnapshotsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListSnapshotsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListSnapshotsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListSnapshotsParams) SetSnapshottype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["snapshottype"] = v return } func (p *ListSnapshotsParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListSnapshotsParams) SetVolumeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["volumeid"] = v return } func (p *ListSnapshotsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListSnapshotsParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewListSnapshotsParams() *ListSnapshotsParams { p := &ListSnapshotsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SnapshotService) GetSnapshotID(name string, opts ...OptionFunc) (string, int, error) { p := &ListSnapshotsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListSnapshots(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Snapshots[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Snapshots { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SnapshotService) GetSnapshotByName(name string, opts ...OptionFunc) (*Snapshot, int, error) { id, count, err := s.GetSnapshotID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetSnapshotByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SnapshotService) GetSnapshotByID(id string, opts ...OptionFunc) (*Snapshot, int, error) { p := &ListSnapshotsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListSnapshots(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Snapshots[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Snapshot UUID: %s!", id) } // Lists all available snapshots for the account. func (s *SnapshotService) ListSnapshots(p *ListSnapshotsParams) (*ListSnapshotsResponse, error) { resp, err := s.cs.newRequest("listSnapshots", p.toURLValues()) if err != nil { return nil, err } var r ListSnapshotsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListSnapshotsResponse struct { Count int `json:"count"` Snapshots []*Snapshot `json:"snapshot"` } type Snapshot struct { Account string `json:"account"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Intervaltype string `json:"intervaltype"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Locationtype string `json:"locationtype"` Name string `json:"name"` Osdisplayname string `json:"osdisplayname"` Ostypeid string `json:"ostypeid"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Revertable bool `json:"revertable"` Snapshottype string `json:"snapshottype"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualsize int64 `json:"virtualsize"` Volumeid string `json:"volumeid"` Volumename string `json:"volumename"` Volumetype string `json:"volumetype"` Zoneid string `json:"zoneid"` } func (r *Snapshot) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias Snapshot return json.Unmarshal(b, (*alias)(r)) } type ListVMSnapshotParams struct { p map[string]interface{} } func (p *ListVMSnapshotParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } if v, found := p.p["vmsnapshotid"]; found { u.Set("vmsnapshotid", v.(string)) } if v, found := p.p["vmsnapshotids"]; found { vv := strings.Join(v.([]string), ",") u.Set("vmsnapshotids", vv) } return u } func (p *ListVMSnapshotParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListVMSnapshotParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListVMSnapshotParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListVMSnapshotParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVMSnapshotParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListVMSnapshotParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListVMSnapshotParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVMSnapshotParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListVMSnapshotParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListVMSnapshotParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListVMSnapshotParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListVMSnapshotParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } func (p *ListVMSnapshotParams) SetVmsnapshotid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmsnapshotid"] = v return } func (p *ListVMSnapshotParams) SetVmsnapshotids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmsnapshotids"] = v return } // You should always use this function to get a new ListVMSnapshotParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewListVMSnapshotParams() *ListVMSnapshotParams { p := &ListVMSnapshotParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SnapshotService) GetVMSnapshotID(name string, opts ...OptionFunc) (string, int, error) { p := &ListVMSnapshotParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListVMSnapshot(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.VMSnapshot[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.VMSnapshot { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // List virtual machine snapshot by conditions func (s *SnapshotService) ListVMSnapshot(p *ListVMSnapshotParams) (*ListVMSnapshotResponse, error) { resp, err := s.cs.newRequest("listVMSnapshot", p.toURLValues()) if err != nil { return nil, err } var r ListVMSnapshotResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVMSnapshotResponse struct { Count int `json:"count"` VMSnapshot []*VMSnapshot `json:"vmsnapshot"` } type VMSnapshot struct { Account string `json:"account"` Created string `json:"created"` Current bool `json:"current"` Description string `json:"description"` Displayname string `json:"displayname"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Parent string `json:"parent"` ParentName string `json:"parentName"` Project string `json:"project"` Projectid string `json:"projectid"` State string `json:"state"` Type string `json:"type"` Virtualmachineid string `json:"virtualmachineid"` Zoneid string `json:"zoneid"` } type RevertSnapshotParams struct { p map[string]interface{} } func (p *RevertSnapshotParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RevertSnapshotParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RevertSnapshotParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewRevertSnapshotParams(id string) *RevertSnapshotParams { p := &RevertSnapshotParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // This is supposed to revert a volume snapshot. This command is only supported with KVM so far func (s *SnapshotService) RevertSnapshot(p *RevertSnapshotParams) (*RevertSnapshotResponse, error) { resp, err := s.cs.newRequest("revertSnapshot", p.toURLValues()) if err != nil { return nil, err } var r RevertSnapshotResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RevertSnapshotResponse struct { Account string `json:"account"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Intervaltype string `json:"intervaltype"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Locationtype string `json:"locationtype"` Name string `json:"name"` Osdisplayname string `json:"osdisplayname"` Ostypeid string `json:"ostypeid"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Revertable bool `json:"revertable"` Snapshottype string `json:"snapshottype"` State string `json:"state"` Tags []Tags `json:"tags"` Virtualsize int64 `json:"virtualsize"` Volumeid string `json:"volumeid"` Volumename string `json:"volumename"` Volumetype string `json:"volumetype"` Zoneid string `json:"zoneid"` } func (r *RevertSnapshotResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias RevertSnapshotResponse return json.Unmarshal(b, (*alias)(r)) } type RevertToVMSnapshotParams struct { p map[string]interface{} } func (p *RevertToVMSnapshotParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["vmsnapshotid"]; found { u.Set("vmsnapshotid", v.(string)) } return u } func (p *RevertToVMSnapshotParams) SetVmsnapshotid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmsnapshotid"] = v return } // You should always use this function to get a new RevertToVMSnapshotParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewRevertToVMSnapshotParams(vmsnapshotid string) *RevertToVMSnapshotParams { p := &RevertToVMSnapshotParams{} p.p = make(map[string]interface{}) p.p["vmsnapshotid"] = vmsnapshotid return p } // Revert VM from a vmsnapshot. func (s *SnapshotService) RevertToVMSnapshot(p *RevertToVMSnapshotParams) (*RevertToVMSnapshotResponse, error) { resp, err := s.cs.newRequest("revertToVMSnapshot", p.toURLValues()) if err != nil { return nil, err } var r RevertToVMSnapshotResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RevertToVMSnapshotResponse struct { Account string `json:"account"` Affinitygroup []RevertToVMSnapshotResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []RevertToVMSnapshotResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type RevertToVMSnapshotResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []RevertToVMSnapshotResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []RevertToVMSnapshotResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type RevertToVMSnapshotResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type RevertToVMSnapshotResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *RevertToVMSnapshotResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias RevertToVMSnapshotResponse return json.Unmarshal(b, (*alias)(r)) } type UpdateSnapshotPolicyParams struct { p map[string]interface{} } func (p *UpdateSnapshotPolicyParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateSnapshotPolicyParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateSnapshotPolicyParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateSnapshotPolicyParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateSnapshotPolicyParams instance, // as then you are sure you have configured all required params func (s *SnapshotService) NewUpdateSnapshotPolicyParams() *UpdateSnapshotPolicyParams { p := &UpdateSnapshotPolicyParams{} p.p = make(map[string]interface{}) return p } // Updates the snapshot policy. func (s *SnapshotService) UpdateSnapshotPolicy(p *UpdateSnapshotPolicyParams) (*UpdateSnapshotPolicyResponse, error) { resp, err := s.cs.newRequest("updateSnapshotPolicy", p.toURLValues()) if err != nil { return nil, err } var r UpdateSnapshotPolicyResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateSnapshotPolicyResponse struct { Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Intervaltype int `json:"intervaltype"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxsnaps int `json:"maxsnaps"` Schedule string `json:"schedule"` Timezone string `json:"timezone"` Volumeid string `json:"volumeid"` } go-cloudstack-2.9.0/cloudstack/StoragePoolService.go000066400000000000000000000221741364073403100225320ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type CancelStorageMaintenanceParams struct { p map[string]interface{} } func (p *CancelStorageMaintenanceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *CancelStorageMaintenanceParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new CancelStorageMaintenanceParams instance, // as then you are sure you have configured all required params func (s *StoragePoolService) NewCancelStorageMaintenanceParams(id string) *CancelStorageMaintenanceParams { p := &CancelStorageMaintenanceParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Cancels maintenance for primary storage func (s *StoragePoolService) CancelStorageMaintenance(p *CancelStorageMaintenanceParams) (*CancelStorageMaintenanceResponse, error) { resp, err := s.cs.newRequest("cancelStorageMaintenance", p.toURLValues()) if err != nil { return nil, err } var r CancelStorageMaintenanceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CancelStorageMaintenanceResponse struct { Allocatediops int64 `json:"allocatediops"` Capacityiops int64 `json:"capacityiops"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Disksizeused int64 `json:"disksizeused"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Overprovisionfactor string `json:"overprovisionfactor"` Path string `json:"path"` Podid string `json:"podid"` Podname string `json:"podname"` Provider string `json:"provider"` Scope string `json:"scope"` State string `json:"state"` Storagecapabilities map[string]string `json:"storagecapabilities"` Suitableformigration bool `json:"suitableformigration"` Tags string `json:"tags"` Type string `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type EnableStorageMaintenanceParams struct { p map[string]interface{} } func (p *EnableStorageMaintenanceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *EnableStorageMaintenanceParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new EnableStorageMaintenanceParams instance, // as then you are sure you have configured all required params func (s *StoragePoolService) NewEnableStorageMaintenanceParams(id string) *EnableStorageMaintenanceParams { p := &EnableStorageMaintenanceParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Puts storage pool into maintenance state func (s *StoragePoolService) EnableStorageMaintenance(p *EnableStorageMaintenanceParams) (*EnableStorageMaintenanceResponse, error) { resp, err := s.cs.newRequest("enableStorageMaintenance", p.toURLValues()) if err != nil { return nil, err } var r EnableStorageMaintenanceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type EnableStorageMaintenanceResponse struct { Allocatediops int64 `json:"allocatediops"` Capacityiops int64 `json:"capacityiops"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Disksizeallocated int64 `json:"disksizeallocated"` Disksizetotal int64 `json:"disksizetotal"` Disksizeused int64 `json:"disksizeused"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Overprovisionfactor string `json:"overprovisionfactor"` Path string `json:"path"` Podid string `json:"podid"` Podname string `json:"podname"` Provider string `json:"provider"` Scope string `json:"scope"` State string `json:"state"` Storagecapabilities map[string]string `json:"storagecapabilities"` Suitableformigration bool `json:"suitableformigration"` Tags string `json:"tags"` Type string `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListStorageProvidersParams struct { p map[string]interface{} } func (p *ListStorageProvidersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *ListStorageProvidersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListStorageProvidersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListStorageProvidersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListStorageProvidersParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } // You should always use this function to get a new ListStorageProvidersParams instance, // as then you are sure you have configured all required params func (s *StoragePoolService) NewListStorageProvidersParams(storagePoolType string) *ListStorageProvidersParams { p := &ListStorageProvidersParams{} p.p = make(map[string]interface{}) p.p["type"] = storagePoolType return p } // Lists storage providers. func (s *StoragePoolService) ListStorageProviders(p *ListStorageProvidersParams) (*ListStorageProvidersResponse, error) { resp, err := s.cs.newRequest("listStorageProviders", p.toURLValues()) if err != nil { return nil, err } var r ListStorageProvidersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListStorageProvidersResponse struct { Count int `json:"count"` StorageProviders []*StorageProvider `json:"storageprovider"` } type StorageProvider struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Type string `json:"type"` } go-cloudstack-2.9.0/cloudstack/StratosphereSSPService.go000066400000000000000000000121021364073403100233330ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type AddStratosphereSspParams struct { p map[string]interface{} } func (p *AddStratosphereSspParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["tenantuuid"]; found { u.Set("tenantuuid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *AddStratosphereSspParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *AddStratosphereSspParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddStratosphereSspParams) SetTenantuuid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tenantuuid"] = v return } func (p *AddStratosphereSspParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddStratosphereSspParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } func (p *AddStratosphereSspParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new AddStratosphereSspParams instance, // as then you are sure you have configured all required params func (s *StratosphereSSPService) NewAddStratosphereSspParams(name string, url string, zoneid string) *AddStratosphereSspParams { p := &AddStratosphereSspParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["url"] = url p.p["zoneid"] = zoneid return p } // Adds stratosphere ssp server func (s *StratosphereSSPService) AddStratosphereSsp(p *AddStratosphereSspParams) (*AddStratosphereSspResponse, error) { resp, err := s.cs.newRequest("addStratosphereSsp", p.toURLValues()) if err != nil { return nil, err } var r AddStratosphereSspResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddStratosphereSspResponse struct { Hostid string `json:"hostid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Url string `json:"url"` Zoneid string `json:"zoneid"` } type DeleteStratosphereSspParams struct { p map[string]interface{} } func (p *DeleteStratosphereSspParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } return u } func (p *DeleteStratosphereSspParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } // You should always use this function to get a new DeleteStratosphereSspParams instance, // as then you are sure you have configured all required params func (s *StratosphereSSPService) NewDeleteStratosphereSspParams(hostid string) *DeleteStratosphereSspParams { p := &DeleteStratosphereSspParams{} p.p = make(map[string]interface{}) p.p["hostid"] = hostid return p } // Removes stratosphere ssp server func (s *StratosphereSSPService) DeleteStratosphereSsp(p *DeleteStratosphereSspParams) (*DeleteStratosphereSspResponse, error) { resp, err := s.cs.newRequest("deleteStratosphereSsp", p.toURLValues()) if err != nil { return nil, err } var r DeleteStratosphereSspResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteStratosphereSspResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteStratosphereSspResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteStratosphereSspResponse return json.Unmarshal(b, (*alias)(r)) } go-cloudstack-2.9.0/cloudstack/SwiftService.go000066400000000000000000000130471364073403100213670ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" ) type AddSwiftParams struct { p map[string]interface{} } func (p *AddSwiftParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["key"]; found { u.Set("key", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddSwiftParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *AddSwiftParams) SetKey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["key"] = v return } func (p *AddSwiftParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddSwiftParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddSwiftParams instance, // as then you are sure you have configured all required params func (s *SwiftService) NewAddSwiftParams(url string) *AddSwiftParams { p := &AddSwiftParams{} p.p = make(map[string]interface{}) p.p["url"] = url return p } // Adds Swift. func (s *SwiftService) AddSwift(p *AddSwiftParams) (*AddSwiftResponse, error) { resp, err := s.cs.newRequest("addSwift", p.toURLValues()) if err != nil { return nil, err } var r AddSwiftResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddSwiftResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Protocol string `json:"protocol"` Providername string `json:"providername"` Scope string `json:"scope"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListSwiftsParams struct { p map[string]interface{} } func (p *ListSwiftsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("id", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } return u } func (p *ListSwiftsParams) SetId(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListSwiftsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListSwiftsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListSwiftsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } // You should always use this function to get a new ListSwiftsParams instance, // as then you are sure you have configured all required params func (s *SwiftService) NewListSwiftsParams() *ListSwiftsParams { p := &ListSwiftsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SwiftService) GetSwiftID(keyword string, opts ...OptionFunc) (string, int, error) { p := &ListSwiftsParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListSwifts(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.Swifts[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Swifts { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // List Swift. func (s *SwiftService) ListSwifts(p *ListSwiftsParams) (*ListSwiftsResponse, error) { resp, err := s.cs.newRequest("listSwifts", p.toURLValues()) if err != nil { return nil, err } var r ListSwiftsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListSwiftsResponse struct { Count int `json:"count"` Swifts []*Swift `json:"swift"` } type Swift struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Protocol string `json:"protocol"` Providername string `json:"providername"` Scope string `json:"scope"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/SystemCapacityService.go000066400000000000000000000102721364073403100232320ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "net/url" "strconv" ) type ListCapacityParams struct { p map[string]interface{} } func (p *ListCapacityParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["fetchlatest"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fetchlatest", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["sortby"]; found { u.Set("sortby", v.(string)) } if v, found := p.p["type"]; found { vv := strconv.Itoa(v.(int)) u.Set("type", vv) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListCapacityParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *ListCapacityParams) SetFetchlatest(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fetchlatest"] = v return } func (p *ListCapacityParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListCapacityParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListCapacityParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListCapacityParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListCapacityParams) SetSortby(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sortby"] = v return } func (p *ListCapacityParams) SetType(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } func (p *ListCapacityParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListCapacityParams instance, // as then you are sure you have configured all required params func (s *SystemCapacityService) NewListCapacityParams() *ListCapacityParams { p := &ListCapacityParams{} p.p = make(map[string]interface{}) return p } // Lists all the system wide capacities. func (s *SystemCapacityService) ListCapacity(p *ListCapacityParams) (*ListCapacityResponse, error) { resp, err := s.cs.newRequest("listCapacity", p.toURLValues()) if err != nil { return nil, err } var r ListCapacityResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListCapacityResponse struct { Count int `json:"count"` Capacity []*Capacity `json:"capacity"` } type Capacity struct { Capacityallocated int64 `json:"capacityallocated"` Capacitytotal int64 `json:"capacitytotal"` Capacityused int64 `json:"capacityused"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Percentused string `json:"percentused"` Podid string `json:"podid"` Podname string `json:"podname"` Type int `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/SystemVMService.go000066400000000000000000000737461364073403100220360ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type ChangeServiceForSystemVmParams struct { p map[string]interface{} } func (p *ChangeServiceForSystemVmParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } return u } func (p *ChangeServiceForSystemVmParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *ChangeServiceForSystemVmParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ChangeServiceForSystemVmParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } // You should always use this function to get a new ChangeServiceForSystemVmParams instance, // as then you are sure you have configured all required params func (s *SystemVMService) NewChangeServiceForSystemVmParams(id string, serviceofferingid string) *ChangeServiceForSystemVmParams { p := &ChangeServiceForSystemVmParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["serviceofferingid"] = serviceofferingid return p } // Changes the service offering for a system vm (console proxy or secondary storage). The system vm must be in a "Stopped" state for this command to take effect. func (s *SystemVMService) ChangeServiceForSystemVm(p *ChangeServiceForSystemVmParams) (*ChangeServiceForSystemVmResponse, error) { resp, err := s.cs.newRequest("changeServiceForSystemVm", p.toURLValues()) if err != nil { return nil, err } var r ChangeServiceForSystemVmResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ChangeServiceForSystemVmResponse struct { Activeviewersessions int `json:"activeviewersessions"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Gateway string `json:"gateway"` Guestvlan string `json:"guestvlan"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Podid string `json:"podid"` Privateip string `json:"privateip"` Privatemacaddress string `json:"privatemacaddress"` Privatenetmask string `json:"privatenetmask"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicvlan []string `json:"publicvlan"` State string `json:"state"` Systemvmtype string `json:"systemvmtype"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DestroySystemVmParams struct { p map[string]interface{} } func (p *DestroySystemVmParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DestroySystemVmParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DestroySystemVmParams instance, // as then you are sure you have configured all required params func (s *SystemVMService) NewDestroySystemVmParams(id string) *DestroySystemVmParams { p := &DestroySystemVmParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Destroyes a system virtual machine. func (s *SystemVMService) DestroySystemVm(p *DestroySystemVmParams) (*DestroySystemVmResponse, error) { resp, err := s.cs.newRequest("destroySystemVm", p.toURLValues()) if err != nil { return nil, err } var r DestroySystemVmResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DestroySystemVmResponse struct { Activeviewersessions int `json:"activeviewersessions"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Gateway string `json:"gateway"` Guestvlan string `json:"guestvlan"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Podid string `json:"podid"` Privateip string `json:"privateip"` Privatemacaddress string `json:"privatemacaddress"` Privatenetmask string `json:"privatenetmask"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicvlan []string `json:"publicvlan"` State string `json:"state"` Systemvmtype string `json:"systemvmtype"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListSystemVmsParams struct { p map[string]interface{} } func (p *ListSystemVmsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["storageid"]; found { u.Set("storageid", v.(string)) } if v, found := p.p["systemvmtype"]; found { u.Set("systemvmtype", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListSystemVmsParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *ListSystemVmsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListSystemVmsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListSystemVmsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListSystemVmsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListSystemVmsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListSystemVmsParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListSystemVmsParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListSystemVmsParams) SetStorageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storageid"] = v return } func (p *ListSystemVmsParams) SetSystemvmtype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["systemvmtype"] = v return } func (p *ListSystemVmsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListSystemVmsParams instance, // as then you are sure you have configured all required params func (s *SystemVMService) NewListSystemVmsParams() *ListSystemVmsParams { p := &ListSystemVmsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SystemVMService) GetSystemVmID(name string, opts ...OptionFunc) (string, int, error) { p := &ListSystemVmsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListSystemVms(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.SystemVms[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.SystemVms { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SystemVMService) GetSystemVmByName(name string, opts ...OptionFunc) (*SystemVm, int, error) { id, count, err := s.GetSystemVmID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetSystemVmByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *SystemVMService) GetSystemVmByID(id string, opts ...OptionFunc) (*SystemVm, int, error) { p := &ListSystemVmsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListSystemVms(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.SystemVms[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for SystemVm UUID: %s!", id) } // List system virtual machines. func (s *SystemVMService) ListSystemVms(p *ListSystemVmsParams) (*ListSystemVmsResponse, error) { resp, err := s.cs.newRequest("listSystemVms", p.toURLValues()) if err != nil { return nil, err } var r ListSystemVmsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListSystemVmsResponse struct { Count int `json:"count"` SystemVms []*SystemVm `json:"systemvm"` } type SystemVm struct { Activeviewersessions int `json:"activeviewersessions"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Gateway string `json:"gateway"` Guestvlan string `json:"guestvlan"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Podid string `json:"podid"` Privateip string `json:"privateip"` Privatemacaddress string `json:"privatemacaddress"` Privatenetmask string `json:"privatenetmask"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicvlan []string `json:"publicvlan"` State string `json:"state"` Systemvmtype string `json:"systemvmtype"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type MigrateSystemVmParams struct { p map[string]interface{} } func (p *MigrateSystemVmParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *MigrateSystemVmParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *MigrateSystemVmParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new MigrateSystemVmParams instance, // as then you are sure you have configured all required params func (s *SystemVMService) NewMigrateSystemVmParams(hostid string, virtualmachineid string) *MigrateSystemVmParams { p := &MigrateSystemVmParams{} p.p = make(map[string]interface{}) p.p["hostid"] = hostid p.p["virtualmachineid"] = virtualmachineid return p } // Attempts Migration of a system virtual machine to the host specified. func (s *SystemVMService) MigrateSystemVm(p *MigrateSystemVmParams) (*MigrateSystemVmResponse, error) { resp, err := s.cs.newRequest("migrateSystemVm", p.toURLValues()) if err != nil { return nil, err } var r MigrateSystemVmResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type MigrateSystemVmResponse struct { Activeviewersessions int `json:"activeviewersessions"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Gateway string `json:"gateway"` Guestvlan string `json:"guestvlan"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Podid string `json:"podid"` Privateip string `json:"privateip"` Privatemacaddress string `json:"privatemacaddress"` Privatenetmask string `json:"privatenetmask"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicvlan []string `json:"publicvlan"` State string `json:"state"` Systemvmtype string `json:"systemvmtype"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type RebootSystemVmParams struct { p map[string]interface{} } func (p *RebootSystemVmParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RebootSystemVmParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RebootSystemVmParams instance, // as then you are sure you have configured all required params func (s *SystemVMService) NewRebootSystemVmParams(id string) *RebootSystemVmParams { p := &RebootSystemVmParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Reboots a system VM. func (s *SystemVMService) RebootSystemVm(p *RebootSystemVmParams) (*RebootSystemVmResponse, error) { resp, err := s.cs.newRequest("rebootSystemVm", p.toURLValues()) if err != nil { return nil, err } var r RebootSystemVmResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RebootSystemVmResponse struct { Activeviewersessions int `json:"activeviewersessions"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Gateway string `json:"gateway"` Guestvlan string `json:"guestvlan"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Podid string `json:"podid"` Privateip string `json:"privateip"` Privatemacaddress string `json:"privatemacaddress"` Privatenetmask string `json:"privatenetmask"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicvlan []string `json:"publicvlan"` State string `json:"state"` Systemvmtype string `json:"systemvmtype"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ScaleSystemVmParams struct { p map[string]interface{} } func (p *ScaleSystemVmParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } return u } func (p *ScaleSystemVmParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *ScaleSystemVmParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ScaleSystemVmParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } // You should always use this function to get a new ScaleSystemVmParams instance, // as then you are sure you have configured all required params func (s *SystemVMService) NewScaleSystemVmParams(id string, serviceofferingid string) *ScaleSystemVmParams { p := &ScaleSystemVmParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["serviceofferingid"] = serviceofferingid return p } // Scale the service offering for a system vm (console proxy or secondary storage). The system vm must be in a "Stopped" state for this command to take effect. func (s *SystemVMService) ScaleSystemVm(p *ScaleSystemVmParams) (*ScaleSystemVmResponse, error) { resp, err := s.cs.newRequest("scaleSystemVm", p.toURLValues()) if err != nil { return nil, err } var r ScaleSystemVmResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ScaleSystemVmResponse struct { Activeviewersessions int `json:"activeviewersessions"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Gateway string `json:"gateway"` Guestvlan string `json:"guestvlan"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Podid string `json:"podid"` Privateip string `json:"privateip"` Privatemacaddress string `json:"privatemacaddress"` Privatenetmask string `json:"privatenetmask"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicvlan []string `json:"publicvlan"` State string `json:"state"` Systemvmtype string `json:"systemvmtype"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type StartSystemVmParams struct { p map[string]interface{} } func (p *StartSystemVmParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *StartSystemVmParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new StartSystemVmParams instance, // as then you are sure you have configured all required params func (s *SystemVMService) NewStartSystemVmParams(id string) *StartSystemVmParams { p := &StartSystemVmParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Starts a system virtual machine. func (s *SystemVMService) StartSystemVm(p *StartSystemVmParams) (*StartSystemVmResponse, error) { resp, err := s.cs.newRequest("startSystemVm", p.toURLValues()) if err != nil { return nil, err } var r StartSystemVmResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type StartSystemVmResponse struct { Activeviewersessions int `json:"activeviewersessions"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Gateway string `json:"gateway"` Guestvlan string `json:"guestvlan"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Podid string `json:"podid"` Privateip string `json:"privateip"` Privatemacaddress string `json:"privatemacaddress"` Privatenetmask string `json:"privatenetmask"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicvlan []string `json:"publicvlan"` State string `json:"state"` Systemvmtype string `json:"systemvmtype"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type StopSystemVmParams struct { p map[string]interface{} } func (p *StopSystemVmParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["forced"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forced", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *StopSystemVmParams) SetForced(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forced"] = v return } func (p *StopSystemVmParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new StopSystemVmParams instance, // as then you are sure you have configured all required params func (s *SystemVMService) NewStopSystemVmParams(id string) *StopSystemVmParams { p := &StopSystemVmParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Stops a system VM. func (s *SystemVMService) StopSystemVm(p *StopSystemVmParams) (*StopSystemVmResponse, error) { resp, err := s.cs.newRequest("stopSystemVm", p.toURLValues()) if err != nil { return nil, err } var r StopSystemVmResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type StopSystemVmResponse struct { Activeviewersessions int `json:"activeviewersessions"` Created string `json:"created"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Gateway string `json:"gateway"` Guestvlan string `json:"guestvlan"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Linklocalip string `json:"linklocalip"` Linklocalmacaddress string `json:"linklocalmacaddress"` Linklocalnetmask string `json:"linklocalnetmask"` Name string `json:"name"` Networkdomain string `json:"networkdomain"` Podid string `json:"podid"` Privateip string `json:"privateip"` Privatemacaddress string `json:"privatemacaddress"` Privatenetmask string `json:"privatenetmask"` Publicip string `json:"publicip"` Publicmacaddress string `json:"publicmacaddress"` Publicnetmask string `json:"publicnetmask"` Publicvlan []string `json:"publicvlan"` State string `json:"state"` Systemvmtype string `json:"systemvmtype"` Templateid string `json:"templateid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/TemplateService.go000066400000000000000000002071241364073403100220470ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CopyTemplateParams struct { p map[string]interface{} } func (p *CopyTemplateParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["destzoneid"]; found { u.Set("destzoneid", v.(string)) } if v, found := p.p["destzoneids"]; found { vv := strings.Join(v.([]string), ",") u.Set("destzoneids", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["sourcezoneid"]; found { u.Set("sourcezoneid", v.(string)) } return u } func (p *CopyTemplateParams) SetDestzoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["destzoneid"] = v return } func (p *CopyTemplateParams) SetDestzoneids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["destzoneids"] = v return } func (p *CopyTemplateParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *CopyTemplateParams) SetSourcezoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sourcezoneid"] = v return } // You should always use this function to get a new CopyTemplateParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewCopyTemplateParams(id string) *CopyTemplateParams { p := &CopyTemplateParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Copies a template from one zone to another. func (s *TemplateService) CopyTemplate(p *CopyTemplateParams) (*CopyTemplateResponse, error) { resp, err := s.cs.newRequest("copyTemplate", p.toURLValues()) if err != nil { return nil, err } var r CopyTemplateResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CopyTemplateResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Bits int `json:"bits"` Bootable bool `json:"bootable"` Checksum string `json:"checksum"` Childtemplates []interface{} `json:"childtemplates"` Created string `json:"created"` CrossZones bool `json:"crossZones"` Details map[string]string `json:"details"` Directdownload bool `json:"directdownload"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Format string `json:"format"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isextractable bool `json:"isextractable"` Isfeatured bool `json:"isfeatured"` Ispublic bool `json:"ispublic"` Isready bool `json:"isready"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Ostypeid string `json:"ostypeid"` Ostypename string `json:"ostypename"` Parenttemplateid string `json:"parenttemplateid"` Passwordenabled bool `json:"passwordenabled"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` Requireshvm bool `json:"requireshvm"` Size int64 `json:"size"` Sourcetemplateid string `json:"sourcetemplateid"` Sshkeyenabled bool `json:"sshkeyenabled"` Status string `json:"status"` Tags []Tags `json:"tags"` Templatetag string `json:"templatetag"` Templatetype string `json:"templatetype"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } func (r *CopyTemplateResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias CopyTemplateResponse return json.Unmarshal(b, (*alias)(r)) } type CreateTemplateParams struct { p map[string]interface{} } func (p *CreateTemplateParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["bits"]; found { vv := strconv.Itoa(v.(int)) u.Set("bits", vv) } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["isdynamicallyscalable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isdynamicallyscalable", vv) } if v, found := p.p["isfeatured"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isfeatured", vv) } if v, found := p.p["ispublic"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("ispublic", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["ostypeid"]; found { u.Set("ostypeid", v.(string)) } if v, found := p.p["passwordenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("passwordenabled", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["requireshvm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("requireshvm", vv) } if v, found := p.p["snapshotid"]; found { u.Set("snapshotid", v.(string)) } if v, found := p.p["sshkeyenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("sshkeyenabled", vv) } if v, found := p.p["templatetag"]; found { u.Set("templatetag", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } if v, found := p.p["volumeid"]; found { u.Set("volumeid", v.(string)) } return u } func (p *CreateTemplateParams) SetBits(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bits"] = v return } func (p *CreateTemplateParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *CreateTemplateParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *CreateTemplateParams) SetIsdynamicallyscalable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isdynamicallyscalable"] = v return } func (p *CreateTemplateParams) SetIsfeatured(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isfeatured"] = v return } func (p *CreateTemplateParams) SetIspublic(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ispublic"] = v return } func (p *CreateTemplateParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateTemplateParams) SetOstypeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ostypeid"] = v return } func (p *CreateTemplateParams) SetPasswordenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["passwordenabled"] = v return } func (p *CreateTemplateParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *CreateTemplateParams) SetRequireshvm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["requireshvm"] = v return } func (p *CreateTemplateParams) SetSnapshotid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["snapshotid"] = v return } func (p *CreateTemplateParams) SetSshkeyenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sshkeyenabled"] = v return } func (p *CreateTemplateParams) SetTemplatetag(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templatetag"] = v return } func (p *CreateTemplateParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *CreateTemplateParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } func (p *CreateTemplateParams) SetVolumeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["volumeid"] = v return } // You should always use this function to get a new CreateTemplateParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewCreateTemplateParams(displaytext string, name string, ostypeid string) *CreateTemplateParams { p := &CreateTemplateParams{} p.p = make(map[string]interface{}) p.p["displaytext"] = displaytext p.p["name"] = name p.p["ostypeid"] = ostypeid return p } // Creates a template of a virtual machine. The virtual machine must be in a STOPPED state. A template created from this command is automatically designated as a private template visible to the account that created it. func (s *TemplateService) CreateTemplate(p *CreateTemplateParams) (*CreateTemplateResponse, error) { resp, err := s.cs.newRequest("createTemplate", p.toURLValues()) if err != nil { return nil, err } var r CreateTemplateResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateTemplateResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Bits int `json:"bits"` Bootable bool `json:"bootable"` Checksum string `json:"checksum"` Childtemplates []interface{} `json:"childtemplates"` Created string `json:"created"` CrossZones bool `json:"crossZones"` Details map[string]string `json:"details"` Directdownload bool `json:"directdownload"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Format string `json:"format"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isextractable bool `json:"isextractable"` Isfeatured bool `json:"isfeatured"` Ispublic bool `json:"ispublic"` Isready bool `json:"isready"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Ostypeid string `json:"ostypeid"` Ostypename string `json:"ostypename"` Parenttemplateid string `json:"parenttemplateid"` Passwordenabled bool `json:"passwordenabled"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` Requireshvm bool `json:"requireshvm"` Size int64 `json:"size"` Sourcetemplateid string `json:"sourcetemplateid"` Sshkeyenabled bool `json:"sshkeyenabled"` Status string `json:"status"` Tags []Tags `json:"tags"` Templatetag string `json:"templatetag"` Templatetype string `json:"templatetype"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } func (r *CreateTemplateResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias CreateTemplateResponse return json.Unmarshal(b, (*alias)(r)) } type DeleteTemplateParams struct { p map[string]interface{} } func (p *DeleteTemplateParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["forced"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forced", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *DeleteTemplateParams) SetForced(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forced"] = v return } func (p *DeleteTemplateParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *DeleteTemplateParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new DeleteTemplateParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewDeleteTemplateParams(id string) *DeleteTemplateParams { p := &DeleteTemplateParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a template from the system. All virtual machines using the deleted template will not be affected. func (s *TemplateService) DeleteTemplate(p *DeleteTemplateParams) (*DeleteTemplateResponse, error) { resp, err := s.cs.newRequest("deleteTemplate", p.toURLValues()) if err != nil { return nil, err } var r DeleteTemplateResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteTemplateResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ExtractTemplateParams struct { p map[string]interface{} } func (p *ExtractTemplateParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["mode"]; found { u.Set("mode", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ExtractTemplateParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ExtractTemplateParams) SetMode(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["mode"] = v return } func (p *ExtractTemplateParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *ExtractTemplateParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ExtractTemplateParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewExtractTemplateParams(id string, mode string) *ExtractTemplateParams { p := &ExtractTemplateParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["mode"] = mode return p } // Extracts a template func (s *TemplateService) ExtractTemplate(p *ExtractTemplateParams) (*ExtractTemplateResponse, error) { resp, err := s.cs.newRequest("extractTemplate", p.toURLValues()) if err != nil { return nil, err } var r ExtractTemplateResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ExtractTemplateResponse struct { Accountid string `json:"accountid"` Created string `json:"created"` ExtractId string `json:"extractId"` ExtractMode string `json:"extractMode"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Resultstring string `json:"resultstring"` State string `json:"state"` Status string `json:"status"` Storagetype string `json:"storagetype"` Uploadpercentage int `json:"uploadpercentage"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type GetUploadParamsForTemplateParams struct { p map[string]interface{} } func (p *GetUploadParamsForTemplateParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["bits"]; found { vv := strconv.Itoa(v.(int)) u.Set("bits", vv) } if v, found := p.p["checksum"]; found { u.Set("checksum", v.(string)) } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["format"]; found { u.Set("format", v.(string)) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["isdynamicallyscalable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isdynamicallyscalable", vv) } if v, found := p.p["isextractable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isextractable", vv) } if v, found := p.p["isfeatured"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isfeatured", vv) } if v, found := p.p["ispublic"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("ispublic", vv) } if v, found := p.p["isrouting"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrouting", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["ostypeid"]; found { u.Set("ostypeid", v.(string)) } if v, found := p.p["passwordenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("passwordenabled", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["requireshvm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("requireshvm", vv) } if v, found := p.p["sshkeyenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("sshkeyenabled", vv) } if v, found := p.p["templatetag"]; found { u.Set("templatetag", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *GetUploadParamsForTemplateParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *GetUploadParamsForTemplateParams) SetBits(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bits"] = v return } func (p *GetUploadParamsForTemplateParams) SetChecksum(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["checksum"] = v return } func (p *GetUploadParamsForTemplateParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *GetUploadParamsForTemplateParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *GetUploadParamsForTemplateParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *GetUploadParamsForTemplateParams) SetFormat(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["format"] = v return } func (p *GetUploadParamsForTemplateParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *GetUploadParamsForTemplateParams) SetIsdynamicallyscalable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isdynamicallyscalable"] = v return } func (p *GetUploadParamsForTemplateParams) SetIsextractable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isextractable"] = v return } func (p *GetUploadParamsForTemplateParams) SetIsfeatured(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isfeatured"] = v return } func (p *GetUploadParamsForTemplateParams) SetIspublic(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ispublic"] = v return } func (p *GetUploadParamsForTemplateParams) SetIsrouting(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrouting"] = v return } func (p *GetUploadParamsForTemplateParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *GetUploadParamsForTemplateParams) SetOstypeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ostypeid"] = v return } func (p *GetUploadParamsForTemplateParams) SetPasswordenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["passwordenabled"] = v return } func (p *GetUploadParamsForTemplateParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *GetUploadParamsForTemplateParams) SetRequireshvm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["requireshvm"] = v return } func (p *GetUploadParamsForTemplateParams) SetSshkeyenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sshkeyenabled"] = v return } func (p *GetUploadParamsForTemplateParams) SetTemplatetag(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templatetag"] = v return } func (p *GetUploadParamsForTemplateParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new GetUploadParamsForTemplateParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewGetUploadParamsForTemplateParams(displaytext string, format string, hypervisor string, name string, ostypeid string, zoneid string) *GetUploadParamsForTemplateParams { p := &GetUploadParamsForTemplateParams{} p.p = make(map[string]interface{}) p.p["displaytext"] = displaytext p.p["format"] = format p.p["hypervisor"] = hypervisor p.p["name"] = name p.p["ostypeid"] = ostypeid p.p["zoneid"] = zoneid return p } // upload an existing template into the CloudStack cloud. func (s *TemplateService) GetUploadParamsForTemplate(p *GetUploadParamsForTemplateParams) (*GetUploadParamsForTemplateResponse, error) { resp, err := s.cs.newRequest("getUploadParamsForTemplate", p.toURLValues()) if err != nil { return nil, err } var r GetUploadParamsForTemplateResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetUploadParamsForTemplateResponse struct { Expires string `json:"expires"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Metadata string `json:"metadata"` PostURL string `json:"postURL"` Signature string `json:"signature"` } type ListTemplatePermissionsParams struct { p map[string]interface{} } func (p *ListTemplatePermissionsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ListTemplatePermissionsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ListTemplatePermissionsParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewListTemplatePermissionsParams(id string) *ListTemplatePermissionsParams { p := &ListTemplatePermissionsParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *TemplateService) GetTemplatePermissionByID(id string, opts ...OptionFunc) (*TemplatePermission, int, error) { p := &ListTemplatePermissionsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListTemplatePermissions(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.TemplatePermissions[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for TemplatePermission UUID: %s!", id) } // List template visibility and all accounts that have permissions to view this template. func (s *TemplateService) ListTemplatePermissions(p *ListTemplatePermissionsParams) (*ListTemplatePermissionsResponse, error) { resp, err := s.cs.newRequest("listTemplatePermissions", p.toURLValues()) if err != nil { return nil, err } var r ListTemplatePermissionsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListTemplatePermissionsResponse struct { Count int `json:"count"` TemplatePermissions []*TemplatePermission `json:"templatepermission"` } type TemplatePermission struct { Account []string `json:"account"` Domainid string `json:"domainid"` Id string `json:"id"` Ispublic bool `json:"ispublic"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Projectids []string `json:"projectids"` } type ListTemplatesParams struct { p map[string]interface{} } func (p *ListTemplatesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ids"]; found { vv := strings.Join(v.([]string), ",") u.Set("ids", vv) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["parenttemplateid"]; found { u.Set("parenttemplateid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["showremoved"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("showremoved", vv) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["templatefilter"]; found { u.Set("templatefilter", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListTemplatesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListTemplatesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListTemplatesParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *ListTemplatesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListTemplatesParams) SetIds(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ids"] = v return } func (p *ListTemplatesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListTemplatesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListTemplatesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListTemplatesParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListTemplatesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListTemplatesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListTemplatesParams) SetParenttemplateid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["parenttemplateid"] = v return } func (p *ListTemplatesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListTemplatesParams) SetShowremoved(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["showremoved"] = v return } func (p *ListTemplatesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListTemplatesParams) SetTemplatefilter(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templatefilter"] = v return } func (p *ListTemplatesParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListTemplatesParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewListTemplatesParams(templatefilter string) *ListTemplatesParams { p := &ListTemplatesParams{} p.p = make(map[string]interface{}) p.p["templatefilter"] = templatefilter return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *TemplateService) GetTemplateID(name string, templatefilter string, zoneid string, opts ...OptionFunc) (string, int, error) { p := &ListTemplatesParams{} p.p = make(map[string]interface{}) p.p["name"] = name p.p["templatefilter"] = templatefilter p.p["zoneid"] = zoneid for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListTemplates(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Templates[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Templates { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *TemplateService) GetTemplateByName(name string, templatefilter string, zoneid string, opts ...OptionFunc) (*Template, int, error) { id, count, err := s.GetTemplateID(name, templatefilter, zoneid, opts...) if err != nil { return nil, count, err } r, count, err := s.GetTemplateByID(id, templatefilter, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *TemplateService) GetTemplateByID(id string, templatefilter string, opts ...OptionFunc) (*Template, int, error) { p := &ListTemplatesParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["templatefilter"] = templatefilter for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListTemplates(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Templates[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Template UUID: %s!", id) } // List all public, private, and privileged templates. func (s *TemplateService) ListTemplates(p *ListTemplatesParams) (*ListTemplatesResponse, error) { resp, err := s.cs.newRequest("listTemplates", p.toURLValues()) if err != nil { return nil, err } var r ListTemplatesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListTemplatesResponse struct { Count int `json:"count"` Templates []*Template `json:"template"` } type Template struct { Account string `json:"account"` Accountid string `json:"accountid"` Bits int `json:"bits"` Bootable bool `json:"bootable"` Checksum string `json:"checksum"` Childtemplates []interface{} `json:"childtemplates"` Created string `json:"created"` CrossZones bool `json:"crossZones"` Details map[string]string `json:"details"` Directdownload bool `json:"directdownload"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Format string `json:"format"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isextractable bool `json:"isextractable"` Isfeatured bool `json:"isfeatured"` Ispublic bool `json:"ispublic"` Isready bool `json:"isready"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Ostypeid string `json:"ostypeid"` Ostypename string `json:"ostypename"` Parenttemplateid string `json:"parenttemplateid"` Passwordenabled bool `json:"passwordenabled"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` Requireshvm bool `json:"requireshvm"` Size int64 `json:"size"` Sourcetemplateid string `json:"sourcetemplateid"` Sshkeyenabled bool `json:"sshkeyenabled"` Status string `json:"status"` Tags []Tags `json:"tags"` Templatetag string `json:"templatetag"` Templatetype string `json:"templatetype"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } func (r *Template) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias Template return json.Unmarshal(b, (*alias)(r)) } type PrepareTemplateParams struct { p map[string]interface{} } func (p *PrepareTemplateParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["storageid"]; found { u.Set("storageid", v.(string)) } if v, found := p.p["templateid"]; found { u.Set("templateid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *PrepareTemplateParams) SetStorageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storageid"] = v return } func (p *PrepareTemplateParams) SetTemplateid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templateid"] = v return } func (p *PrepareTemplateParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new PrepareTemplateParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewPrepareTemplateParams(templateid string, zoneid string) *PrepareTemplateParams { p := &PrepareTemplateParams{} p.p = make(map[string]interface{}) p.p["templateid"] = templateid p.p["zoneid"] = zoneid return p } // load template into primary storage func (s *TemplateService) PrepareTemplate(p *PrepareTemplateParams) (*PrepareTemplateResponse, error) { resp, err := s.cs.newRequest("prepareTemplate", p.toURLValues()) if err != nil { return nil, err } var r PrepareTemplateResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type PrepareTemplateResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Bits int `json:"bits"` Bootable bool `json:"bootable"` Checksum string `json:"checksum"` Childtemplates []interface{} `json:"childtemplates"` Created string `json:"created"` CrossZones bool `json:"crossZones"` Details map[string]string `json:"details"` Directdownload bool `json:"directdownload"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Format string `json:"format"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isextractable bool `json:"isextractable"` Isfeatured bool `json:"isfeatured"` Ispublic bool `json:"ispublic"` Isready bool `json:"isready"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Ostypeid string `json:"ostypeid"` Ostypename string `json:"ostypename"` Parenttemplateid string `json:"parenttemplateid"` Passwordenabled bool `json:"passwordenabled"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` Requireshvm bool `json:"requireshvm"` Size int64 `json:"size"` Sourcetemplateid string `json:"sourcetemplateid"` Sshkeyenabled bool `json:"sshkeyenabled"` Status string `json:"status"` Tags []Tags `json:"tags"` Templatetag string `json:"templatetag"` Templatetype string `json:"templatetype"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } func (r *PrepareTemplateResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias PrepareTemplateResponse return json.Unmarshal(b, (*alias)(r)) } type RegisterTemplateParams struct { p map[string]interface{} } func (p *RegisterTemplateParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["bits"]; found { vv := strconv.Itoa(v.(int)) u.Set("bits", vv) } if v, found := p.p["checksum"]; found { u.Set("checksum", v.(string)) } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["directdownload"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("directdownload", vv) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["format"]; found { u.Set("format", v.(string)) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["isdynamicallyscalable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isdynamicallyscalable", vv) } if v, found := p.p["isextractable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isextractable", vv) } if v, found := p.p["isfeatured"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isfeatured", vv) } if v, found := p.p["ispublic"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("ispublic", vv) } if v, found := p.p["isrouting"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrouting", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["ostypeid"]; found { u.Set("ostypeid", v.(string)) } if v, found := p.p["passwordenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("passwordenabled", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["requireshvm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("requireshvm", vv) } if v, found := p.p["sshkeyenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("sshkeyenabled", vv) } if v, found := p.p["templatetag"]; found { u.Set("templatetag", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } if v, found := p.p["zoneids"]; found { vv := strings.Join(v.([]string), ",") u.Set("zoneids", vv) } return u } func (p *RegisterTemplateParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *RegisterTemplateParams) SetBits(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bits"] = v return } func (p *RegisterTemplateParams) SetChecksum(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["checksum"] = v return } func (p *RegisterTemplateParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *RegisterTemplateParams) SetDirectdownload(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["directdownload"] = v return } func (p *RegisterTemplateParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *RegisterTemplateParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *RegisterTemplateParams) SetFormat(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["format"] = v return } func (p *RegisterTemplateParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *RegisterTemplateParams) SetIsdynamicallyscalable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isdynamicallyscalable"] = v return } func (p *RegisterTemplateParams) SetIsextractable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isextractable"] = v return } func (p *RegisterTemplateParams) SetIsfeatured(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isfeatured"] = v return } func (p *RegisterTemplateParams) SetIspublic(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ispublic"] = v return } func (p *RegisterTemplateParams) SetIsrouting(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrouting"] = v return } func (p *RegisterTemplateParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *RegisterTemplateParams) SetOstypeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ostypeid"] = v return } func (p *RegisterTemplateParams) SetPasswordenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["passwordenabled"] = v return } func (p *RegisterTemplateParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *RegisterTemplateParams) SetRequireshvm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["requireshvm"] = v return } func (p *RegisterTemplateParams) SetSshkeyenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sshkeyenabled"] = v return } func (p *RegisterTemplateParams) SetTemplatetag(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templatetag"] = v return } func (p *RegisterTemplateParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *RegisterTemplateParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } func (p *RegisterTemplateParams) SetZoneids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneids"] = v return } // You should always use this function to get a new RegisterTemplateParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewRegisterTemplateParams(displaytext string, format string, hypervisor string, name string, ostypeid string, url string) *RegisterTemplateParams { p := &RegisterTemplateParams{} p.p = make(map[string]interface{}) p.p["displaytext"] = displaytext p.p["format"] = format p.p["hypervisor"] = hypervisor p.p["name"] = name p.p["ostypeid"] = ostypeid p.p["url"] = url return p } // Registers an existing template into the CloudStack cloud. func (s *TemplateService) RegisterTemplate(p *RegisterTemplateParams) (*RegisterTemplateResponse, error) { resp, err := s.cs.newRequest("registerTemplate", p.toURLValues()) if err != nil { return nil, err } var r RegisterTemplateResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type RegisterTemplateResponse struct { Count int `json:"count"` RegisterTemplate []*RegisterTemplate `json:"template"` } type RegisterTemplate struct { Account string `json:"account"` Accountid string `json:"accountid"` Bits int `json:"bits"` Bootable bool `json:"bootable"` Checksum string `json:"checksum"` Childtemplates []interface{} `json:"childtemplates"` Created string `json:"created"` CrossZones bool `json:"crossZones"` Details map[string]string `json:"details"` Directdownload bool `json:"directdownload"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Format string `json:"format"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isextractable bool `json:"isextractable"` Isfeatured bool `json:"isfeatured"` Ispublic bool `json:"ispublic"` Isready bool `json:"isready"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Ostypeid string `json:"ostypeid"` Ostypename string `json:"ostypename"` Parenttemplateid string `json:"parenttemplateid"` Passwordenabled bool `json:"passwordenabled"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` Requireshvm bool `json:"requireshvm"` Size int64 `json:"size"` Sourcetemplateid string `json:"sourcetemplateid"` Sshkeyenabled bool `json:"sshkeyenabled"` Status string `json:"status"` Tags []Tags `json:"tags"` Templatetag string `json:"templatetag"` Templatetype string `json:"templatetype"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } func (r *RegisterTemplate) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias RegisterTemplate return json.Unmarshal(b, (*alias)(r)) } type UpdateTemplateParams struct { p map[string]interface{} } func (p *UpdateTemplateParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["bootable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("bootable", vv) } if v, found := p.p["cleanupdetails"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("cleanupdetails", vv) } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["format"]; found { u.Set("format", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isdynamicallyscalable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isdynamicallyscalable", vv) } if v, found := p.p["isrouting"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrouting", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["ostypeid"]; found { u.Set("ostypeid", v.(string)) } if v, found := p.p["passwordenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("passwordenabled", vv) } if v, found := p.p["requireshvm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("requireshvm", vv) } if v, found := p.p["sortkey"]; found { vv := strconv.Itoa(v.(int)) u.Set("sortkey", vv) } if v, found := p.p["sshkeyenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("sshkeyenabled", vv) } return u } func (p *UpdateTemplateParams) SetBootable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bootable"] = v return } func (p *UpdateTemplateParams) SetCleanupdetails(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cleanupdetails"] = v return } func (p *UpdateTemplateParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *UpdateTemplateParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *UpdateTemplateParams) SetFormat(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["format"] = v return } func (p *UpdateTemplateParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateTemplateParams) SetIsdynamicallyscalable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isdynamicallyscalable"] = v return } func (p *UpdateTemplateParams) SetIsrouting(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrouting"] = v return } func (p *UpdateTemplateParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateTemplateParams) SetOstypeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ostypeid"] = v return } func (p *UpdateTemplateParams) SetPasswordenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["passwordenabled"] = v return } func (p *UpdateTemplateParams) SetRequireshvm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["requireshvm"] = v return } func (p *UpdateTemplateParams) SetSortkey(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sortkey"] = v return } func (p *UpdateTemplateParams) SetSshkeyenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sshkeyenabled"] = v return } // You should always use this function to get a new UpdateTemplateParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewUpdateTemplateParams(id string) *UpdateTemplateParams { p := &UpdateTemplateParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates attributes of a template. func (s *TemplateService) UpdateTemplate(p *UpdateTemplateParams) (*UpdateTemplateResponse, error) { resp, err := s.cs.newRequest("updateTemplate", p.toURLValues()) if err != nil { return nil, err } var r UpdateTemplateResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateTemplateResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Bits int `json:"bits"` Bootable bool `json:"bootable"` Checksum string `json:"checksum"` Childtemplates []interface{} `json:"childtemplates"` Created string `json:"created"` CrossZones bool `json:"crossZones"` Details map[string]string `json:"details"` Directdownload bool `json:"directdownload"` Displaytext string `json:"displaytext"` Domain string `json:"domain"` Domainid string `json:"domainid"` Format string `json:"format"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isextractable bool `json:"isextractable"` Isfeatured bool `json:"isfeatured"` Ispublic bool `json:"ispublic"` Isready bool `json:"isready"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Ostypeid string `json:"ostypeid"` Ostypename string `json:"ostypename"` Parenttemplateid string `json:"parenttemplateid"` Passwordenabled bool `json:"passwordenabled"` Physicalsize int64 `json:"physicalsize"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` Requireshvm bool `json:"requireshvm"` Size int64 `json:"size"` Sourcetemplateid string `json:"sourcetemplateid"` Sshkeyenabled bool `json:"sshkeyenabled"` Status string `json:"status"` Tags []Tags `json:"tags"` Templatetag string `json:"templatetag"` Templatetype string `json:"templatetype"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } func (r *UpdateTemplateResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateTemplateResponse return json.Unmarshal(b, (*alias)(r)) } type UpdateTemplatePermissionsParams struct { p map[string]interface{} } func (p *UpdateTemplatePermissionsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["accounts"]; found { vv := strings.Join(v.([]string), ",") u.Set("accounts", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isextractable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isextractable", vv) } if v, found := p.p["isfeatured"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isfeatured", vv) } if v, found := p.p["ispublic"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("ispublic", vv) } if v, found := p.p["op"]; found { u.Set("op", v.(string)) } if v, found := p.p["projectids"]; found { vv := strings.Join(v.([]string), ",") u.Set("projectids", vv) } return u } func (p *UpdateTemplatePermissionsParams) SetAccounts(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accounts"] = v return } func (p *UpdateTemplatePermissionsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateTemplatePermissionsParams) SetIsextractable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isextractable"] = v return } func (p *UpdateTemplatePermissionsParams) SetIsfeatured(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isfeatured"] = v return } func (p *UpdateTemplatePermissionsParams) SetIspublic(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ispublic"] = v return } func (p *UpdateTemplatePermissionsParams) SetOp(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["op"] = v return } func (p *UpdateTemplatePermissionsParams) SetProjectids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectids"] = v return } // You should always use this function to get a new UpdateTemplatePermissionsParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewUpdateTemplatePermissionsParams(id string) *UpdateTemplatePermissionsParams { p := &UpdateTemplatePermissionsParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a template visibility permissions. A public template is visible to all accounts within the same domain. A private template is visible only to the owner of the template. A priviledged template is a private template with account permissions added. Only accounts specified under the template permissions are visible to them. func (s *TemplateService) UpdateTemplatePermissions(p *UpdateTemplatePermissionsParams) (*UpdateTemplatePermissionsResponse, error) { resp, err := s.cs.newRequest("updateTemplatePermissions", p.toURLValues()) if err != nil { return nil, err } var r UpdateTemplatePermissionsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateTemplatePermissionsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *UpdateTemplatePermissionsResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateTemplatePermissionsResponse return json.Unmarshal(b, (*alias)(r)) } type UpgradeRouterTemplateParams struct { p map[string]interface{} } func (p *UpgradeRouterTemplateParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *UpgradeRouterTemplateParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *UpgradeRouterTemplateParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *UpgradeRouterTemplateParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *UpgradeRouterTemplateParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpgradeRouterTemplateParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *UpgradeRouterTemplateParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new UpgradeRouterTemplateParams instance, // as then you are sure you have configured all required params func (s *TemplateService) NewUpgradeRouterTemplateParams() *UpgradeRouterTemplateParams { p := &UpgradeRouterTemplateParams{} p.p = make(map[string]interface{}) return p } // Upgrades router to use newer template func (s *TemplateService) UpgradeRouterTemplate(p *UpgradeRouterTemplateParams) (*UpgradeRouterTemplateResponse, error) { resp, err := s.cs.newRequest("upgradeRouterTemplate", p.toURLValues()) if err != nil { return nil, err } var r UpgradeRouterTemplateResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpgradeRouterTemplateResponse struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } go-cloudstack-2.9.0/cloudstack/UCSService.go000066400000000000000000000373621364073403100207330ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AddUcsManagerParams struct { p map[string]interface{} } func (p *AddUcsManagerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *AddUcsManagerParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *AddUcsManagerParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddUcsManagerParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddUcsManagerParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } func (p *AddUcsManagerParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new AddUcsManagerParams instance, // as then you are sure you have configured all required params func (s *UCSService) NewAddUcsManagerParams(password string, url string, username string, zoneid string) *AddUcsManagerParams { p := &AddUcsManagerParams{} p.p = make(map[string]interface{}) p.p["password"] = password p.p["url"] = url p.p["username"] = username p.p["zoneid"] = zoneid return p } // Adds a Ucs manager func (s *UCSService) AddUcsManager(p *AddUcsManagerParams) (*AddUcsManagerResponse, error) { resp, err := s.cs.newRequest("addUcsManager", p.toURLValues()) if err != nil { return nil, err } var r AddUcsManagerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddUcsManagerResponse struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Url string `json:"url"` Zoneid string `json:"zoneid"` } type AssociateUcsProfileToBladeParams struct { p map[string]interface{} } func (p *AssociateUcsProfileToBladeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["bladeid"]; found { u.Set("bladeid", v.(string)) } if v, found := p.p["profiledn"]; found { u.Set("profiledn", v.(string)) } if v, found := p.p["ucsmanagerid"]; found { u.Set("ucsmanagerid", v.(string)) } return u } func (p *AssociateUcsProfileToBladeParams) SetBladeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["bladeid"] = v return } func (p *AssociateUcsProfileToBladeParams) SetProfiledn(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["profiledn"] = v return } func (p *AssociateUcsProfileToBladeParams) SetUcsmanagerid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ucsmanagerid"] = v return } // You should always use this function to get a new AssociateUcsProfileToBladeParams instance, // as then you are sure you have configured all required params func (s *UCSService) NewAssociateUcsProfileToBladeParams(bladeid string, profiledn string, ucsmanagerid string) *AssociateUcsProfileToBladeParams { p := &AssociateUcsProfileToBladeParams{} p.p = make(map[string]interface{}) p.p["bladeid"] = bladeid p.p["profiledn"] = profiledn p.p["ucsmanagerid"] = ucsmanagerid return p } // associate a profile to a blade func (s *UCSService) AssociateUcsProfileToBlade(p *AssociateUcsProfileToBladeParams) (*AssociateUcsProfileToBladeResponse, error) { resp, err := s.cs.newRequest("associateUcsProfileToBlade", p.toURLValues()) if err != nil { return nil, err } var r AssociateUcsProfileToBladeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AssociateUcsProfileToBladeResponse struct { Bladedn string `json:"bladedn"` Hostid string `json:"hostid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Profiledn string `json:"profiledn"` Ucsmanagerid string `json:"ucsmanagerid"` } type DeleteUcsManagerParams struct { p map[string]interface{} } func (p *DeleteUcsManagerParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["ucsmanagerid"]; found { u.Set("ucsmanagerid", v.(string)) } return u } func (p *DeleteUcsManagerParams) SetUcsmanagerid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ucsmanagerid"] = v return } // You should always use this function to get a new DeleteUcsManagerParams instance, // as then you are sure you have configured all required params func (s *UCSService) NewDeleteUcsManagerParams(ucsmanagerid string) *DeleteUcsManagerParams { p := &DeleteUcsManagerParams{} p.p = make(map[string]interface{}) p.p["ucsmanagerid"] = ucsmanagerid return p } // Delete a Ucs manager func (s *UCSService) DeleteUcsManager(p *DeleteUcsManagerParams) (*DeleteUcsManagerResponse, error) { resp, err := s.cs.newRequest("deleteUcsManager", p.toURLValues()) if err != nil { return nil, err } var r DeleteUcsManagerResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteUcsManagerResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteUcsManagerResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteUcsManagerResponse return json.Unmarshal(b, (*alias)(r)) } type ListUcsBladesParams struct { p map[string]interface{} } func (p *ListUcsBladesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["ucsmanagerid"]; found { u.Set("ucsmanagerid", v.(string)) } return u } func (p *ListUcsBladesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListUcsBladesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListUcsBladesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListUcsBladesParams) SetUcsmanagerid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ucsmanagerid"] = v return } // You should always use this function to get a new ListUcsBladesParams instance, // as then you are sure you have configured all required params func (s *UCSService) NewListUcsBladesParams(ucsmanagerid string) *ListUcsBladesParams { p := &ListUcsBladesParams{} p.p = make(map[string]interface{}) p.p["ucsmanagerid"] = ucsmanagerid return p } // List ucs blades func (s *UCSService) ListUcsBlades(p *ListUcsBladesParams) (*ListUcsBladesResponse, error) { resp, err := s.cs.newRequest("listUcsBlades", p.toURLValues()) if err != nil { return nil, err } var r ListUcsBladesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListUcsBladesResponse struct { Count int `json:"count"` UcsBlades []*UcsBlade `json:"ucsblade"` } type UcsBlade struct { Bladedn string `json:"bladedn"` Hostid string `json:"hostid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Profiledn string `json:"profiledn"` Ucsmanagerid string `json:"ucsmanagerid"` } type ListUcsManagersParams struct { p map[string]interface{} } func (p *ListUcsManagersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListUcsManagersParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListUcsManagersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListUcsManagersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListUcsManagersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListUcsManagersParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListUcsManagersParams instance, // as then you are sure you have configured all required params func (s *UCSService) NewListUcsManagersParams() *ListUcsManagersParams { p := &ListUcsManagersParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *UCSService) GetUcsManagerID(keyword string, opts ...OptionFunc) (string, int, error) { p := &ListUcsManagersParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListUcsManagers(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.UcsManagers[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.UcsManagers { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *UCSService) GetUcsManagerByName(name string, opts ...OptionFunc) (*UcsManager, int, error) { id, count, err := s.GetUcsManagerID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetUcsManagerByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *UCSService) GetUcsManagerByID(id string, opts ...OptionFunc) (*UcsManager, int, error) { p := &ListUcsManagersParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListUcsManagers(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.UcsManagers[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for UcsManager UUID: %s!", id) } // List ucs manager func (s *UCSService) ListUcsManagers(p *ListUcsManagersParams) (*ListUcsManagersResponse, error) { resp, err := s.cs.newRequest("listUcsManagers", p.toURLValues()) if err != nil { return nil, err } var r ListUcsManagersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListUcsManagersResponse struct { Count int `json:"count"` UcsManagers []*UcsManager `json:"ucsmanager"` } type UcsManager struct { Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Url string `json:"url"` Zoneid string `json:"zoneid"` } type ListUcsProfilesParams struct { p map[string]interface{} } func (p *ListUcsProfilesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["ucsmanagerid"]; found { u.Set("ucsmanagerid", v.(string)) } return u } func (p *ListUcsProfilesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListUcsProfilesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListUcsProfilesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListUcsProfilesParams) SetUcsmanagerid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ucsmanagerid"] = v return } // You should always use this function to get a new ListUcsProfilesParams instance, // as then you are sure you have configured all required params func (s *UCSService) NewListUcsProfilesParams(ucsmanagerid string) *ListUcsProfilesParams { p := &ListUcsProfilesParams{} p.p = make(map[string]interface{}) p.p["ucsmanagerid"] = ucsmanagerid return p } // List profile in ucs manager func (s *UCSService) ListUcsProfiles(p *ListUcsProfilesParams) (*ListUcsProfilesResponse, error) { resp, err := s.cs.newRequest("listUcsProfiles", p.toURLValues()) if err != nil { return nil, err } var r ListUcsProfilesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListUcsProfilesResponse struct { Count int `json:"count"` UcsProfiles []*UcsProfile `json:"ucsprofile"` } type UcsProfile struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Ucsdn string `json:"ucsdn"` } go-cloudstack-2.9.0/cloudstack/UsageService.go000066400000000000000000001002001364073403100213230ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" ) type AddTrafficMonitorParams struct { p map[string]interface{} } func (p *AddTrafficMonitorParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["excludezones"]; found { u.Set("excludezones", v.(string)) } if v, found := p.p["includezones"]; found { u.Set("includezones", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *AddTrafficMonitorParams) SetExcludezones(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["excludezones"] = v return } func (p *AddTrafficMonitorParams) SetIncludezones(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["includezones"] = v return } func (p *AddTrafficMonitorParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *AddTrafficMonitorParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new AddTrafficMonitorParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewAddTrafficMonitorParams(url string, zoneid string) *AddTrafficMonitorParams { p := &AddTrafficMonitorParams{} p.p = make(map[string]interface{}) p.p["url"] = url p.p["zoneid"] = zoneid return p } // Adds Traffic Monitor Host for Direct Network Usage func (s *UsageService) AddTrafficMonitor(p *AddTrafficMonitorParams) (*AddTrafficMonitorResponse, error) { resp, err := s.cs.newRequest("addTrafficMonitor", p.toURLValues()) if err != nil { return nil, err } var r AddTrafficMonitorResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AddTrafficMonitorResponse struct { Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Numretries string `json:"numretries"` Timeout string `json:"timeout"` Zoneid string `json:"zoneid"` } type AddTrafficTypeParams struct { p map[string]interface{} } func (p *AddTrafficTypeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hypervnetworklabel"]; found { u.Set("hypervnetworklabel", v.(string)) } if v, found := p.p["isolationmethod"]; found { u.Set("isolationmethod", v.(string)) } if v, found := p.p["kvmnetworklabel"]; found { u.Set("kvmnetworklabel", v.(string)) } if v, found := p.p["ovm3networklabel"]; found { u.Set("ovm3networklabel", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["traffictype"]; found { u.Set("traffictype", v.(string)) } if v, found := p.p["vlan"]; found { u.Set("vlan", v.(string)) } if v, found := p.p["vmwarenetworklabel"]; found { u.Set("vmwarenetworklabel", v.(string)) } if v, found := p.p["xennetworklabel"]; found { u.Set("xennetworklabel", v.(string)) } return u } func (p *AddTrafficTypeParams) SetHypervnetworklabel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervnetworklabel"] = v return } func (p *AddTrafficTypeParams) SetIsolationmethod(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isolationmethod"] = v return } func (p *AddTrafficTypeParams) SetKvmnetworklabel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["kvmnetworklabel"] = v return } func (p *AddTrafficTypeParams) SetOvm3networklabel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ovm3networklabel"] = v return } func (p *AddTrafficTypeParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *AddTrafficTypeParams) SetTraffictype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["traffictype"] = v return } func (p *AddTrafficTypeParams) SetVlan(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } func (p *AddTrafficTypeParams) SetVmwarenetworklabel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmwarenetworklabel"] = v return } func (p *AddTrafficTypeParams) SetXennetworklabel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["xennetworklabel"] = v return } // You should always use this function to get a new AddTrafficTypeParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewAddTrafficTypeParams(physicalnetworkid string, traffictype string) *AddTrafficTypeParams { p := &AddTrafficTypeParams{} p.p = make(map[string]interface{}) p.p["physicalnetworkid"] = physicalnetworkid p.p["traffictype"] = traffictype return p } // Adds traffic type to a physical network func (s *UsageService) AddTrafficType(p *AddTrafficTypeParams) (*AddTrafficTypeResponse, error) { resp, err := s.cs.newRequest("addTrafficType", p.toURLValues()) if err != nil { return nil, err } var r AddTrafficTypeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddTrafficTypeResponse struct { Hypervnetworklabel string `json:"hypervnetworklabel"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Kvmnetworklabel string `json:"kvmnetworklabel"` Ovm3networklabel string `json:"ovm3networklabel"` Physicalnetworkid string `json:"physicalnetworkid"` Traffictype string `json:"traffictype"` Vmwarenetworklabel string `json:"vmwarenetworklabel"` Xennetworklabel string `json:"xennetworklabel"` } type DeleteTrafficMonitorParams struct { p map[string]interface{} } func (p *DeleteTrafficMonitorParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteTrafficMonitorParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteTrafficMonitorParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewDeleteTrafficMonitorParams(id string) *DeleteTrafficMonitorParams { p := &DeleteTrafficMonitorParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes an traffic monitor host. func (s *UsageService) DeleteTrafficMonitor(p *DeleteTrafficMonitorParams) (*DeleteTrafficMonitorResponse, error) { resp, err := s.cs.newRequest("deleteTrafficMonitor", p.toURLValues()) if err != nil { return nil, err } var r DeleteTrafficMonitorResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteTrafficMonitorResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteTrafficMonitorResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteTrafficMonitorResponse return json.Unmarshal(b, (*alias)(r)) } type DeleteTrafficTypeParams struct { p map[string]interface{} } func (p *DeleteTrafficTypeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteTrafficTypeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteTrafficTypeParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewDeleteTrafficTypeParams(id string) *DeleteTrafficTypeParams { p := &DeleteTrafficTypeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes traffic type of a physical network func (s *UsageService) DeleteTrafficType(p *DeleteTrafficTypeParams) (*DeleteTrafficTypeResponse, error) { resp, err := s.cs.newRequest("deleteTrafficType", p.toURLValues()) if err != nil { return nil, err } var r DeleteTrafficTypeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteTrafficTypeResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type GenerateUsageRecordsParams struct { p map[string]interface{} } func (p *GenerateUsageRecordsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["enddate"]; found { u.Set("enddate", v.(string)) } if v, found := p.p["startdate"]; found { u.Set("startdate", v.(string)) } return u } func (p *GenerateUsageRecordsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *GenerateUsageRecordsParams) SetEnddate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enddate"] = v return } func (p *GenerateUsageRecordsParams) SetStartdate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startdate"] = v return } // You should always use this function to get a new GenerateUsageRecordsParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewGenerateUsageRecordsParams(enddate string, startdate string) *GenerateUsageRecordsParams { p := &GenerateUsageRecordsParams{} p.p = make(map[string]interface{}) p.p["enddate"] = enddate p.p["startdate"] = startdate return p } // Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed func (s *UsageService) GenerateUsageRecords(p *GenerateUsageRecordsParams) (*GenerateUsageRecordsResponse, error) { resp, err := s.cs.newRequest("generateUsageRecords", p.toURLValues()) if err != nil { return nil, err } var r GenerateUsageRecordsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GenerateUsageRecordsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *GenerateUsageRecordsResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias GenerateUsageRecordsResponse return json.Unmarshal(b, (*alias)(r)) } type ListTrafficMonitorsParams struct { p map[string]interface{} } func (p *ListTrafficMonitorsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListTrafficMonitorsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListTrafficMonitorsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListTrafficMonitorsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListTrafficMonitorsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListTrafficMonitorsParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewListTrafficMonitorsParams(zoneid string) *ListTrafficMonitorsParams { p := &ListTrafficMonitorsParams{} p.p = make(map[string]interface{}) p.p["zoneid"] = zoneid return p } // List traffic monitor Hosts. func (s *UsageService) ListTrafficMonitors(p *ListTrafficMonitorsParams) (*ListTrafficMonitorsResponse, error) { resp, err := s.cs.newRequest("listTrafficMonitors", p.toURLValues()) if err != nil { return nil, err } var r ListTrafficMonitorsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListTrafficMonitorsResponse struct { Count int `json:"count"` TrafficMonitors []*TrafficMonitor `json:"trafficmonitor"` } type TrafficMonitor struct { Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Numretries string `json:"numretries"` Timeout string `json:"timeout"` Zoneid string `json:"zoneid"` } type ListTrafficTypeImplementorsParams struct { p map[string]interface{} } func (p *ListTrafficTypeImplementorsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["traffictype"]; found { u.Set("traffictype", v.(string)) } return u } func (p *ListTrafficTypeImplementorsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListTrafficTypeImplementorsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListTrafficTypeImplementorsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListTrafficTypeImplementorsParams) SetTraffictype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["traffictype"] = v return } // You should always use this function to get a new ListTrafficTypeImplementorsParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewListTrafficTypeImplementorsParams() *ListTrafficTypeImplementorsParams { p := &ListTrafficTypeImplementorsParams{} p.p = make(map[string]interface{}) return p } // Lists implementors of implementor of a network traffic type or implementors of all network traffic types func (s *UsageService) ListTrafficTypeImplementors(p *ListTrafficTypeImplementorsParams) (*ListTrafficTypeImplementorsResponse, error) { resp, err := s.cs.newRequest("listTrafficTypeImplementors", p.toURLValues()) if err != nil { return nil, err } var r ListTrafficTypeImplementorsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListTrafficTypeImplementorsResponse struct { Count int `json:"count"` TrafficTypeImplementors []*TrafficTypeImplementor `json:"traffictypeimplementor"` } type TrafficTypeImplementor struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Traffictype string `json:"traffictype"` Traffictypeimplementor string `json:"traffictypeimplementor"` } type ListTrafficTypesParams struct { p map[string]interface{} } func (p *ListTrafficTypesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } return u } func (p *ListTrafficTypesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListTrafficTypesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListTrafficTypesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListTrafficTypesParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } // You should always use this function to get a new ListTrafficTypesParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewListTrafficTypesParams(physicalnetworkid string) *ListTrafficTypesParams { p := &ListTrafficTypesParams{} p.p = make(map[string]interface{}) p.p["physicalnetworkid"] = physicalnetworkid return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *UsageService) GetTrafficTypeID(keyword string, physicalnetworkid string, opts ...OptionFunc) (string, int, error) { p := &ListTrafficTypesParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword p.p["physicalnetworkid"] = physicalnetworkid for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListTrafficTypes(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.TrafficTypes[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.TrafficTypes { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // Lists traffic types of a given physical network. func (s *UsageService) ListTrafficTypes(p *ListTrafficTypesParams) (*ListTrafficTypesResponse, error) { resp, err := s.cs.newRequest("listTrafficTypes", p.toURLValues()) if err != nil { return nil, err } var r ListTrafficTypesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListTrafficTypesResponse struct { Count int `json:"count"` TrafficTypes []*TrafficType `json:"traffictype"` } type TrafficType struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type ListUsageRecordsParams struct { p map[string]interface{} } func (p *ListUsageRecordsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["accountid"]; found { u.Set("accountid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["enddate"]; found { u.Set("enddate", v.(string)) } if v, found := p.p["includetags"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("includetags", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["startdate"]; found { u.Set("startdate", v.(string)) } if v, found := p.p["type"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("type", vv) } if v, found := p.p["usageid"]; found { u.Set("usageid", v.(string)) } return u } func (p *ListUsageRecordsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListUsageRecordsParams) SetAccountid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accountid"] = v return } func (p *ListUsageRecordsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListUsageRecordsParams) SetEnddate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["enddate"] = v return } func (p *ListUsageRecordsParams) SetIncludetags(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["includetags"] = v return } func (p *ListUsageRecordsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListUsageRecordsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListUsageRecordsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListUsageRecordsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListUsageRecordsParams) SetStartdate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startdate"] = v return } func (p *ListUsageRecordsParams) SetType(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } func (p *ListUsageRecordsParams) SetUsageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["usageid"] = v return } // You should always use this function to get a new ListUsageRecordsParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewListUsageRecordsParams(enddate string, startdate string) *ListUsageRecordsParams { p := &ListUsageRecordsParams{} p.p = make(map[string]interface{}) p.p["enddate"] = enddate p.p["startdate"] = startdate return p } // Lists usage records for accounts func (s *UsageService) ListUsageRecords(p *ListUsageRecordsParams) (*ListUsageRecordsResponse, error) { resp, err := s.cs.newRequest("listUsageRecords", p.toURLValues()) if err != nil { return nil, err } var r ListUsageRecordsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListUsageRecordsResponse struct { Count int `json:"count"` UsageRecords []*UsageRecord `json:"usagerecord"` } type UsageRecord struct { Account string `json:"account"` Accountid string `json:"accountid"` Cpunumber int64 `json:"cpunumber"` Cpuspeed int64 `json:"cpuspeed"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Enddate string `json:"enddate"` Isdefault bool `json:"isdefault"` Issourcenat bool `json:"issourcenat"` Issystem bool `json:"issystem"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Memory int64 `json:"memory"` Name string `json:"name"` Networkid string `json:"networkid"` Offeringid string `json:"offeringid"` Project string `json:"project"` Projectid string `json:"projectid"` Rawusage string `json:"rawusage"` Size int64 `json:"size"` Startdate string `json:"startdate"` Tags []Tags `json:"tags"` Templateid string `json:"templateid"` Type string `json:"type"` Usage string `json:"usage"` Usageid string `json:"usageid"` Usagetype int `json:"usagetype"` Virtualmachineid string `json:"virtualmachineid"` Virtualsize int64 `json:"virtualsize"` Zoneid string `json:"zoneid"` } type ListUsageTypesParams struct { p map[string]interface{} } func (p *ListUsageTypesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } return u } // You should always use this function to get a new ListUsageTypesParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewListUsageTypesParams() *ListUsageTypesParams { p := &ListUsageTypesParams{} p.p = make(map[string]interface{}) return p } // List Usage Types func (s *UsageService) ListUsageTypes(p *ListUsageTypesParams) (*ListUsageTypesResponse, error) { resp, err := s.cs.newRequest("listUsageTypes", p.toURLValues()) if err != nil { return nil, err } var r ListUsageTypesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListUsageTypesResponse struct { Count int `json:"count"` UsageTypes []*UsageType `json:"usagetype"` } type UsageType struct { Description string `json:"description"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Usagetypeid int `json:"usagetypeid"` } type RemoveRawUsageRecordsParams struct { p map[string]interface{} } func (p *RemoveRawUsageRecordsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["interval"]; found { vv := strconv.Itoa(v.(int)) u.Set("interval", vv) } return u } func (p *RemoveRawUsageRecordsParams) SetInterval(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["interval"] = v return } // You should always use this function to get a new RemoveRawUsageRecordsParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewRemoveRawUsageRecordsParams(interval int) *RemoveRawUsageRecordsParams { p := &RemoveRawUsageRecordsParams{} p.p = make(map[string]interface{}) p.p["interval"] = interval return p } // Safely removes raw records from cloud_usage table func (s *UsageService) RemoveRawUsageRecords(p *RemoveRawUsageRecordsParams) (*RemoveRawUsageRecordsResponse, error) { resp, err := s.cs.newRequest("removeRawUsageRecords", p.toURLValues()) if err != nil { return nil, err } var r RemoveRawUsageRecordsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type RemoveRawUsageRecordsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *RemoveRawUsageRecordsResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias RemoveRawUsageRecordsResponse return json.Unmarshal(b, (*alias)(r)) } type UpdateTrafficTypeParams struct { p map[string]interface{} } func (p *UpdateTrafficTypeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hypervnetworklabel"]; found { u.Set("hypervnetworklabel", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["kvmnetworklabel"]; found { u.Set("kvmnetworklabel", v.(string)) } if v, found := p.p["ovm3networklabel"]; found { u.Set("ovm3networklabel", v.(string)) } if v, found := p.p["vmwarenetworklabel"]; found { u.Set("vmwarenetworklabel", v.(string)) } if v, found := p.p["xennetworklabel"]; found { u.Set("xennetworklabel", v.(string)) } return u } func (p *UpdateTrafficTypeParams) SetHypervnetworklabel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervnetworklabel"] = v return } func (p *UpdateTrafficTypeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateTrafficTypeParams) SetKvmnetworklabel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["kvmnetworklabel"] = v return } func (p *UpdateTrafficTypeParams) SetOvm3networklabel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ovm3networklabel"] = v return } func (p *UpdateTrafficTypeParams) SetVmwarenetworklabel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vmwarenetworklabel"] = v return } func (p *UpdateTrafficTypeParams) SetXennetworklabel(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["xennetworklabel"] = v return } // You should always use this function to get a new UpdateTrafficTypeParams instance, // as then you are sure you have configured all required params func (s *UsageService) NewUpdateTrafficTypeParams(id string) *UpdateTrafficTypeParams { p := &UpdateTrafficTypeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates traffic type of a physical network func (s *UsageService) UpdateTrafficType(p *UpdateTrafficTypeParams) (*UpdateTrafficTypeResponse, error) { resp, err := s.cs.newRequest("updateTrafficType", p.toURLValues()) if err != nil { return nil, err } var r UpdateTrafficTypeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateTrafficTypeResponse struct { Hypervnetworklabel string `json:"hypervnetworklabel"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Kvmnetworklabel string `json:"kvmnetworklabel"` Ovm3networklabel string `json:"ovm3networklabel"` Physicalnetworkid string `json:"physicalnetworkid"` Traffictype string `json:"traffictype"` Vmwarenetworklabel string `json:"vmwarenetworklabel"` Xennetworklabel string `json:"xennetworklabel"` } go-cloudstack-2.9.0/cloudstack/UserService.go000066400000000000000000000666651364073403100212270ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateUserParams struct { p map[string]interface{} } func (p *CreateUserParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["email"]; found { u.Set("email", v.(string)) } if v, found := p.p["firstname"]; found { u.Set("firstname", v.(string)) } if v, found := p.p["lastname"]; found { u.Set("lastname", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["timezone"]; found { u.Set("timezone", v.(string)) } if v, found := p.p["userid"]; found { u.Set("userid", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *CreateUserParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateUserParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateUserParams) SetEmail(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["email"] = v return } func (p *CreateUserParams) SetFirstname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["firstname"] = v return } func (p *CreateUserParams) SetLastname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lastname"] = v return } func (p *CreateUserParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *CreateUserParams) SetTimezone(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["timezone"] = v return } func (p *CreateUserParams) SetUserid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["userid"] = v return } func (p *CreateUserParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new CreateUserParams instance, // as then you are sure you have configured all required params func (s *UserService) NewCreateUserParams(account string, email string, firstname string, lastname string, password string, username string) *CreateUserParams { p := &CreateUserParams{} p.p = make(map[string]interface{}) p.p["account"] = account p.p["email"] = email p.p["firstname"] = firstname p.p["lastname"] = lastname p.p["password"] = password p.p["username"] = username return p } // Creates a user for an account that already exists func (s *UserService) CreateUser(p *CreateUserParams) (*CreateUserResponse, error) { resp, err := s.cs.newRequest("createUser", p.toURLValues()) if err != nil { return nil, err } if resp, err = getRawValue(resp); err != nil { return nil, err } var r CreateUserResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateUserResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type DeleteUserParams struct { p map[string]interface{} } func (p *DeleteUserParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteUserParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteUserParams instance, // as then you are sure you have configured all required params func (s *UserService) NewDeleteUserParams(id string) *DeleteUserParams { p := &DeleteUserParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a user for an account func (s *UserService) DeleteUser(p *DeleteUserParams) (*DeleteUserResponse, error) { resp, err := s.cs.newRequest("deleteUser", p.toURLValues()) if err != nil { return nil, err } var r DeleteUserResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteUserResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteUserResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteUserResponse return json.Unmarshal(b, (*alias)(r)) } type DisableUserParams struct { p map[string]interface{} } func (p *DisableUserParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DisableUserParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DisableUserParams instance, // as then you are sure you have configured all required params func (s *UserService) NewDisableUserParams(id string) *DisableUserParams { p := &DisableUserParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Disables a user account func (s *UserService) DisableUser(p *DisableUserParams) (*DisableUserResponse, error) { resp, err := s.cs.newRequest("disableUser", p.toURLValues()) if err != nil { return nil, err } var r DisableUserResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DisableUserResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type EnableUserParams struct { p map[string]interface{} } func (p *EnableUserParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *EnableUserParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new EnableUserParams instance, // as then you are sure you have configured all required params func (s *UserService) NewEnableUserParams(id string) *EnableUserParams { p := &EnableUserParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Enables a user account func (s *UserService) EnableUser(p *EnableUserParams) (*EnableUserResponse, error) { resp, err := s.cs.newRequest("enableUser", p.toURLValues()) if err != nil { return nil, err } var r EnableUserResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type EnableUserResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type GetUserParams struct { p map[string]interface{} } func (p *GetUserParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["userapikey"]; found { u.Set("userapikey", v.(string)) } return u } func (p *GetUserParams) SetUserapikey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["userapikey"] = v return } // You should always use this function to get a new GetUserParams instance, // as then you are sure you have configured all required params func (s *UserService) NewGetUserParams(userapikey string) *GetUserParams { p := &GetUserParams{} p.p = make(map[string]interface{}) p.p["userapikey"] = userapikey return p } // Find user account by API key func (s *UserService) GetUser(p *GetUserParams) (*GetUserResponse, error) { resp, err := s.cs.newRequest("getUser", p.toURLValues()) if err != nil { return nil, err } var r GetUserResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetUserResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type GetVirtualMachineUserDataParams struct { p map[string]interface{} } func (p *GetVirtualMachineUserDataParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *GetVirtualMachineUserDataParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new GetVirtualMachineUserDataParams instance, // as then you are sure you have configured all required params func (s *UserService) NewGetVirtualMachineUserDataParams(virtualmachineid string) *GetVirtualMachineUserDataParams { p := &GetVirtualMachineUserDataParams{} p.p = make(map[string]interface{}) p.p["virtualmachineid"] = virtualmachineid return p } // Returns user data associated with the VM func (s *UserService) GetVirtualMachineUserData(p *GetVirtualMachineUserDataParams) (*GetVirtualMachineUserDataResponse, error) { resp, err := s.cs.newRequest("getVirtualMachineUserData", p.toURLValues()) if err != nil { return nil, err } if resp, err = getRawValue(resp); err != nil { return nil, err } var r GetVirtualMachineUserDataResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetVirtualMachineUserDataResponse struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Userdata string `json:"userdata"` Virtualmachineid string `json:"virtualmachineid"` } type ListUsersParams struct { p map[string]interface{} } func (p *ListUsersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["accounttype"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("accounttype", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *ListUsersParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListUsersParams) SetAccounttype(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["accounttype"] = v return } func (p *ListUsersParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListUsersParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListUsersParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListUsersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListUsersParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListUsersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListUsersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListUsersParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListUsersParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new ListUsersParams instance, // as then you are sure you have configured all required params func (s *UserService) NewListUsersParams() *ListUsersParams { p := &ListUsersParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *UserService) GetUserByID(id string, opts ...OptionFunc) (*User, int, error) { p := &ListUsersParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListUsers(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Users[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for User UUID: %s!", id) } // Lists user accounts func (s *UserService) ListUsers(p *ListUsersParams) (*ListUsersResponse, error) { resp, err := s.cs.newRequest("listUsers", p.toURLValues()) if err != nil { return nil, err } var r ListUsersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListUsersResponse struct { Count int `json:"count"` Users []*User `json:"user"` } type User struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type LockUserParams struct { p map[string]interface{} } func (p *LockUserParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *LockUserParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new LockUserParams instance, // as then you are sure you have configured all required params func (s *UserService) NewLockUserParams(id string) *LockUserParams { p := &LockUserParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Locks a user account func (s *UserService) LockUser(p *LockUserParams) (*LockUserResponse, error) { resp, err := s.cs.newRequest("lockUser", p.toURLValues()) if err != nil { return nil, err } var r LockUserResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type LockUserResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } type RegisterUserKeysParams struct { p map[string]interface{} } func (p *RegisterUserKeysParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RegisterUserKeysParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RegisterUserKeysParams instance, // as then you are sure you have configured all required params func (s *UserService) NewRegisterUserKeysParams(id string) *RegisterUserKeysParams { p := &RegisterUserKeysParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user func (s *UserService) RegisterUserKeys(p *RegisterUserKeysParams) (*RegisterUserKeysResponse, error) { resp, err := s.cs.newRequest("registerUserKeys", p.toURLValues()) if err != nil { return nil, err } if resp, err = getRawValue(resp); err != nil { return nil, err } var r RegisterUserKeysResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type RegisterUserKeysResponse struct { Apikey string `json:"apikey"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Secretkey string `json:"secretkey"` } type UpdateUserParams struct { p map[string]interface{} } func (p *UpdateUserParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["currentpassword"]; found { u.Set("currentpassword", v.(string)) } if v, found := p.p["email"]; found { u.Set("email", v.(string)) } if v, found := p.p["firstname"]; found { u.Set("firstname", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["lastname"]; found { u.Set("lastname", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["timezone"]; found { u.Set("timezone", v.(string)) } if v, found := p.p["userapikey"]; found { u.Set("userapikey", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } if v, found := p.p["usersecretkey"]; found { u.Set("usersecretkey", v.(string)) } return u } func (p *UpdateUserParams) SetCurrentpassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["currentpassword"] = v return } func (p *UpdateUserParams) SetEmail(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["email"] = v return } func (p *UpdateUserParams) SetFirstname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["firstname"] = v return } func (p *UpdateUserParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateUserParams) SetLastname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["lastname"] = v return } func (p *UpdateUserParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *UpdateUserParams) SetTimezone(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["timezone"] = v return } func (p *UpdateUserParams) SetUserapikey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["userapikey"] = v return } func (p *UpdateUserParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } func (p *UpdateUserParams) SetUsersecretkey(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["usersecretkey"] = v return } // You should always use this function to get a new UpdateUserParams instance, // as then you are sure you have configured all required params func (s *UserService) NewUpdateUserParams(id string) *UpdateUserParams { p := &UpdateUserParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a user account func (s *UserService) UpdateUser(p *UpdateUserParams) (*UpdateUserResponse, error) { resp, err := s.cs.newRequest("updateUser", p.toURLValues()) if err != nil { return nil, err } var r UpdateUserResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateUserResponse struct { Account string `json:"account"` Accountid string `json:"accountid"` Accounttype int `json:"accounttype"` Apikey string `json:"apikey"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Email string `json:"email"` Firstname string `json:"firstname"` Id string `json:"id"` Iscallerchilddomain bool `json:"iscallerchilddomain"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Lastname string `json:"lastname"` Roleid string `json:"roleid"` Rolename string `json:"rolename"` Roletype string `json:"roletype"` Secretkey string `json:"secretkey"` State string `json:"state"` Timezone string `json:"timezone"` Username string `json:"username"` Usersource string `json:"usersource"` } go-cloudstack-2.9.0/cloudstack/VLANService.go000066400000000000000000000574721364073403100210450ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateVlanIpRangeParams struct { p map[string]interface{} } func (p *CreateVlanIpRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["endip"]; found { u.Set("endip", v.(string)) } if v, found := p.p["endipv6"]; found { u.Set("endipv6", v.(string)) } if v, found := p.p["forsystemvms"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forsystemvms", vv) } if v, found := p.p["forvirtualnetwork"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forvirtualnetwork", vv) } if v, found := p.p["gateway"]; found { u.Set("gateway", v.(string)) } if v, found := p.p["ip6cidr"]; found { u.Set("ip6cidr", v.(string)) } if v, found := p.p["ip6gateway"]; found { u.Set("ip6gateway", v.(string)) } if v, found := p.p["netmask"]; found { u.Set("netmask", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["startip"]; found { u.Set("startip", v.(string)) } if v, found := p.p["startipv6"]; found { u.Set("startipv6", v.(string)) } if v, found := p.p["vlan"]; found { u.Set("vlan", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreateVlanIpRangeParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateVlanIpRangeParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateVlanIpRangeParams) SetEndip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endip"] = v return } func (p *CreateVlanIpRangeParams) SetEndipv6(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["endipv6"] = v return } func (p *CreateVlanIpRangeParams) SetForsystemvms(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forsystemvms"] = v return } func (p *CreateVlanIpRangeParams) SetForvirtualnetwork(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forvirtualnetwork"] = v return } func (p *CreateVlanIpRangeParams) SetGateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gateway"] = v return } func (p *CreateVlanIpRangeParams) SetIp6cidr(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ip6cidr"] = v return } func (p *CreateVlanIpRangeParams) SetIp6gateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ip6gateway"] = v return } func (p *CreateVlanIpRangeParams) SetNetmask(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["netmask"] = v return } func (p *CreateVlanIpRangeParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *CreateVlanIpRangeParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *CreateVlanIpRangeParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *CreateVlanIpRangeParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *CreateVlanIpRangeParams) SetStartip(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startip"] = v return } func (p *CreateVlanIpRangeParams) SetStartipv6(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startipv6"] = v return } func (p *CreateVlanIpRangeParams) SetVlan(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } func (p *CreateVlanIpRangeParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreateVlanIpRangeParams instance, // as then you are sure you have configured all required params func (s *VLANService) NewCreateVlanIpRangeParams() *CreateVlanIpRangeParams { p := &CreateVlanIpRangeParams{} p.p = make(map[string]interface{}) return p } // Creates a VLAN IP range. func (s *VLANService) CreateVlanIpRange(p *CreateVlanIpRangeParams) (*CreateVlanIpRangeResponse, error) { resp, err := s.cs.newRequest("createVlanIpRange", p.toURLValues()) if err != nil { return nil, err } var r CreateVlanIpRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateVlanIpRangeResponse struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Endip string `json:"endip"` Endipv6 string `json:"endipv6"` Forsystemvms bool `json:"forsystemvms"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Netmask string `json:"netmask"` Networkid string `json:"networkid"` Physicalnetworkid string `json:"physicalnetworkid"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Startip string `json:"startip"` Startipv6 string `json:"startipv6"` Vlan string `json:"vlan"` Zoneid string `json:"zoneid"` } type DedicateGuestVlanRangeParams struct { p map[string]interface{} } func (p *DedicateGuestVlanRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["vlanrange"]; found { u.Set("vlanrange", v.(string)) } return u } func (p *DedicateGuestVlanRangeParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DedicateGuestVlanRangeParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DedicateGuestVlanRangeParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *DedicateGuestVlanRangeParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *DedicateGuestVlanRangeParams) SetVlanrange(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlanrange"] = v return } // You should always use this function to get a new DedicateGuestVlanRangeParams instance, // as then you are sure you have configured all required params func (s *VLANService) NewDedicateGuestVlanRangeParams(physicalnetworkid string, vlanrange string) *DedicateGuestVlanRangeParams { p := &DedicateGuestVlanRangeParams{} p.p = make(map[string]interface{}) p.p["physicalnetworkid"] = physicalnetworkid p.p["vlanrange"] = vlanrange return p } // Dedicates a guest vlan range to an account func (s *VLANService) DedicateGuestVlanRange(p *DedicateGuestVlanRangeParams) (*DedicateGuestVlanRangeResponse, error) { resp, err := s.cs.newRequest("dedicateGuestVlanRange", p.toURLValues()) if err != nil { return nil, err } var r DedicateGuestVlanRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DedicateGuestVlanRangeResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Guestvlanrange string `json:"guestvlanrange"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Physicalnetworkid int64 `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Zoneid int64 `json:"zoneid"` } type DeleteVlanIpRangeParams struct { p map[string]interface{} } func (p *DeleteVlanIpRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteVlanIpRangeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteVlanIpRangeParams instance, // as then you are sure you have configured all required params func (s *VLANService) NewDeleteVlanIpRangeParams(id string) *DeleteVlanIpRangeParams { p := &DeleteVlanIpRangeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Creates a VLAN IP range. func (s *VLANService) DeleteVlanIpRange(p *DeleteVlanIpRangeParams) (*DeleteVlanIpRangeResponse, error) { resp, err := s.cs.newRequest("deleteVlanIpRange", p.toURLValues()) if err != nil { return nil, err } var r DeleteVlanIpRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteVlanIpRangeResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteVlanIpRangeResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteVlanIpRangeResponse return json.Unmarshal(b, (*alias)(r)) } type ListDedicatedGuestVlanRangesParams struct { p map[string]interface{} } func (p *ListDedicatedGuestVlanRangesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["guestvlanrange"]; found { u.Set("guestvlanrange", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListDedicatedGuestVlanRangesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListDedicatedGuestVlanRangesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListDedicatedGuestVlanRangesParams) SetGuestvlanrange(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["guestvlanrange"] = v return } func (p *ListDedicatedGuestVlanRangesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListDedicatedGuestVlanRangesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListDedicatedGuestVlanRangesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListDedicatedGuestVlanRangesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListDedicatedGuestVlanRangesParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *ListDedicatedGuestVlanRangesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListDedicatedGuestVlanRangesParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListDedicatedGuestVlanRangesParams instance, // as then you are sure you have configured all required params func (s *VLANService) NewListDedicatedGuestVlanRangesParams() *ListDedicatedGuestVlanRangesParams { p := &ListDedicatedGuestVlanRangesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VLANService) GetDedicatedGuestVlanRangeByID(id string, opts ...OptionFunc) (*DedicatedGuestVlanRange, int, error) { p := &ListDedicatedGuestVlanRangesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListDedicatedGuestVlanRanges(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.DedicatedGuestVlanRanges[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for DedicatedGuestVlanRange UUID: %s!", id) } // Lists dedicated guest vlan ranges func (s *VLANService) ListDedicatedGuestVlanRanges(p *ListDedicatedGuestVlanRangesParams) (*ListDedicatedGuestVlanRangesResponse, error) { resp, err := s.cs.newRequest("listDedicatedGuestVlanRanges", p.toURLValues()) if err != nil { return nil, err } var r ListDedicatedGuestVlanRangesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListDedicatedGuestVlanRangesResponse struct { Count int `json:"count"` DedicatedGuestVlanRanges []*DedicatedGuestVlanRange `json:"dedicatedguestvlanrange"` } type DedicatedGuestVlanRange struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Guestvlanrange string `json:"guestvlanrange"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Physicalnetworkid int64 `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Zoneid int64 `json:"zoneid"` } type ListVlanIpRangesParams struct { p map[string]interface{} } func (p *ListVlanIpRangesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["forvirtualnetwork"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forvirtualnetwork", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["vlan"]; found { u.Set("vlan", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListVlanIpRangesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListVlanIpRangesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListVlanIpRangesParams) SetForvirtualnetwork(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forvirtualnetwork"] = v return } func (p *ListVlanIpRangesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListVlanIpRangesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVlanIpRangesParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListVlanIpRangesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVlanIpRangesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListVlanIpRangesParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *ListVlanIpRangesParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListVlanIpRangesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListVlanIpRangesParams) SetVlan(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } func (p *ListVlanIpRangesParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListVlanIpRangesParams instance, // as then you are sure you have configured all required params func (s *VLANService) NewListVlanIpRangesParams() *ListVlanIpRangesParams { p := &ListVlanIpRangesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VLANService) GetVlanIpRangeByID(id string, opts ...OptionFunc) (*VlanIpRange, int, error) { p := &ListVlanIpRangesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListVlanIpRanges(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.VlanIpRanges[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for VlanIpRange UUID: %s!", id) } // Lists all VLAN IP ranges. func (s *VLANService) ListVlanIpRanges(p *ListVlanIpRangesParams) (*ListVlanIpRangesResponse, error) { resp, err := s.cs.newRequest("listVlanIpRanges", p.toURLValues()) if err != nil { return nil, err } var r ListVlanIpRangesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVlanIpRangesResponse struct { Count int `json:"count"` VlanIpRanges []*VlanIpRange `json:"vlaniprange"` } type VlanIpRange struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Endip string `json:"endip"` Endipv6 string `json:"endipv6"` Forsystemvms bool `json:"forsystemvms"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Netmask string `json:"netmask"` Networkid string `json:"networkid"` Physicalnetworkid string `json:"physicalnetworkid"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Startip string `json:"startip"` Startipv6 string `json:"startipv6"` Vlan string `json:"vlan"` Zoneid string `json:"zoneid"` } type ReleaseDedicatedGuestVlanRangeParams struct { p map[string]interface{} } func (p *ReleaseDedicatedGuestVlanRangeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ReleaseDedicatedGuestVlanRangeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ReleaseDedicatedGuestVlanRangeParams instance, // as then you are sure you have configured all required params func (s *VLANService) NewReleaseDedicatedGuestVlanRangeParams(id string) *ReleaseDedicatedGuestVlanRangeParams { p := &ReleaseDedicatedGuestVlanRangeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Releases a dedicated guest vlan range to the system func (s *VLANService) ReleaseDedicatedGuestVlanRange(p *ReleaseDedicatedGuestVlanRangeParams) (*ReleaseDedicatedGuestVlanRangeResponse, error) { resp, err := s.cs.newRequest("releaseDedicatedGuestVlanRange", p.toURLValues()) if err != nil { return nil, err } var r ReleaseDedicatedGuestVlanRangeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ReleaseDedicatedGuestVlanRangeResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } go-cloudstack-2.9.0/cloudstack/VMGroupService.go000066400000000000000000000301371364073403100216310ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateInstanceGroupParams struct { p map[string]interface{} } func (p *CreateInstanceGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *CreateInstanceGroupParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateInstanceGroupParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateInstanceGroupParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateInstanceGroupParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new CreateInstanceGroupParams instance, // as then you are sure you have configured all required params func (s *VMGroupService) NewCreateInstanceGroupParams(name string) *CreateInstanceGroupParams { p := &CreateInstanceGroupParams{} p.p = make(map[string]interface{}) p.p["name"] = name return p } // Creates a vm group func (s *VMGroupService) CreateInstanceGroup(p *CreateInstanceGroupParams) (*CreateInstanceGroupResponse, error) { resp, err := s.cs.newRequest("createInstanceGroup", p.toURLValues()) if err != nil { return nil, err } var r CreateInstanceGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateInstanceGroupResponse struct { Account string `json:"account"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` } type DeleteInstanceGroupParams struct { p map[string]interface{} } func (p *DeleteInstanceGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteInstanceGroupParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteInstanceGroupParams instance, // as then you are sure you have configured all required params func (s *VMGroupService) NewDeleteInstanceGroupParams(id string) *DeleteInstanceGroupParams { p := &DeleteInstanceGroupParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a vm group func (s *VMGroupService) DeleteInstanceGroup(p *DeleteInstanceGroupParams) (*DeleteInstanceGroupResponse, error) { resp, err := s.cs.newRequest("deleteInstanceGroup", p.toURLValues()) if err != nil { return nil, err } var r DeleteInstanceGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteInstanceGroupResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteInstanceGroupResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteInstanceGroupResponse return json.Unmarshal(b, (*alias)(r)) } type ListInstanceGroupsParams struct { p map[string]interface{} } func (p *ListInstanceGroupsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *ListInstanceGroupsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListInstanceGroupsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListInstanceGroupsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListInstanceGroupsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListInstanceGroupsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListInstanceGroupsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListInstanceGroupsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListInstanceGroupsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListInstanceGroupsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListInstanceGroupsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new ListInstanceGroupsParams instance, // as then you are sure you have configured all required params func (s *VMGroupService) NewListInstanceGroupsParams() *ListInstanceGroupsParams { p := &ListInstanceGroupsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VMGroupService) GetInstanceGroupID(name string, opts ...OptionFunc) (string, int, error) { p := &ListInstanceGroupsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListInstanceGroups(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.InstanceGroups[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.InstanceGroups { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VMGroupService) GetInstanceGroupByName(name string, opts ...OptionFunc) (*InstanceGroup, int, error) { id, count, err := s.GetInstanceGroupID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetInstanceGroupByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VMGroupService) GetInstanceGroupByID(id string, opts ...OptionFunc) (*InstanceGroup, int, error) { p := &ListInstanceGroupsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListInstanceGroups(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.InstanceGroups[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for InstanceGroup UUID: %s!", id) } // Lists vm groups func (s *VMGroupService) ListInstanceGroups(p *ListInstanceGroupsParams) (*ListInstanceGroupsResponse, error) { resp, err := s.cs.newRequest("listInstanceGroups", p.toURLValues()) if err != nil { return nil, err } var r ListInstanceGroupsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListInstanceGroupsResponse struct { Count int `json:"count"` InstanceGroups []*InstanceGroup `json:"instancegroup"` } type InstanceGroup struct { Account string `json:"account"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` } type UpdateInstanceGroupParams struct { p map[string]interface{} } func (p *UpdateInstanceGroupParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } return u } func (p *UpdateInstanceGroupParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateInstanceGroupParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } // You should always use this function to get a new UpdateInstanceGroupParams instance, // as then you are sure you have configured all required params func (s *VMGroupService) NewUpdateInstanceGroupParams(id string) *UpdateInstanceGroupParams { p := &UpdateInstanceGroupParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a vm group func (s *VMGroupService) UpdateInstanceGroup(p *UpdateInstanceGroupParams) (*UpdateInstanceGroupResponse, error) { resp, err := s.cs.newRequest("updateInstanceGroup", p.toURLValues()) if err != nil { return nil, err } var r UpdateInstanceGroupResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateInstanceGroupResponse struct { Account string `json:"account"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` } go-cloudstack-2.9.0/cloudstack/VPCService.go000066400000000000000000002515421364073403100207270ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreatePrivateGatewayParams struct { p map[string]interface{} } func (p *CreatePrivateGatewayParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["aclid"]; found { u.Set("aclid", v.(string)) } if v, found := p.p["gateway"]; found { u.Set("gateway", v.(string)) } if v, found := p.p["ipaddress"]; found { u.Set("ipaddress", v.(string)) } if v, found := p.p["netmask"]; found { u.Set("netmask", v.(string)) } if v, found := p.p["networkofferingid"]; found { u.Set("networkofferingid", v.(string)) } if v, found := p.p["physicalnetworkid"]; found { u.Set("physicalnetworkid", v.(string)) } if v, found := p.p["sourcenatsupported"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("sourcenatsupported", vv) } if v, found := p.p["vlan"]; found { u.Set("vlan", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } return u } func (p *CreatePrivateGatewayParams) SetAclid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["aclid"] = v return } func (p *CreatePrivateGatewayParams) SetGateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gateway"] = v return } func (p *CreatePrivateGatewayParams) SetIpaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddress"] = v return } func (p *CreatePrivateGatewayParams) SetNetmask(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["netmask"] = v return } func (p *CreatePrivateGatewayParams) SetNetworkofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkofferingid"] = v return } func (p *CreatePrivateGatewayParams) SetPhysicalnetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["physicalnetworkid"] = v return } func (p *CreatePrivateGatewayParams) SetSourcenatsupported(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["sourcenatsupported"] = v return } func (p *CreatePrivateGatewayParams) SetVlan(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } func (p *CreatePrivateGatewayParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } // You should always use this function to get a new CreatePrivateGatewayParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewCreatePrivateGatewayParams(gateway string, ipaddress string, netmask string, vlan string, vpcid string) *CreatePrivateGatewayParams { p := &CreatePrivateGatewayParams{} p.p = make(map[string]interface{}) p.p["gateway"] = gateway p.p["ipaddress"] = ipaddress p.p["netmask"] = netmask p.p["vlan"] = vlan p.p["vpcid"] = vpcid return p } // Creates a private gateway func (s *VPCService) CreatePrivateGateway(p *CreatePrivateGatewayParams) (*CreatePrivateGatewayResponse, error) { resp, err := s.cs.newRequest("createPrivateGateway", p.toURLValues()) if err != nil { return nil, err } var r CreatePrivateGatewayResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreatePrivateGatewayResponse struct { Account string `json:"account"` Aclid string `json:"aclid"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Netmask string `json:"netmask"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Sourcenatsupported bool `json:"sourcenatsupported"` State string `json:"state"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type CreateStaticRouteParams struct { p map[string]interface{} } func (p *CreateStaticRouteParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["cidr"]; found { u.Set("cidr", v.(string)) } if v, found := p.p["gatewayid"]; found { u.Set("gatewayid", v.(string)) } return u } func (p *CreateStaticRouteParams) SetCidr(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidr"] = v return } func (p *CreateStaticRouteParams) SetGatewayid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gatewayid"] = v return } // You should always use this function to get a new CreateStaticRouteParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewCreateStaticRouteParams(cidr string, gatewayid string) *CreateStaticRouteParams { p := &CreateStaticRouteParams{} p.p = make(map[string]interface{}) p.p["cidr"] = cidr p.p["gatewayid"] = gatewayid return p } // Creates a static route func (s *VPCService) CreateStaticRoute(p *CreateStaticRouteParams) (*CreateStaticRouteResponse, error) { resp, err := s.cs.newRequest("createStaticRoute", p.toURLValues()) if err != nil { return nil, err } var r CreateStaticRouteResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateStaticRouteResponse struct { Account string `json:"account"` Cidr string `json:"cidr"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gatewayid string `json:"gatewayid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` State string `json:"state"` Tags []Tags `json:"tags"` Vpcid string `json:"vpcid"` } type CreateVPCParams struct { p map[string]interface{} } func (p *CreateVPCParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["cidr"]; found { u.Set("cidr", v.(string)) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkdomain"]; found { u.Set("networkdomain", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["start"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("start", vv) } if v, found := p.p["vpcofferingid"]; found { u.Set("vpcofferingid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreateVPCParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateVPCParams) SetCidr(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidr"] = v return } func (p *CreateVPCParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *CreateVPCParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateVPCParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateVPCParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateVPCParams) SetNetworkdomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkdomain"] = v return } func (p *CreateVPCParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *CreateVPCParams) SetStart(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["start"] = v return } func (p *CreateVPCParams) SetVpcofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcofferingid"] = v return } func (p *CreateVPCParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreateVPCParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewCreateVPCParams(cidr string, displaytext string, name string, vpcofferingid string, zoneid string) *CreateVPCParams { p := &CreateVPCParams{} p.p = make(map[string]interface{}) p.p["cidr"] = cidr p.p["displaytext"] = displaytext p.p["name"] = name p.p["vpcofferingid"] = vpcofferingid p.p["zoneid"] = zoneid return p } // Creates a VPC func (s *VPCService) CreateVPC(p *CreateVPCParams) (*CreateVPCResponse, error) { resp, err := s.cs.newRequest("createVPC", p.toURLValues()) if err != nil { return nil, err } var r CreateVPCResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateVPCResponse struct { Account string `json:"account"` Cidr string `json:"cidr"` Created string `json:"created"` Displaytext string `json:"displaytext"` Distributedvpcrouter bool `json:"distributedvpcrouter"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Network []CreateVPCResponseNetwork `json:"network"` Networkdomain string `json:"networkdomain"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantvpcrouter bool `json:"redundantvpcrouter"` Regionlevelvpc bool `json:"regionlevelvpc"` Restartrequired bool `json:"restartrequired"` Service []CreateVPCResponseService `json:"service"` State string `json:"state"` Tags []Tags `json:"tags"` Vpcofferingid string `json:"vpcofferingid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type CreateVPCResponseService struct { Capability []CreateVPCResponseServiceCapability `json:"capability"` Name string `json:"name"` Provider []CreateVPCResponseServiceProvider `json:"provider"` } type CreateVPCResponseServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type CreateVPCResponseServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type CreateVPCResponseNetwork struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []CreateVPCResponseNetworkService `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type CreateVPCResponseNetworkService struct { Capability []CreateVPCResponseNetworkServiceCapability `json:"capability"` Name string `json:"name"` Provider []CreateVPCResponseNetworkServiceProvider `json:"provider"` } type CreateVPCResponseNetworkServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type CreateVPCResponseNetworkServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type CreateVPCOfferingParams struct { p map[string]interface{} } func (p *CreateVPCOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["servicecapabilitylist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("servicecapabilitylist[%d].key", i), k) u.Set(fmt.Sprintf("servicecapabilitylist[%d].value", i), m[k]) } } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } if v, found := p.p["serviceproviderlist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("serviceproviderlist[%d].service", i), k) u.Set(fmt.Sprintf("serviceproviderlist[%d].provider", i), m[k]) } } if v, found := p.p["supportedservices"]; found { vv := strings.Join(v.([]string), ",") u.Set("supportedservices", vv) } return u } func (p *CreateVPCOfferingParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *CreateVPCOfferingParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateVPCOfferingParams) SetServicecapabilitylist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["servicecapabilitylist"] = v return } func (p *CreateVPCOfferingParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } func (p *CreateVPCOfferingParams) SetServiceproviderlist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceproviderlist"] = v return } func (p *CreateVPCOfferingParams) SetSupportedservices(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["supportedservices"] = v return } // You should always use this function to get a new CreateVPCOfferingParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewCreateVPCOfferingParams(displaytext string, name string, supportedservices []string) *CreateVPCOfferingParams { p := &CreateVPCOfferingParams{} p.p = make(map[string]interface{}) p.p["displaytext"] = displaytext p.p["name"] = name p.p["supportedservices"] = supportedservices return p } // Creates VPC offering func (s *VPCService) CreateVPCOffering(p *CreateVPCOfferingParams) (*CreateVPCOfferingResponse, error) { resp, err := s.cs.newRequest("createVPCOffering", p.toURLValues()) if err != nil { return nil, err } var r CreateVPCOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateVPCOfferingResponse struct { Created string `json:"created"` Displaytext string `json:"displaytext"` Distributedvpcrouter bool `json:"distributedvpcrouter"` Id string `json:"id"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Service []CreateVPCOfferingResponseService `json:"service"` State string `json:"state"` SupportsregionLevelvpc bool `json:"supportsregionLevelvpc"` } type CreateVPCOfferingResponseService struct { Capability []CreateVPCOfferingResponseServiceCapability `json:"capability"` Name string `json:"name"` Provider []CreateVPCOfferingResponseServiceProvider `json:"provider"` } type CreateVPCOfferingResponseServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type CreateVPCOfferingResponseServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type DeletePrivateGatewayParams struct { p map[string]interface{} } func (p *DeletePrivateGatewayParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeletePrivateGatewayParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeletePrivateGatewayParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewDeletePrivateGatewayParams(id string) *DeletePrivateGatewayParams { p := &DeletePrivateGatewayParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a Private gateway func (s *VPCService) DeletePrivateGateway(p *DeletePrivateGatewayParams) (*DeletePrivateGatewayResponse, error) { resp, err := s.cs.newRequest("deletePrivateGateway", p.toURLValues()) if err != nil { return nil, err } var r DeletePrivateGatewayResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeletePrivateGatewayResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteStaticRouteParams struct { p map[string]interface{} } func (p *DeleteStaticRouteParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteStaticRouteParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteStaticRouteParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewDeleteStaticRouteParams(id string) *DeleteStaticRouteParams { p := &DeleteStaticRouteParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a static route func (s *VPCService) DeleteStaticRoute(p *DeleteStaticRouteParams) (*DeleteStaticRouteResponse, error) { resp, err := s.cs.newRequest("deleteStaticRoute", p.toURLValues()) if err != nil { return nil, err } var r DeleteStaticRouteResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteStaticRouteResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteVPCParams struct { p map[string]interface{} } func (p *DeleteVPCParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteVPCParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteVPCParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewDeleteVPCParams(id string) *DeleteVPCParams { p := &DeleteVPCParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a VPC func (s *VPCService) DeleteVPC(p *DeleteVPCParams) (*DeleteVPCResponse, error) { resp, err := s.cs.newRequest("deleteVPC", p.toURLValues()) if err != nil { return nil, err } var r DeleteVPCResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteVPCResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteVPCOfferingParams struct { p map[string]interface{} } func (p *DeleteVPCOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteVPCOfferingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteVPCOfferingParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewDeleteVPCOfferingParams(id string) *DeleteVPCOfferingParams { p := &DeleteVPCOfferingParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes VPC offering func (s *VPCService) DeleteVPCOffering(p *DeleteVPCOfferingParams) (*DeleteVPCOfferingResponse, error) { resp, err := s.cs.newRequest("deleteVPCOffering", p.toURLValues()) if err != nil { return nil, err } var r DeleteVPCOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteVPCOfferingResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListPrivateGatewaysParams struct { p map[string]interface{} } func (p *ListPrivateGatewaysParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ipaddress"]; found { u.Set("ipaddress", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["vlan"]; found { u.Set("vlan", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } return u } func (p *ListPrivateGatewaysParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListPrivateGatewaysParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListPrivateGatewaysParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListPrivateGatewaysParams) SetIpaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddress"] = v return } func (p *ListPrivateGatewaysParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListPrivateGatewaysParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListPrivateGatewaysParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListPrivateGatewaysParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListPrivateGatewaysParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListPrivateGatewaysParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListPrivateGatewaysParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListPrivateGatewaysParams) SetVlan(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vlan"] = v return } func (p *ListPrivateGatewaysParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } // You should always use this function to get a new ListPrivateGatewaysParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewListPrivateGatewaysParams() *ListPrivateGatewaysParams { p := &ListPrivateGatewaysParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPCService) GetPrivateGatewayByID(id string, opts ...OptionFunc) (*PrivateGateway, int, error) { p := &ListPrivateGatewaysParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListPrivateGateways(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.PrivateGateways[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for PrivateGateway UUID: %s!", id) } // List private gateways func (s *VPCService) ListPrivateGateways(p *ListPrivateGatewaysParams) (*ListPrivateGatewaysResponse, error) { resp, err := s.cs.newRequest("listPrivateGateways", p.toURLValues()) if err != nil { return nil, err } var r ListPrivateGatewaysResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListPrivateGatewaysResponse struct { Count int `json:"count"` PrivateGateways []*PrivateGateway `json:"privategateway"` } type PrivateGateway struct { Account string `json:"account"` Aclid string `json:"aclid"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gateway string `json:"gateway"` Id string `json:"id"` Ipaddress string `json:"ipaddress"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Netmask string `json:"netmask"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Sourcenatsupported bool `json:"sourcenatsupported"` State string `json:"state"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListStaticRoutesParams struct { p map[string]interface{} } func (p *ListStaticRoutesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["gatewayid"]; found { u.Set("gatewayid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } return u } func (p *ListStaticRoutesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListStaticRoutesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListStaticRoutesParams) SetGatewayid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gatewayid"] = v return } func (p *ListStaticRoutesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListStaticRoutesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListStaticRoutesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListStaticRoutesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListStaticRoutesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListStaticRoutesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListStaticRoutesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListStaticRoutesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListStaticRoutesParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } // You should always use this function to get a new ListStaticRoutesParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewListStaticRoutesParams() *ListStaticRoutesParams { p := &ListStaticRoutesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPCService) GetStaticRouteByID(id string, opts ...OptionFunc) (*StaticRoute, int, error) { p := &ListStaticRoutesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListStaticRoutes(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.StaticRoutes[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for StaticRoute UUID: %s!", id) } // Lists all static routes func (s *VPCService) ListStaticRoutes(p *ListStaticRoutesParams) (*ListStaticRoutesResponse, error) { resp, err := s.cs.newRequest("listStaticRoutes", p.toURLValues()) if err != nil { return nil, err } var r ListStaticRoutesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListStaticRoutesResponse struct { Count int `json:"count"` StaticRoutes []*StaticRoute `json:"staticroute"` } type StaticRoute struct { Account string `json:"account"` Cidr string `json:"cidr"` Domain string `json:"domain"` Domainid string `json:"domainid"` Gatewayid string `json:"gatewayid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` State string `json:"state"` Tags []Tags `json:"tags"` Vpcid string `json:"vpcid"` } type ListVPCOfferingsParams struct { p map[string]interface{} } func (p *ListVPCOfferingsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isdefault"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isdefault", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["supportedservices"]; found { vv := strings.Join(v.([]string), ",") u.Set("supportedservices", vv) } return u } func (p *ListVPCOfferingsParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *ListVPCOfferingsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListVPCOfferingsParams) SetIsdefault(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isdefault"] = v return } func (p *ListVPCOfferingsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVPCOfferingsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListVPCOfferingsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVPCOfferingsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListVPCOfferingsParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListVPCOfferingsParams) SetSupportedservices(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["supportedservices"] = v return } // You should always use this function to get a new ListVPCOfferingsParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewListVPCOfferingsParams() *ListVPCOfferingsParams { p := &ListVPCOfferingsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPCService) GetVPCOfferingID(name string, opts ...OptionFunc) (string, int, error) { p := &ListVPCOfferingsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListVPCOfferings(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.VPCOfferings[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.VPCOfferings { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPCService) GetVPCOfferingByName(name string, opts ...OptionFunc) (*VPCOffering, int, error) { id, count, err := s.GetVPCOfferingID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetVPCOfferingByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPCService) GetVPCOfferingByID(id string, opts ...OptionFunc) (*VPCOffering, int, error) { p := &ListVPCOfferingsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListVPCOfferings(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.VPCOfferings[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for VPCOffering UUID: %s!", id) } // Lists VPC offerings func (s *VPCService) ListVPCOfferings(p *ListVPCOfferingsParams) (*ListVPCOfferingsResponse, error) { resp, err := s.cs.newRequest("listVPCOfferings", p.toURLValues()) if err != nil { return nil, err } var r ListVPCOfferingsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVPCOfferingsResponse struct { Count int `json:"count"` VPCOfferings []*VPCOffering `json:"vpcoffering"` } type VPCOffering struct { Created string `json:"created"` Displaytext string `json:"displaytext"` Distributedvpcrouter bool `json:"distributedvpcrouter"` Id string `json:"id"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Service []VPCOfferingService `json:"service"` State string `json:"state"` SupportsregionLevelvpc bool `json:"supportsregionLevelvpc"` } type VPCOfferingService struct { Capability []VPCOfferingServiceCapability `json:"capability"` Name string `json:"name"` Provider []VPCOfferingServiceProvider `json:"provider"` } type VPCOfferingServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type VPCOfferingServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type ListVPCsParams struct { p map[string]interface{} } func (p *ListVPCsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["cidr"]; found { u.Set("cidr", v.(string)) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["restartrequired"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("restartrequired", vv) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["supportedservices"]; found { vv := strings.Join(v.([]string), ",") u.Set("supportedservices", vv) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["vpcofferingid"]; found { u.Set("vpcofferingid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListVPCsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListVPCsParams) SetCidr(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidr"] = v return } func (p *ListVPCsParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *ListVPCsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListVPCsParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListVPCsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListVPCsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListVPCsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVPCsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListVPCsParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListVPCsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVPCsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListVPCsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListVPCsParams) SetRestartrequired(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["restartrequired"] = v return } func (p *ListVPCsParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListVPCsParams) SetSupportedservices(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["supportedservices"] = v return } func (p *ListVPCsParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListVPCsParams) SetVpcofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcofferingid"] = v return } func (p *ListVPCsParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListVPCsParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewListVPCsParams() *ListVPCsParams { p := &ListVPCsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPCService) GetVPCID(name string, opts ...OptionFunc) (string, int, error) { p := &ListVPCsParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListVPCs(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.VPCs[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.VPCs { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPCService) GetVPCByName(name string, opts ...OptionFunc) (*VPC, int, error) { id, count, err := s.GetVPCID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetVPCByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPCService) GetVPCByID(id string, opts ...OptionFunc) (*VPC, int, error) { p := &ListVPCsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListVPCs(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.VPCs[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for VPC UUID: %s!", id) } // Lists VPCs func (s *VPCService) ListVPCs(p *ListVPCsParams) (*ListVPCsResponse, error) { resp, err := s.cs.newRequest("listVPCs", p.toURLValues()) if err != nil { return nil, err } var r ListVPCsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVPCsResponse struct { Count int `json:"count"` VPCs []*VPC `json:"vpc"` } type VPC struct { Account string `json:"account"` Cidr string `json:"cidr"` Created string `json:"created"` Displaytext string `json:"displaytext"` Distributedvpcrouter bool `json:"distributedvpcrouter"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Network []VPCNetwork `json:"network"` Networkdomain string `json:"networkdomain"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantvpcrouter bool `json:"redundantvpcrouter"` Regionlevelvpc bool `json:"regionlevelvpc"` Restartrequired bool `json:"restartrequired"` Service []VPCServiceInternal `json:"service"` State string `json:"state"` Tags []Tags `json:"tags"` Vpcofferingid string `json:"vpcofferingid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type VPCServiceInternal struct { Capability []VPCServiceInternalCapability `json:"capability"` Name string `json:"name"` Provider []VPCServiceInternalProvider `json:"provider"` } type VPCServiceInternalProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type VPCServiceInternalCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type VPCNetwork struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []VPCNetworkService `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type VPCNetworkService struct { Capability []VPCNetworkServiceCapability `json:"capability"` Name string `json:"name"` Provider []VPCNetworkServiceProvider `json:"provider"` } type VPCNetworkServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type VPCNetworkServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type RestartVPCParams struct { p map[string]interface{} } func (p *RestartVPCParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["cleanup"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("cleanup", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["makeredundant"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("makeredundant", vv) } return u } func (p *RestartVPCParams) SetCleanup(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cleanup"] = v return } func (p *RestartVPCParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *RestartVPCParams) SetMakeredundant(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["makeredundant"] = v return } // You should always use this function to get a new RestartVPCParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewRestartVPCParams(id string) *RestartVPCParams { p := &RestartVPCParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Restarts a VPC func (s *VPCService) RestartVPC(p *RestartVPCParams) (*RestartVPCResponse, error) { resp, err := s.cs.newRequest("restartVPC", p.toURLValues()) if err != nil { return nil, err } var r RestartVPCResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RestartVPCResponse struct { Account string `json:"account"` Cidr string `json:"cidr"` Created string `json:"created"` Displaytext string `json:"displaytext"` Distributedvpcrouter bool `json:"distributedvpcrouter"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Network []RestartVPCResponseNetwork `json:"network"` Networkdomain string `json:"networkdomain"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantvpcrouter bool `json:"redundantvpcrouter"` Regionlevelvpc bool `json:"regionlevelvpc"` Restartrequired bool `json:"restartrequired"` Service []RestartVPCResponseService `json:"service"` State string `json:"state"` Tags []Tags `json:"tags"` Vpcofferingid string `json:"vpcofferingid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type RestartVPCResponseService struct { Capability []RestartVPCResponseServiceCapability `json:"capability"` Name string `json:"name"` Provider []RestartVPCResponseServiceProvider `json:"provider"` } type RestartVPCResponseServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type RestartVPCResponseServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type RestartVPCResponseNetwork struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []RestartVPCResponseNetworkService `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type RestartVPCResponseNetworkService struct { Capability []RestartVPCResponseNetworkServiceCapability `json:"capability"` Name string `json:"name"` Provider []RestartVPCResponseNetworkServiceProvider `json:"provider"` } type RestartVPCResponseNetworkServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type RestartVPCResponseNetworkServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type UpdateVPCParams struct { p map[string]interface{} } func (p *UpdateVPCParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } return u } func (p *UpdateVPCParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateVPCParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *UpdateVPCParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateVPCParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateVPCParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } // You should always use this function to get a new UpdateVPCParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewUpdateVPCParams(id string) *UpdateVPCParams { p := &UpdateVPCParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a VPC func (s *VPCService) UpdateVPC(p *UpdateVPCParams) (*UpdateVPCResponse, error) { resp, err := s.cs.newRequest("updateVPC", p.toURLValues()) if err != nil { return nil, err } var r UpdateVPCResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateVPCResponse struct { Account string `json:"account"` Cidr string `json:"cidr"` Created string `json:"created"` Displaytext string `json:"displaytext"` Distributedvpcrouter bool `json:"distributedvpcrouter"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Network []UpdateVPCResponseNetwork `json:"network"` Networkdomain string `json:"networkdomain"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantvpcrouter bool `json:"redundantvpcrouter"` Regionlevelvpc bool `json:"regionlevelvpc"` Restartrequired bool `json:"restartrequired"` Service []UpdateVPCResponseService `json:"service"` State string `json:"state"` Tags []Tags `json:"tags"` Vpcofferingid string `json:"vpcofferingid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateVPCResponseService struct { Capability []UpdateVPCResponseServiceCapability `json:"capability"` Name string `json:"name"` Provider []UpdateVPCResponseServiceProvider `json:"provider"` } type UpdateVPCResponseServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type UpdateVPCResponseServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type UpdateVPCResponseNetwork struct { Account string `json:"account"` Aclid string `json:"aclid"` Acltype string `json:"acltype"` Broadcastdomaintype string `json:"broadcastdomaintype"` Broadcasturi string `json:"broadcasturi"` Canusefordeploy bool `json:"canusefordeploy"` Cidr string `json:"cidr"` Displaynetwork bool `json:"displaynetwork"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Externalid string `json:"externalid"` Gateway string `json:"gateway"` Id string `json:"id"` Ip6cidr string `json:"ip6cidr"` Ip6gateway string `json:"ip6gateway"` Isdefault bool `json:"isdefault"` Ispersistent bool `json:"ispersistent"` Issystem bool `json:"issystem"` Name string `json:"name"` Netmask string `json:"netmask"` Networkcidr string `json:"networkcidr"` Networkdomain string `json:"networkdomain"` Networkofferingavailability string `json:"networkofferingavailability"` Networkofferingconservemode bool `json:"networkofferingconservemode"` Networkofferingdisplaytext string `json:"networkofferingdisplaytext"` Networkofferingid string `json:"networkofferingid"` Networkofferingname string `json:"networkofferingname"` Physicalnetworkid string `json:"physicalnetworkid"` Project string `json:"project"` Projectid string `json:"projectid"` Redundantrouter bool `json:"redundantrouter"` Related string `json:"related"` Reservediprange string `json:"reservediprange"` Restartrequired bool `json:"restartrequired"` Service []UpdateVPCResponseNetworkService `json:"service"` Specifyipranges bool `json:"specifyipranges"` State string `json:"state"` Strechedl2subnet bool `json:"strechedl2subnet"` Subdomainaccess bool `json:"subdomainaccess"` Tags []Tags `json:"tags"` Traffictype string `json:"traffictype"` Type string `json:"type"` Vlan string `json:"vlan"` Vpcid string `json:"vpcid"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` Zonesnetworkspans []interface{} `json:"zonesnetworkspans"` } type UpdateVPCResponseNetworkService struct { Capability []UpdateVPCResponseNetworkServiceCapability `json:"capability"` Name string `json:"name"` Provider []UpdateVPCResponseNetworkServiceProvider `json:"provider"` } type UpdateVPCResponseNetworkServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type UpdateVPCResponseNetworkServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } type UpdateVPCOfferingParams struct { p map[string]interface{} } func (p *UpdateVPCOfferingParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["displaytext"]; found { u.Set("displaytext", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } return u } func (p *UpdateVPCOfferingParams) SetDisplaytext(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displaytext"] = v return } func (p *UpdateVPCOfferingParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateVPCOfferingParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateVPCOfferingParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } // You should always use this function to get a new UpdateVPCOfferingParams instance, // as then you are sure you have configured all required params func (s *VPCService) NewUpdateVPCOfferingParams(id string) *UpdateVPCOfferingParams { p := &UpdateVPCOfferingParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates VPC offering func (s *VPCService) UpdateVPCOffering(p *UpdateVPCOfferingParams) (*UpdateVPCOfferingResponse, error) { resp, err := s.cs.newRequest("updateVPCOffering", p.toURLValues()) if err != nil { return nil, err } var r UpdateVPCOfferingResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateVPCOfferingResponse struct { Created string `json:"created"` Displaytext string `json:"displaytext"` Distributedvpcrouter bool `json:"distributedvpcrouter"` Id string `json:"id"` Isdefault bool `json:"isdefault"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Service []UpdateVPCOfferingResponseService `json:"service"` State string `json:"state"` SupportsregionLevelvpc bool `json:"supportsregionLevelvpc"` } type UpdateVPCOfferingResponseService struct { Capability []UpdateVPCOfferingResponseServiceCapability `json:"capability"` Name string `json:"name"` Provider []UpdateVPCOfferingResponseServiceProvider `json:"provider"` } type UpdateVPCOfferingResponseServiceProvider struct { Canenableindividualservice bool `json:"canenableindividualservice"` Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"` Id string `json:"id"` Name string `json:"name"` Physicalnetworkid string `json:"physicalnetworkid"` Servicelist []string `json:"servicelist"` State string `json:"state"` } type UpdateVPCOfferingResponseServiceCapability struct { Canchooseservicecapability bool `json:"canchooseservicecapability"` Name string `json:"name"` Value string `json:"value"` } go-cloudstack-2.9.0/cloudstack/VPNService.go000066400000000000000000002122271364073403100207370ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AddVpnUserParams struct { p map[string]interface{} } func (p *AddVpnUserParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["password"]; found { u.Set("password", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *AddVpnUserParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *AddVpnUserParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *AddVpnUserParams) SetPassword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["password"] = v return } func (p *AddVpnUserParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *AddVpnUserParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new AddVpnUserParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewAddVpnUserParams(password string, username string) *AddVpnUserParams { p := &AddVpnUserParams{} p.p = make(map[string]interface{}) p.p["password"] = password p.p["username"] = username return p } // Adds vpn users func (s *VPNService) AddVpnUser(p *AddVpnUserParams) (*AddVpnUserResponse, error) { resp, err := s.cs.newRequest("addVpnUser", p.toURLValues()) if err != nil { return nil, err } var r AddVpnUserResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddVpnUserResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` State string `json:"state"` Username string `json:"username"` } type CreateRemoteAccessVpnParams struct { p map[string]interface{} } func (p *CreateRemoteAccessVpnParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["iprange"]; found { u.Set("iprange", v.(string)) } if v, found := p.p["openfirewall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("openfirewall", vv) } if v, found := p.p["publicipid"]; found { u.Set("publicipid", v.(string)) } return u } func (p *CreateRemoteAccessVpnParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateRemoteAccessVpnParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateRemoteAccessVpnParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateRemoteAccessVpnParams) SetIprange(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iprange"] = v return } func (p *CreateRemoteAccessVpnParams) SetOpenfirewall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["openfirewall"] = v return } func (p *CreateRemoteAccessVpnParams) SetPublicipid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publicipid"] = v return } // You should always use this function to get a new CreateRemoteAccessVpnParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewCreateRemoteAccessVpnParams(publicipid string) *CreateRemoteAccessVpnParams { p := &CreateRemoteAccessVpnParams{} p.p = make(map[string]interface{}) p.p["publicipid"] = publicipid return p } // Creates a l2tp/ipsec remote access vpn func (s *VPNService) CreateRemoteAccessVpn(p *CreateRemoteAccessVpnParams) (*CreateRemoteAccessVpnResponse, error) { resp, err := s.cs.newRequest("createRemoteAccessVpn", p.toURLValues()) if err != nil { return nil, err } var r CreateRemoteAccessVpnResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateRemoteAccessVpnResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Iprange string `json:"iprange"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Presharedkey string `json:"presharedkey"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` State string `json:"state"` } type CreateVpnConnectionParams struct { p map[string]interface{} } func (p *CreateVpnConnectionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["passive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("passive", vv) } if v, found := p.p["s2scustomergatewayid"]; found { u.Set("s2scustomergatewayid", v.(string)) } if v, found := p.p["s2svpngatewayid"]; found { u.Set("s2svpngatewayid", v.(string)) } return u } func (p *CreateVpnConnectionParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateVpnConnectionParams) SetPassive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["passive"] = v return } func (p *CreateVpnConnectionParams) SetS2scustomergatewayid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["s2scustomergatewayid"] = v return } func (p *CreateVpnConnectionParams) SetS2svpngatewayid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["s2svpngatewayid"] = v return } // You should always use this function to get a new CreateVpnConnectionParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewCreateVpnConnectionParams(s2scustomergatewayid string, s2svpngatewayid string) *CreateVpnConnectionParams { p := &CreateVpnConnectionParams{} p.p = make(map[string]interface{}) p.p["s2scustomergatewayid"] = s2scustomergatewayid p.p["s2svpngatewayid"] = s2svpngatewayid return p } // Create site to site vpn connection func (s *VPNService) CreateVpnConnection(p *CreateVpnConnectionParams) (*CreateVpnConnectionResponse, error) { resp, err := s.cs.newRequest("createVpnConnection", p.toURLValues()) if err != nil { return nil, err } var r CreateVpnConnectionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateVpnConnectionResponse struct { Account string `json:"account"` Cidrlist string `json:"cidrlist"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Dpd bool `json:"dpd"` Esplifetime int64 `json:"esplifetime"` Esppolicy string `json:"esppolicy"` Forceencap bool `json:"forceencap"` Fordisplay bool `json:"fordisplay"` Gateway string `json:"gateway"` Id string `json:"id"` Ikelifetime int64 `json:"ikelifetime"` Ikepolicy string `json:"ikepolicy"` Ipsecpsk string `json:"ipsecpsk"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Passive bool `json:"passive"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Removed string `json:"removed"` S2scustomergatewayid string `json:"s2scustomergatewayid"` S2svpngatewayid string `json:"s2svpngatewayid"` State string `json:"state"` } type CreateVpnCustomerGatewayParams struct { p map[string]interface{} } func (p *CreateVpnCustomerGatewayParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["cidrlist"]; found { u.Set("cidrlist", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["dpd"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("dpd", vv) } if v, found := p.p["esplifetime"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("esplifetime", vv) } if v, found := p.p["esppolicy"]; found { u.Set("esppolicy", v.(string)) } if v, found := p.p["forceencap"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forceencap", vv) } if v, found := p.p["gateway"]; found { u.Set("gateway", v.(string)) } if v, found := p.p["ikelifetime"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("ikelifetime", vv) } if v, found := p.p["ikepolicy"]; found { u.Set("ikepolicy", v.(string)) } if v, found := p.p["ipsecpsk"]; found { u.Set("ipsecpsk", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *CreateVpnCustomerGatewayParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateVpnCustomerGatewayParams) SetCidrlist(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *CreateVpnCustomerGatewayParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateVpnCustomerGatewayParams) SetDpd(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dpd"] = v return } func (p *CreateVpnCustomerGatewayParams) SetEsplifetime(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["esplifetime"] = v return } func (p *CreateVpnCustomerGatewayParams) SetEsppolicy(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["esppolicy"] = v return } func (p *CreateVpnCustomerGatewayParams) SetForceencap(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forceencap"] = v return } func (p *CreateVpnCustomerGatewayParams) SetGateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gateway"] = v return } func (p *CreateVpnCustomerGatewayParams) SetIkelifetime(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ikelifetime"] = v return } func (p *CreateVpnCustomerGatewayParams) SetIkepolicy(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ikepolicy"] = v return } func (p *CreateVpnCustomerGatewayParams) SetIpsecpsk(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipsecpsk"] = v return } func (p *CreateVpnCustomerGatewayParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateVpnCustomerGatewayParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new CreateVpnCustomerGatewayParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewCreateVpnCustomerGatewayParams(cidrlist string, esppolicy string, gateway string, ikepolicy string, ipsecpsk string) *CreateVpnCustomerGatewayParams { p := &CreateVpnCustomerGatewayParams{} p.p = make(map[string]interface{}) p.p["cidrlist"] = cidrlist p.p["esppolicy"] = esppolicy p.p["gateway"] = gateway p.p["ikepolicy"] = ikepolicy p.p["ipsecpsk"] = ipsecpsk return p } // Creates site to site vpn customer gateway func (s *VPNService) CreateVpnCustomerGateway(p *CreateVpnCustomerGatewayParams) (*CreateVpnCustomerGatewayResponse, error) { resp, err := s.cs.newRequest("createVpnCustomerGateway", p.toURLValues()) if err != nil { return nil, err } var r CreateVpnCustomerGatewayResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateVpnCustomerGatewayResponse struct { Account string `json:"account"` Cidrlist string `json:"cidrlist"` Domain string `json:"domain"` Domainid string `json:"domainid"` Dpd bool `json:"dpd"` Esplifetime int64 `json:"esplifetime"` Esppolicy string `json:"esppolicy"` Forceencap bool `json:"forceencap"` Gateway string `json:"gateway"` Id string `json:"id"` Ikelifetime int64 `json:"ikelifetime"` Ikepolicy string `json:"ikepolicy"` Ipaddress string `json:"ipaddress"` Ipsecpsk string `json:"ipsecpsk"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` } type CreateVpnGatewayParams struct { p map[string]interface{} } func (p *CreateVpnGatewayParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } return u } func (p *CreateVpnGatewayParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *CreateVpnGatewayParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } // You should always use this function to get a new CreateVpnGatewayParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewCreateVpnGatewayParams(vpcid string) *CreateVpnGatewayParams { p := &CreateVpnGatewayParams{} p.p = make(map[string]interface{}) p.p["vpcid"] = vpcid return p } // Creates site to site vpn local gateway func (s *VPNService) CreateVpnGateway(p *CreateVpnGatewayParams) (*CreateVpnGatewayResponse, error) { resp, err := s.cs.newRequest("createVpnGateway", p.toURLValues()) if err != nil { return nil, err } var r CreateVpnGatewayResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateVpnGatewayResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Removed string `json:"removed"` Vpcid string `json:"vpcid"` } type DeleteRemoteAccessVpnParams struct { p map[string]interface{} } func (p *DeleteRemoteAccessVpnParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["publicipid"]; found { u.Set("publicipid", v.(string)) } return u } func (p *DeleteRemoteAccessVpnParams) SetPublicipid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publicipid"] = v return } // You should always use this function to get a new DeleteRemoteAccessVpnParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewDeleteRemoteAccessVpnParams(publicipid string) *DeleteRemoteAccessVpnParams { p := &DeleteRemoteAccessVpnParams{} p.p = make(map[string]interface{}) p.p["publicipid"] = publicipid return p } // Destroys a l2tp/ipsec remote access vpn func (s *VPNService) DeleteRemoteAccessVpn(p *DeleteRemoteAccessVpnParams) (*DeleteRemoteAccessVpnResponse, error) { resp, err := s.cs.newRequest("deleteRemoteAccessVpn", p.toURLValues()) if err != nil { return nil, err } var r DeleteRemoteAccessVpnResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteRemoteAccessVpnResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteVpnConnectionParams struct { p map[string]interface{} } func (p *DeleteVpnConnectionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteVpnConnectionParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteVpnConnectionParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewDeleteVpnConnectionParams(id string) *DeleteVpnConnectionParams { p := &DeleteVpnConnectionParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Delete site to site vpn connection func (s *VPNService) DeleteVpnConnection(p *DeleteVpnConnectionParams) (*DeleteVpnConnectionResponse, error) { resp, err := s.cs.newRequest("deleteVpnConnection", p.toURLValues()) if err != nil { return nil, err } var r DeleteVpnConnectionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteVpnConnectionResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteVpnCustomerGatewayParams struct { p map[string]interface{} } func (p *DeleteVpnCustomerGatewayParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteVpnCustomerGatewayParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteVpnCustomerGatewayParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewDeleteVpnCustomerGatewayParams(id string) *DeleteVpnCustomerGatewayParams { p := &DeleteVpnCustomerGatewayParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Delete site to site vpn customer gateway func (s *VPNService) DeleteVpnCustomerGateway(p *DeleteVpnCustomerGatewayParams) (*DeleteVpnCustomerGatewayResponse, error) { resp, err := s.cs.newRequest("deleteVpnCustomerGateway", p.toURLValues()) if err != nil { return nil, err } var r DeleteVpnCustomerGatewayResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteVpnCustomerGatewayResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeleteVpnGatewayParams struct { p map[string]interface{} } func (p *DeleteVpnGatewayParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteVpnGatewayParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteVpnGatewayParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewDeleteVpnGatewayParams(id string) *DeleteVpnGatewayParams { p := &DeleteVpnGatewayParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Delete site to site vpn gateway func (s *VPNService) DeleteVpnGateway(p *DeleteVpnGatewayParams) (*DeleteVpnGatewayResponse, error) { resp, err := s.cs.newRequest("deleteVpnGateway", p.toURLValues()) if err != nil { return nil, err } var r DeleteVpnGatewayResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeleteVpnGatewayResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ListRemoteAccessVpnsParams struct { p map[string]interface{} } func (p *ListRemoteAccessVpnsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["publicipid"]; found { u.Set("publicipid", v.(string)) } return u } func (p *ListRemoteAccessVpnsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListRemoteAccessVpnsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListRemoteAccessVpnsParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListRemoteAccessVpnsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListRemoteAccessVpnsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListRemoteAccessVpnsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListRemoteAccessVpnsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListRemoteAccessVpnsParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListRemoteAccessVpnsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListRemoteAccessVpnsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListRemoteAccessVpnsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListRemoteAccessVpnsParams) SetPublicipid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["publicipid"] = v return } // You should always use this function to get a new ListRemoteAccessVpnsParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewListRemoteAccessVpnsParams() *ListRemoteAccessVpnsParams { p := &ListRemoteAccessVpnsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPNService) GetRemoteAccessVpnByID(id string, opts ...OptionFunc) (*RemoteAccessVpn, int, error) { p := &ListRemoteAccessVpnsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListRemoteAccessVpns(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.RemoteAccessVpns[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for RemoteAccessVpn UUID: %s!", id) } // Lists remote access vpns func (s *VPNService) ListRemoteAccessVpns(p *ListRemoteAccessVpnsParams) (*ListRemoteAccessVpnsResponse, error) { resp, err := s.cs.newRequest("listRemoteAccessVpns", p.toURLValues()) if err != nil { return nil, err } var r ListRemoteAccessVpnsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListRemoteAccessVpnsResponse struct { Count int `json:"count"` RemoteAccessVpns []*RemoteAccessVpn `json:"remoteaccessvpn"` } type RemoteAccessVpn struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Iprange string `json:"iprange"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Presharedkey string `json:"presharedkey"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` State string `json:"state"` } type ListVpnConnectionsParams struct { p map[string]interface{} } func (p *ListVpnConnectionsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } return u } func (p *ListVpnConnectionsParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListVpnConnectionsParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListVpnConnectionsParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListVpnConnectionsParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListVpnConnectionsParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListVpnConnectionsParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVpnConnectionsParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListVpnConnectionsParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVpnConnectionsParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListVpnConnectionsParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListVpnConnectionsParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } // You should always use this function to get a new ListVpnConnectionsParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewListVpnConnectionsParams() *ListVpnConnectionsParams { p := &ListVpnConnectionsParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPNService) GetVpnConnectionByID(id string, opts ...OptionFunc) (*VpnConnection, int, error) { p := &ListVpnConnectionsParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListVpnConnections(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.VpnConnections[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for VpnConnection UUID: %s!", id) } // Lists site to site vpn connection gateways func (s *VPNService) ListVpnConnections(p *ListVpnConnectionsParams) (*ListVpnConnectionsResponse, error) { resp, err := s.cs.newRequest("listVpnConnections", p.toURLValues()) if err != nil { return nil, err } var r ListVpnConnectionsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVpnConnectionsResponse struct { Count int `json:"count"` VpnConnections []*VpnConnection `json:"vpnconnection"` } type VpnConnection struct { Account string `json:"account"` Cidrlist string `json:"cidrlist"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Dpd bool `json:"dpd"` Esplifetime int64 `json:"esplifetime"` Esppolicy string `json:"esppolicy"` Forceencap bool `json:"forceencap"` Fordisplay bool `json:"fordisplay"` Gateway string `json:"gateway"` Id string `json:"id"` Ikelifetime int64 `json:"ikelifetime"` Ikepolicy string `json:"ikepolicy"` Ipsecpsk string `json:"ipsecpsk"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Passive bool `json:"passive"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Removed string `json:"removed"` S2scustomergatewayid string `json:"s2scustomergatewayid"` S2svpngatewayid string `json:"s2svpngatewayid"` State string `json:"state"` } type ListVpnCustomerGatewaysParams struct { p map[string]interface{} } func (p *ListVpnCustomerGatewaysParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } return u } func (p *ListVpnCustomerGatewaysParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListVpnCustomerGatewaysParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListVpnCustomerGatewaysParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListVpnCustomerGatewaysParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListVpnCustomerGatewaysParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVpnCustomerGatewaysParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListVpnCustomerGatewaysParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVpnCustomerGatewaysParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListVpnCustomerGatewaysParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } // You should always use this function to get a new ListVpnCustomerGatewaysParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewListVpnCustomerGatewaysParams() *ListVpnCustomerGatewaysParams { p := &ListVpnCustomerGatewaysParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPNService) GetVpnCustomerGatewayID(keyword string, opts ...OptionFunc) (string, int, error) { p := &ListVpnCustomerGatewaysParams{} p.p = make(map[string]interface{}) p.p["keyword"] = keyword for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListVpnCustomerGateways(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l) } if l.Count == 1 { return l.VpnCustomerGateways[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.VpnCustomerGateways { if v.Name == keyword { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPNService) GetVpnCustomerGatewayByName(name string, opts ...OptionFunc) (*VpnCustomerGateway, int, error) { id, count, err := s.GetVpnCustomerGatewayID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetVpnCustomerGatewayByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPNService) GetVpnCustomerGatewayByID(id string, opts ...OptionFunc) (*VpnCustomerGateway, int, error) { p := &ListVpnCustomerGatewaysParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListVpnCustomerGateways(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.VpnCustomerGateways[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for VpnCustomerGateway UUID: %s!", id) } // Lists site to site vpn customer gateways func (s *VPNService) ListVpnCustomerGateways(p *ListVpnCustomerGatewaysParams) (*ListVpnCustomerGatewaysResponse, error) { resp, err := s.cs.newRequest("listVpnCustomerGateways", p.toURLValues()) if err != nil { return nil, err } var r ListVpnCustomerGatewaysResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVpnCustomerGatewaysResponse struct { Count int `json:"count"` VpnCustomerGateways []*VpnCustomerGateway `json:"vpncustomergateway"` } type VpnCustomerGateway struct { Account string `json:"account"` Cidrlist string `json:"cidrlist"` Domain string `json:"domain"` Domainid string `json:"domainid"` Dpd bool `json:"dpd"` Esplifetime int64 `json:"esplifetime"` Esppolicy string `json:"esppolicy"` Forceencap bool `json:"forceencap"` Gateway string `json:"gateway"` Id string `json:"id"` Ikelifetime int64 `json:"ikelifetime"` Ikepolicy string `json:"ikepolicy"` Ipaddress string `json:"ipaddress"` Ipsecpsk string `json:"ipsecpsk"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` } type ListVpnGatewaysParams struct { p map[string]interface{} } func (p *ListVpnGatewaysParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } return u } func (p *ListVpnGatewaysParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListVpnGatewaysParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListVpnGatewaysParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *ListVpnGatewaysParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListVpnGatewaysParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListVpnGatewaysParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVpnGatewaysParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListVpnGatewaysParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVpnGatewaysParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListVpnGatewaysParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListVpnGatewaysParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } // You should always use this function to get a new ListVpnGatewaysParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewListVpnGatewaysParams() *ListVpnGatewaysParams { p := &ListVpnGatewaysParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPNService) GetVpnGatewayByID(id string, opts ...OptionFunc) (*VpnGateway, int, error) { p := &ListVpnGatewaysParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListVpnGateways(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.VpnGateways[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for VpnGateway UUID: %s!", id) } // Lists site 2 site vpn gateways func (s *VPNService) ListVpnGateways(p *ListVpnGatewaysParams) (*ListVpnGatewaysResponse, error) { resp, err := s.cs.newRequest("listVpnGateways", p.toURLValues()) if err != nil { return nil, err } var r ListVpnGatewaysResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVpnGatewaysResponse struct { Count int `json:"count"` VpnGateways []*VpnGateway `json:"vpngateway"` } type VpnGateway struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Removed string `json:"removed"` Vpcid string `json:"vpcid"` } type ListVpnUsersParams struct { p map[string]interface{} } func (p *ListVpnUsersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *ListVpnUsersParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListVpnUsersParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListVpnUsersParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListVpnUsersParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListVpnUsersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVpnUsersParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListVpnUsersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVpnUsersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListVpnUsersParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListVpnUsersParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new ListVpnUsersParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewListVpnUsersParams() *ListVpnUsersParams { p := &ListVpnUsersParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VPNService) GetVpnUserByID(id string, opts ...OptionFunc) (*VpnUser, int, error) { p := &ListVpnUsersParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListVpnUsers(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.VpnUsers[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for VpnUser UUID: %s!", id) } // Lists vpn users func (s *VPNService) ListVpnUsers(p *ListVpnUsersParams) (*ListVpnUsersResponse, error) { resp, err := s.cs.newRequest("listVpnUsers", p.toURLValues()) if err != nil { return nil, err } var r ListVpnUsersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVpnUsersResponse struct { Count int `json:"count"` VpnUsers []*VpnUser `json:"vpnuser"` } type VpnUser struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` State string `json:"state"` Username string `json:"username"` } type RemoveVpnUserParams struct { p map[string]interface{} } func (p *RemoveVpnUserParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["username"]; found { u.Set("username", v.(string)) } return u } func (p *RemoveVpnUserParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *RemoveVpnUserParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *RemoveVpnUserParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *RemoveVpnUserParams) SetUsername(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["username"] = v return } // You should always use this function to get a new RemoveVpnUserParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewRemoveVpnUserParams(username string) *RemoveVpnUserParams { p := &RemoveVpnUserParams{} p.p = make(map[string]interface{}) p.p["username"] = username return p } // Removes vpn user func (s *VPNService) RemoveVpnUser(p *RemoveVpnUserParams) (*RemoveVpnUserResponse, error) { resp, err := s.cs.newRequest("removeVpnUser", p.toURLValues()) if err != nil { return nil, err } var r RemoveVpnUserResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RemoveVpnUserResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type ResetVpnConnectionParams struct { p map[string]interface{} } func (p *ResetVpnConnectionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ResetVpnConnectionParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ResetVpnConnectionParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ResetVpnConnectionParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ResetVpnConnectionParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewResetVpnConnectionParams(id string) *ResetVpnConnectionParams { p := &ResetVpnConnectionParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Reset site to site vpn connection func (s *VPNService) ResetVpnConnection(p *ResetVpnConnectionParams) (*ResetVpnConnectionResponse, error) { resp, err := s.cs.newRequest("resetVpnConnection", p.toURLValues()) if err != nil { return nil, err } var r ResetVpnConnectionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ResetVpnConnectionResponse struct { Account string `json:"account"` Cidrlist string `json:"cidrlist"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Dpd bool `json:"dpd"` Esplifetime int64 `json:"esplifetime"` Esppolicy string `json:"esppolicy"` Forceencap bool `json:"forceencap"` Fordisplay bool `json:"fordisplay"` Gateway string `json:"gateway"` Id string `json:"id"` Ikelifetime int64 `json:"ikelifetime"` Ikepolicy string `json:"ikepolicy"` Ipsecpsk string `json:"ipsecpsk"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Passive bool `json:"passive"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Removed string `json:"removed"` S2scustomergatewayid string `json:"s2scustomergatewayid"` S2svpngatewayid string `json:"s2svpngatewayid"` State string `json:"state"` } type UpdateRemoteAccessVpnParams struct { p map[string]interface{} } func (p *UpdateRemoteAccessVpnParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateRemoteAccessVpnParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateRemoteAccessVpnParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateRemoteAccessVpnParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateRemoteAccessVpnParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewUpdateRemoteAccessVpnParams(id string) *UpdateRemoteAccessVpnParams { p := &UpdateRemoteAccessVpnParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates remote access vpn func (s *VPNService) UpdateRemoteAccessVpn(p *UpdateRemoteAccessVpnParams) (*UpdateRemoteAccessVpnResponse, error) { resp, err := s.cs.newRequest("updateRemoteAccessVpn", p.toURLValues()) if err != nil { return nil, err } var r UpdateRemoteAccessVpnResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateRemoteAccessVpnResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` Iprange string `json:"iprange"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Presharedkey string `json:"presharedkey"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` State string `json:"state"` } type UpdateVpnConnectionParams struct { p map[string]interface{} } func (p *UpdateVpnConnectionParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateVpnConnectionParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateVpnConnectionParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateVpnConnectionParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateVpnConnectionParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewUpdateVpnConnectionParams(id string) *UpdateVpnConnectionParams { p := &UpdateVpnConnectionParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates site to site vpn connection func (s *VPNService) UpdateVpnConnection(p *UpdateVpnConnectionParams) (*UpdateVpnConnectionResponse, error) { resp, err := s.cs.newRequest("updateVpnConnection", p.toURLValues()) if err != nil { return nil, err } var r UpdateVpnConnectionResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateVpnConnectionResponse struct { Account string `json:"account"` Cidrlist string `json:"cidrlist"` Created string `json:"created"` Domain string `json:"domain"` Domainid string `json:"domainid"` Dpd bool `json:"dpd"` Esplifetime int64 `json:"esplifetime"` Esppolicy string `json:"esppolicy"` Forceencap bool `json:"forceencap"` Fordisplay bool `json:"fordisplay"` Gateway string `json:"gateway"` Id string `json:"id"` Ikelifetime int64 `json:"ikelifetime"` Ikepolicy string `json:"ikepolicy"` Ipsecpsk string `json:"ipsecpsk"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Passive bool `json:"passive"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Removed string `json:"removed"` S2scustomergatewayid string `json:"s2scustomergatewayid"` S2svpngatewayid string `json:"s2svpngatewayid"` State string `json:"state"` } type UpdateVpnCustomerGatewayParams struct { p map[string]interface{} } func (p *UpdateVpnCustomerGatewayParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["cidrlist"]; found { u.Set("cidrlist", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["dpd"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("dpd", vv) } if v, found := p.p["esplifetime"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("esplifetime", vv) } if v, found := p.p["esppolicy"]; found { u.Set("esppolicy", v.(string)) } if v, found := p.p["forceencap"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forceencap", vv) } if v, found := p.p["gateway"]; found { u.Set("gateway", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ikelifetime"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("ikelifetime", vv) } if v, found := p.p["ikepolicy"]; found { u.Set("ikepolicy", v.(string)) } if v, found := p.p["ipsecpsk"]; found { u.Set("ipsecpsk", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } return u } func (p *UpdateVpnCustomerGatewayParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetCidrlist(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cidrlist"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetDpd(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dpd"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetEsplifetime(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["esplifetime"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetEsppolicy(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["esppolicy"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetForceencap(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forceencap"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetGateway(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["gateway"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetIkelifetime(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ikelifetime"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetIkepolicy(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ikepolicy"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetIpsecpsk(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipsecpsk"] = v return } func (p *UpdateVpnCustomerGatewayParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } // You should always use this function to get a new UpdateVpnCustomerGatewayParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewUpdateVpnCustomerGatewayParams(cidrlist string, esppolicy string, gateway string, id string, ikepolicy string, ipsecpsk string) *UpdateVpnCustomerGatewayParams { p := &UpdateVpnCustomerGatewayParams{} p.p = make(map[string]interface{}) p.p["cidrlist"] = cidrlist p.p["esppolicy"] = esppolicy p.p["gateway"] = gateway p.p["id"] = id p.p["ikepolicy"] = ikepolicy p.p["ipsecpsk"] = ipsecpsk return p } // Update site to site vpn customer gateway func (s *VPNService) UpdateVpnCustomerGateway(p *UpdateVpnCustomerGatewayParams) (*UpdateVpnCustomerGatewayResponse, error) { resp, err := s.cs.newRequest("updateVpnCustomerGateway", p.toURLValues()) if err != nil { return nil, err } var r UpdateVpnCustomerGatewayResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateVpnCustomerGatewayResponse struct { Account string `json:"account"` Cidrlist string `json:"cidrlist"` Domain string `json:"domain"` Domainid string `json:"domainid"` Dpd bool `json:"dpd"` Esplifetime int64 `json:"esplifetime"` Esppolicy string `json:"esppolicy"` Forceencap bool `json:"forceencap"` Gateway string `json:"gateway"` Id string `json:"id"` Ikelifetime int64 `json:"ikelifetime"` Ikepolicy string `json:"ikepolicy"` Ipaddress string `json:"ipaddress"` Ipsecpsk string `json:"ipsecpsk"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Removed string `json:"removed"` } type UpdateVpnGatewayParams struct { p map[string]interface{} } func (p *UpdateVpnGatewayParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["fordisplay"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("fordisplay", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *UpdateVpnGatewayParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateVpnGatewayParams) SetFordisplay(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["fordisplay"] = v return } func (p *UpdateVpnGatewayParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new UpdateVpnGatewayParams instance, // as then you are sure you have configured all required params func (s *VPNService) NewUpdateVpnGatewayParams(id string) *UpdateVpnGatewayParams { p := &UpdateVpnGatewayParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates site to site vpn local gateway func (s *VPNService) UpdateVpnGateway(p *UpdateVpnGatewayParams) (*UpdateVpnGatewayResponse, error) { resp, err := s.cs.newRequest("updateVpnGateway", p.toURLValues()) if err != nil { return nil, err } var r UpdateVpnGatewayResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateVpnGatewayResponse struct { Account string `json:"account"` Domain string `json:"domain"` Domainid string `json:"domainid"` Fordisplay bool `json:"fordisplay"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Removed string `json:"removed"` Vpcid string `json:"vpcid"` } go-cloudstack-2.9.0/cloudstack/VirtualMachineService.go000066400000000000000000006316171364073403100232170ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AddNicToVirtualMachineParams struct { p map[string]interface{} } func (p *AddNicToVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["dhcpoptions"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("dhcpoptions[%d].key", i), k) u.Set(fmt.Sprintf("dhcpoptions[%d].value", i), m[k]) } } if v, found := p.p["ipaddress"]; found { u.Set("ipaddress", v.(string)) } if v, found := p.p["macaddress"]; found { u.Set("macaddress", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *AddNicToVirtualMachineParams) SetDhcpoptions(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dhcpoptions"] = v return } func (p *AddNicToVirtualMachineParams) SetIpaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddress"] = v return } func (p *AddNicToVirtualMachineParams) SetMacaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["macaddress"] = v return } func (p *AddNicToVirtualMachineParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *AddNicToVirtualMachineParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new AddNicToVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewAddNicToVirtualMachineParams(networkid string, virtualmachineid string) *AddNicToVirtualMachineParams { p := &AddNicToVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["networkid"] = networkid p.p["virtualmachineid"] = virtualmachineid return p } // Adds VM to specified network by creating a NIC func (s *VirtualMachineService) AddNicToVirtualMachine(p *AddNicToVirtualMachineParams) (*AddNicToVirtualMachineResponse, error) { resp, err := s.cs.newRequest("addNicToVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r AddNicToVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AddNicToVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []AddNicToVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []AddNicToVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type AddNicToVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []AddNicToVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []AddNicToVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type AddNicToVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type AddNicToVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *AddNicToVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias AddNicToVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type AssignVirtualMachineParams struct { p map[string]interface{} } func (p *AssignVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["networkids"]; found { vv := strings.Join(v.([]string), ",") u.Set("networkids", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["securitygroupids"]; found { vv := strings.Join(v.([]string), ",") u.Set("securitygroupids", vv) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *AssignVirtualMachineParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *AssignVirtualMachineParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *AssignVirtualMachineParams) SetNetworkids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkids"] = v return } func (p *AssignVirtualMachineParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *AssignVirtualMachineParams) SetSecuritygroupids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupids"] = v return } func (p *AssignVirtualMachineParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new AssignVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewAssignVirtualMachineParams(virtualmachineid string) *AssignVirtualMachineParams { p := &AssignVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["virtualmachineid"] = virtualmachineid return p } // Change ownership of a VM from one account to another. This API is available for Basic zones with security groups and Advanced zones with guest networks. A root administrator can reassign a VM from any account to any other account in any domain. A domain administrator can reassign a VM to any account in the same domain. func (s *VirtualMachineService) AssignVirtualMachine(p *AssignVirtualMachineParams) (*AssignVirtualMachineResponse, error) { resp, err := s.cs.newRequest("assignVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r AssignVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type AssignVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []AssignVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []AssignVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type AssignVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []AssignVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []AssignVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type AssignVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type AssignVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *AssignVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias AssignVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type ChangeServiceForVirtualMachineParams struct { p map[string]interface{} } func (p *ChangeServiceForVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } return u } func (p *ChangeServiceForVirtualMachineParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *ChangeServiceForVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ChangeServiceForVirtualMachineParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } // You should always use this function to get a new ChangeServiceForVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewChangeServiceForVirtualMachineParams(id string, serviceofferingid string) *ChangeServiceForVirtualMachineParams { p := &ChangeServiceForVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["serviceofferingid"] = serviceofferingid return p } // Changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" state for this command to take effect. func (s *VirtualMachineService) ChangeServiceForVirtualMachine(p *ChangeServiceForVirtualMachineParams) (*ChangeServiceForVirtualMachineResponse, error) { resp, err := s.cs.newRequest("changeServiceForVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r ChangeServiceForVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ChangeServiceForVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []ChangeServiceForVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []ChangeServiceForVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ChangeServiceForVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []ChangeServiceForVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []ChangeServiceForVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type ChangeServiceForVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type ChangeServiceForVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *ChangeServiceForVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias ChangeServiceForVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type CleanVMReservationsParams struct { p map[string]interface{} } func (p *CleanVMReservationsParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } return u } // You should always use this function to get a new CleanVMReservationsParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewCleanVMReservationsParams() *CleanVMReservationsParams { p := &CleanVMReservationsParams{} p.p = make(map[string]interface{}) return p } // Cleanups VM reservations in the database. func (s *VirtualMachineService) CleanVMReservations(p *CleanVMReservationsParams) (*CleanVMReservationsResponse, error) { resp, err := s.cs.newRequest("cleanVMReservations", p.toURLValues()) if err != nil { return nil, err } var r CleanVMReservationsResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CleanVMReservationsResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type DeployVirtualMachineParams struct { p map[string]interface{} } func (p *DeployVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["affinitygroupids"]; found { vv := strings.Join(v.([]string), ",") u.Set("affinitygroupids", vv) } if v, found := p.p["affinitygroupnames"]; found { vv := strings.Join(v.([]string), ",") u.Set("affinitygroupnames", vv) } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["datadiskofferinglist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("datadiskofferinglist[%d].key", i), k) u.Set(fmt.Sprintf("datadiskofferinglist[%d].value", i), m[k]) } } if v, found := p.p["deploymentplanner"]; found { u.Set("deploymentplanner", v.(string)) } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["dhcpoptionsnetworklist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("dhcpoptionsnetworklist[%d].key", i), k) u.Set(fmt.Sprintf("dhcpoptionsnetworklist[%d].value", i), m[k]) } } if v, found := p.p["diskofferingid"]; found { u.Set("diskofferingid", v.(string)) } if v, found := p.p["displayname"]; found { u.Set("displayname", v.(string)) } if v, found := p.p["displayvm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displayvm", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["extraconfig"]; found { u.Set("extraconfig", v.(string)) } if v, found := p.p["group"]; found { u.Set("group", v.(string)) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["ip6address"]; found { u.Set("ip6address", v.(string)) } if v, found := p.p["ipaddress"]; found { u.Set("ipaddress", v.(string)) } if v, found := p.p["iptonetworklist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("iptonetworklist[%d].key", i), k) u.Set(fmt.Sprintf("iptonetworklist[%d].value", i), m[k]) } } if v, found := p.p["keyboard"]; found { u.Set("keyboard", v.(string)) } if v, found := p.p["keypair"]; found { u.Set("keypair", v.(string)) } if v, found := p.p["macaddress"]; found { u.Set("macaddress", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkids"]; found { vv := strings.Join(v.([]string), ",") u.Set("networkids", vv) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["rootdisksize"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("rootdisksize", vv) } if v, found := p.p["securitygroupids"]; found { vv := strings.Join(v.([]string), ",") u.Set("securitygroupids", vv) } if v, found := p.p["securitygroupnames"]; found { vv := strings.Join(v.([]string), ",") u.Set("securitygroupnames", vv) } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } if v, found := p.p["size"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("size", vv) } if v, found := p.p["startvm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("startvm", vv) } if v, found := p.p["templateid"]; found { u.Set("templateid", v.(string)) } if v, found := p.p["userdata"]; found { u.Set("userdata", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *DeployVirtualMachineParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DeployVirtualMachineParams) SetAffinitygroupids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["affinitygroupids"] = v return } func (p *DeployVirtualMachineParams) SetAffinitygroupnames(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["affinitygroupnames"] = v return } func (p *DeployVirtualMachineParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *DeployVirtualMachineParams) SetDatadiskofferinglist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["datadiskofferinglist"] = v return } func (p *DeployVirtualMachineParams) SetDeploymentplanner(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["deploymentplanner"] = v return } func (p *DeployVirtualMachineParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *DeployVirtualMachineParams) SetDhcpoptionsnetworklist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dhcpoptionsnetworklist"] = v return } func (p *DeployVirtualMachineParams) SetDiskofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["diskofferingid"] = v return } func (p *DeployVirtualMachineParams) SetDisplayname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displayname"] = v return } func (p *DeployVirtualMachineParams) SetDisplayvm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displayvm"] = v return } func (p *DeployVirtualMachineParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DeployVirtualMachineParams) SetExtraconfig(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["extraconfig"] = v return } func (p *DeployVirtualMachineParams) SetGroup(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["group"] = v return } func (p *DeployVirtualMachineParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *DeployVirtualMachineParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *DeployVirtualMachineParams) SetIp6address(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ip6address"] = v return } func (p *DeployVirtualMachineParams) SetIpaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ipaddress"] = v return } func (p *DeployVirtualMachineParams) SetIptonetworklist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["iptonetworklist"] = v return } func (p *DeployVirtualMachineParams) SetKeyboard(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyboard"] = v return } func (p *DeployVirtualMachineParams) SetKeypair(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keypair"] = v return } func (p *DeployVirtualMachineParams) SetMacaddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["macaddress"] = v return } func (p *DeployVirtualMachineParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *DeployVirtualMachineParams) SetNetworkids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkids"] = v return } func (p *DeployVirtualMachineParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *DeployVirtualMachineParams) SetRootdisksize(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["rootdisksize"] = v return } func (p *DeployVirtualMachineParams) SetSecuritygroupids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupids"] = v return } func (p *DeployVirtualMachineParams) SetSecuritygroupnames(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupnames"] = v return } func (p *DeployVirtualMachineParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } func (p *DeployVirtualMachineParams) SetSize(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["size"] = v return } func (p *DeployVirtualMachineParams) SetStartvm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["startvm"] = v return } func (p *DeployVirtualMachineParams) SetTemplateid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templateid"] = v return } func (p *DeployVirtualMachineParams) SetUserdata(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["userdata"] = v return } func (p *DeployVirtualMachineParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new DeployVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewDeployVirtualMachineParams(serviceofferingid string, templateid string, zoneid string) *DeployVirtualMachineParams { p := &DeployVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["serviceofferingid"] = serviceofferingid p.p["templateid"] = templateid p.p["zoneid"] = zoneid return p } // Creates and automatically starts a virtual machine based on a service offering, disk offering, and template. func (s *VirtualMachineService) DeployVirtualMachine(p *DeployVirtualMachineParams) (*DeployVirtualMachineResponse, error) { resp, err := s.cs.newRequest("deployVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r DeployVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DeployVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []DeployVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []DeployVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DeployVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []DeployVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []DeployVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type DeployVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type DeployVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *DeployVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeployVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type DestroyVirtualMachineParams struct { p map[string]interface{} } func (p *DestroyVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["expunge"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("expunge", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["volumeids"]; found { vv := strings.Join(v.([]string), ",") u.Set("volumeids", vv) } return u } func (p *DestroyVirtualMachineParams) SetExpunge(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["expunge"] = v return } func (p *DestroyVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *DestroyVirtualMachineParams) SetVolumeids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["volumeids"] = v return } // You should always use this function to get a new DestroyVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewDestroyVirtualMachineParams(id string) *DestroyVirtualMachineParams { p := &DestroyVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Destroys a virtual machine. func (s *VirtualMachineService) DestroyVirtualMachine(p *DestroyVirtualMachineParams) (*DestroyVirtualMachineResponse, error) { resp, err := s.cs.newRequest("destroyVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r DestroyVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DestroyVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []DestroyVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []DestroyVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DestroyVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []DestroyVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []DestroyVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type DestroyVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type DestroyVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *DestroyVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DestroyVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type ExpungeVirtualMachineParams struct { p map[string]interface{} } func (p *ExpungeVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ExpungeVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ExpungeVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewExpungeVirtualMachineParams(id string) *ExpungeVirtualMachineParams { p := &ExpungeVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Expunge a virtual machine. Once expunged, it cannot be recoverd. func (s *VirtualMachineService) ExpungeVirtualMachine(p *ExpungeVirtualMachineParams) (*ExpungeVirtualMachineResponse, error) { resp, err := s.cs.newRequest("expungeVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r ExpungeVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ExpungeVirtualMachineResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type GetVMPasswordParams struct { p map[string]interface{} } func (p *GetVMPasswordParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *GetVMPasswordParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new GetVMPasswordParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewGetVMPasswordParams(id string) *GetVMPasswordParams { p := &GetVMPasswordParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Returns an encrypted password for the VM func (s *VirtualMachineService) GetVMPassword(p *GetVMPasswordParams) (*GetVMPasswordResponse, error) { resp, err := s.cs.newRequest("getVMPassword", p.toURLValues()) if err != nil { return nil, err } var r GetVMPasswordResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetVMPasswordResponse struct { Encryptedpassword string `json:"encryptedpassword"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` } type ListVirtualMachinesParams struct { p map[string]interface{} } func (p *ListVirtualMachinesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["affinitygroupid"]; found { u.Set("affinitygroupid", v.(string)) } if v, found := p.p["details"]; found { vv := strings.Join(v.([]string), ",") u.Set("details", vv) } if v, found := p.p["displayvm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displayvm", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["forvirtualnetwork"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forvirtualnetwork", vv) } if v, found := p.p["groupid"]; found { u.Set("groupid", v.(string)) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["hypervisor"]; found { u.Set("hypervisor", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ids"]; found { vv := strings.Join(v.([]string), ",") u.Set("ids", vv) } if v, found := p.p["isoid"]; found { u.Set("isoid", v.(string)) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keypair"]; found { u.Set("keypair", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networkid"]; found { u.Set("networkid", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["storageid"]; found { u.Set("storageid", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["templateid"]; found { u.Set("templateid", v.(string)) } if v, found := p.p["userid"]; found { u.Set("userid", v.(string)) } if v, found := p.p["vpcid"]; found { u.Set("vpcid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListVirtualMachinesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListVirtualMachinesParams) SetAffinitygroupid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["affinitygroupid"] = v return } func (p *ListVirtualMachinesParams) SetDetails(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *ListVirtualMachinesParams) SetDisplayvm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displayvm"] = v return } func (p *ListVirtualMachinesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListVirtualMachinesParams) SetForvirtualnetwork(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forvirtualnetwork"] = v return } func (p *ListVirtualMachinesParams) SetGroupid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["groupid"] = v return } func (p *ListVirtualMachinesParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *ListVirtualMachinesParams) SetHypervisor(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hypervisor"] = v return } func (p *ListVirtualMachinesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListVirtualMachinesParams) SetIds(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ids"] = v return } func (p *ListVirtualMachinesParams) SetIsoid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isoid"] = v return } func (p *ListVirtualMachinesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListVirtualMachinesParams) SetKeypair(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keypair"] = v return } func (p *ListVirtualMachinesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVirtualMachinesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListVirtualMachinesParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListVirtualMachinesParams) SetNetworkid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networkid"] = v return } func (p *ListVirtualMachinesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVirtualMachinesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListVirtualMachinesParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListVirtualMachinesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListVirtualMachinesParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } func (p *ListVirtualMachinesParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *ListVirtualMachinesParams) SetStorageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storageid"] = v return } func (p *ListVirtualMachinesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListVirtualMachinesParams) SetTemplateid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templateid"] = v return } func (p *ListVirtualMachinesParams) SetUserid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["userid"] = v return } func (p *ListVirtualMachinesParams) SetVpcid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["vpcid"] = v return } func (p *ListVirtualMachinesParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListVirtualMachinesParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewListVirtualMachinesParams() *ListVirtualMachinesParams { p := &ListVirtualMachinesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VirtualMachineService) GetVirtualMachineID(name string, opts ...OptionFunc) (string, int, error) { p := &ListVirtualMachinesParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListVirtualMachines(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.VirtualMachines[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.VirtualMachines { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VirtualMachineService) GetVirtualMachineByName(name string, opts ...OptionFunc) (*VirtualMachine, int, error) { id, count, err := s.GetVirtualMachineID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetVirtualMachineByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VirtualMachineService) GetVirtualMachineByID(id string, opts ...OptionFunc) (*VirtualMachine, int, error) { p := &ListVirtualMachinesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListVirtualMachines(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.VirtualMachines[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for VirtualMachine UUID: %s!", id) } // List the virtual machines owned by the account. func (s *VirtualMachineService) ListVirtualMachines(p *ListVirtualMachinesParams) (*ListVirtualMachinesResponse, error) { resp, err := s.cs.newRequest("listVirtualMachines", p.toURLValues()) if err != nil { return nil, err } var r ListVirtualMachinesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVirtualMachinesResponse struct { Count int `json:"count"` VirtualMachines []*VirtualMachine `json:"virtualmachine"` } type VirtualMachine struct { Account string `json:"account"` Affinitygroup []VirtualMachineAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []VirtualMachineSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type VirtualMachineSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []VirtualMachineSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []VirtualMachineSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type VirtualMachineSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type VirtualMachineAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *VirtualMachine) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias VirtualMachine return json.Unmarshal(b, (*alias)(r)) } type MigrateVirtualMachineParams struct { p map[string]interface{} } func (p *MigrateVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["storageid"]; found { u.Set("storageid", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *MigrateVirtualMachineParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *MigrateVirtualMachineParams) SetStorageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storageid"] = v return } func (p *MigrateVirtualMachineParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new MigrateVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewMigrateVirtualMachineParams(virtualmachineid string) *MigrateVirtualMachineParams { p := &MigrateVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["virtualmachineid"] = virtualmachineid return p } // Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool func (s *VirtualMachineService) MigrateVirtualMachine(p *MigrateVirtualMachineParams) (*MigrateVirtualMachineResponse, error) { resp, err := s.cs.newRequest("migrateVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r MigrateVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type MigrateVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []MigrateVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []MigrateVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type MigrateVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []MigrateVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []MigrateVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type MigrateVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type MigrateVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *MigrateVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias MigrateVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type MigrateVirtualMachineWithVolumeParams struct { p map[string]interface{} } func (p *MigrateVirtualMachineWithVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["migrateto"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("migrateto[%d].key", i), k) u.Set(fmt.Sprintf("migrateto[%d].value", i), m[k]) } } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *MigrateVirtualMachineWithVolumeParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *MigrateVirtualMachineWithVolumeParams) SetMigrateto(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["migrateto"] = v return } func (p *MigrateVirtualMachineWithVolumeParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new MigrateVirtualMachineWithVolumeParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewMigrateVirtualMachineWithVolumeParams(hostid string, virtualmachineid string) *MigrateVirtualMachineWithVolumeParams { p := &MigrateVirtualMachineWithVolumeParams{} p.p = make(map[string]interface{}) p.p["hostid"] = hostid p.p["virtualmachineid"] = virtualmachineid return p } // Attempts Migration of a VM with its volumes to a different host func (s *VirtualMachineService) MigrateVirtualMachineWithVolume(p *MigrateVirtualMachineWithVolumeParams) (*MigrateVirtualMachineWithVolumeResponse, error) { resp, err := s.cs.newRequest("migrateVirtualMachineWithVolume", p.toURLValues()) if err != nil { return nil, err } var r MigrateVirtualMachineWithVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type MigrateVirtualMachineWithVolumeResponse struct { Account string `json:"account"` Affinitygroup []MigrateVirtualMachineWithVolumeResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []MigrateVirtualMachineWithVolumeResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type MigrateVirtualMachineWithVolumeResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []MigrateVirtualMachineWithVolumeResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []MigrateVirtualMachineWithVolumeResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type MigrateVirtualMachineWithVolumeResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type MigrateVirtualMachineWithVolumeResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *MigrateVirtualMachineWithVolumeResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias MigrateVirtualMachineWithVolumeResponse return json.Unmarshal(b, (*alias)(r)) } type RebootVirtualMachineParams struct { p map[string]interface{} } func (p *RebootVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RebootVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RebootVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewRebootVirtualMachineParams(id string) *RebootVirtualMachineParams { p := &RebootVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Reboots a virtual machine. func (s *VirtualMachineService) RebootVirtualMachine(p *RebootVirtualMachineParams) (*RebootVirtualMachineResponse, error) { resp, err := s.cs.newRequest("rebootVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r RebootVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RebootVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []RebootVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []RebootVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type RebootVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []RebootVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []RebootVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type RebootVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type RebootVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *RebootVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias RebootVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type RecoverVirtualMachineParams struct { p map[string]interface{} } func (p *RecoverVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *RecoverVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new RecoverVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewRecoverVirtualMachineParams(id string) *RecoverVirtualMachineParams { p := &RecoverVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Recovers a virtual machine. func (s *VirtualMachineService) RecoverVirtualMachine(p *RecoverVirtualMachineParams) (*RecoverVirtualMachineResponse, error) { resp, err := s.cs.newRequest("recoverVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r RecoverVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type RecoverVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []RecoverVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []RecoverVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type RecoverVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []RecoverVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []RecoverVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type RecoverVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type RecoverVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *RecoverVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias RecoverVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type RemoveNicFromVirtualMachineParams struct { p map[string]interface{} } func (p *RemoveNicFromVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["nicid"]; found { u.Set("nicid", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *RemoveNicFromVirtualMachineParams) SetNicid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nicid"] = v return } func (p *RemoveNicFromVirtualMachineParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new RemoveNicFromVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewRemoveNicFromVirtualMachineParams(nicid string, virtualmachineid string) *RemoveNicFromVirtualMachineParams { p := &RemoveNicFromVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["nicid"] = nicid p.p["virtualmachineid"] = virtualmachineid return p } // Removes VM from specified network by deleting a NIC func (s *VirtualMachineService) RemoveNicFromVirtualMachine(p *RemoveNicFromVirtualMachineParams) (*RemoveNicFromVirtualMachineResponse, error) { resp, err := s.cs.newRequest("removeNicFromVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r RemoveNicFromVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RemoveNicFromVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []RemoveNicFromVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []RemoveNicFromVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type RemoveNicFromVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []RemoveNicFromVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []RemoveNicFromVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type RemoveNicFromVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type RemoveNicFromVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *RemoveNicFromVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias RemoveNicFromVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type ResetPasswordForVirtualMachineParams struct { p map[string]interface{} } func (p *ResetPasswordForVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *ResetPasswordForVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new ResetPasswordForVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewResetPasswordForVirtualMachineParams(id string) *ResetPasswordForVirtualMachineParams { p := &ResetPasswordForVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Resets the password for virtual machine. The virtual machine must be in a "Stopped" state and the template must already support this feature for this command to take effect. [async] func (s *VirtualMachineService) ResetPasswordForVirtualMachine(p *ResetPasswordForVirtualMachineParams) (*ResetPasswordForVirtualMachineResponse, error) { resp, err := s.cs.newRequest("resetPasswordForVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r ResetPasswordForVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ResetPasswordForVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []ResetPasswordForVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []ResetPasswordForVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ResetPasswordForVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []ResetPasswordForVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []ResetPasswordForVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type ResetPasswordForVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type ResetPasswordForVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *ResetPasswordForVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias ResetPasswordForVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type RestoreVirtualMachineParams struct { p map[string]interface{} } func (p *RestoreVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["templateid"]; found { u.Set("templateid", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *RestoreVirtualMachineParams) SetTemplateid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["templateid"] = v return } func (p *RestoreVirtualMachineParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new RestoreVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewRestoreVirtualMachineParams(virtualmachineid string) *RestoreVirtualMachineParams { p := &RestoreVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["virtualmachineid"] = virtualmachineid return p } // Restore a VM to original template/ISO or new template/ISO func (s *VirtualMachineService) RestoreVirtualMachine(p *RestoreVirtualMachineParams) (*RestoreVirtualMachineResponse, error) { resp, err := s.cs.newRequest("restoreVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r RestoreVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type RestoreVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []RestoreVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []RestoreVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type RestoreVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []RestoreVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []RestoreVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type RestoreVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type RestoreVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *RestoreVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias RestoreVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type ScaleVirtualMachineParams struct { p map[string]interface{} } func (p *ScaleVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["serviceofferingid"]; found { u.Set("serviceofferingid", v.(string)) } return u } func (p *ScaleVirtualMachineParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *ScaleVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ScaleVirtualMachineParams) SetServiceofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["serviceofferingid"] = v return } // You should always use this function to get a new ScaleVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewScaleVirtualMachineParams(id string, serviceofferingid string) *ScaleVirtualMachineParams { p := &ScaleVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["serviceofferingid"] = serviceofferingid return p } // Scales the virtual machine to a new service offering. func (s *VirtualMachineService) ScaleVirtualMachine(p *ScaleVirtualMachineParams) (*ScaleVirtualMachineResponse, error) { resp, err := s.cs.newRequest("scaleVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r ScaleVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ScaleVirtualMachineResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type StartVirtualMachineParams struct { p map[string]interface{} } func (p *StartVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["deploymentplanner"]; found { u.Set("deploymentplanner", v.(string)) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *StartVirtualMachineParams) SetDeploymentplanner(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["deploymentplanner"] = v return } func (p *StartVirtualMachineParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *StartVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new StartVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewStartVirtualMachineParams(id string) *StartVirtualMachineParams { p := &StartVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Starts a virtual machine. func (s *VirtualMachineService) StartVirtualMachine(p *StartVirtualMachineParams) (*StartVirtualMachineResponse, error) { resp, err := s.cs.newRequest("startVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r StartVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type StartVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []StartVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []StartVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type StartVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []StartVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []StartVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type StartVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type StartVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *StartVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias StartVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type StopVirtualMachineParams struct { p map[string]interface{} } func (p *StopVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["forced"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("forced", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *StopVirtualMachineParams) SetForced(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["forced"] = v return } func (p *StopVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new StopVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewStopVirtualMachineParams(id string) *StopVirtualMachineParams { p := &StopVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Stops a virtual machine. func (s *VirtualMachineService) StopVirtualMachine(p *StopVirtualMachineParams) (*StopVirtualMachineResponse, error) { resp, err := s.cs.newRequest("stopVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r StopVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type StopVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []StopVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []StopVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type StopVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []StopVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []StopVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type StopVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type StopVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *StopVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias StopVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type UpdateDefaultNicForVirtualMachineParams struct { p map[string]interface{} } func (p *UpdateDefaultNicForVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["nicid"]; found { u.Set("nicid", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *UpdateDefaultNicForVirtualMachineParams) SetNicid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["nicid"] = v return } func (p *UpdateDefaultNicForVirtualMachineParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new UpdateDefaultNicForVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewUpdateDefaultNicForVirtualMachineParams(nicid string, virtualmachineid string) *UpdateDefaultNicForVirtualMachineParams { p := &UpdateDefaultNicForVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["nicid"] = nicid p.p["virtualmachineid"] = virtualmachineid return p } // Changes the default NIC on a VM func (s *VirtualMachineService) UpdateDefaultNicForVirtualMachine(p *UpdateDefaultNicForVirtualMachineParams) (*UpdateDefaultNicForVirtualMachineResponse, error) { resp, err := s.cs.newRequest("updateDefaultNicForVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r UpdateDefaultNicForVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateDefaultNicForVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []UpdateDefaultNicForVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []UpdateDefaultNicForVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateDefaultNicForVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []UpdateDefaultNicForVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []UpdateDefaultNicForVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type UpdateDefaultNicForVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type UpdateDefaultNicForVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *UpdateDefaultNicForVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateDefaultNicForVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } type UpdateVirtualMachineParams struct { p map[string]interface{} } func (p *UpdateVirtualMachineParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["cleanupdetails"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("cleanupdetails", vv) } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].%s", i, k), m[k]) } } if v, found := p.p["dhcpoptionsnetworklist"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("dhcpoptionsnetworklist[%d].key", i), k) u.Set(fmt.Sprintf("dhcpoptionsnetworklist[%d].value", i), m[k]) } } if v, found := p.p["displayname"]; found { u.Set("displayname", v.(string)) } if v, found := p.p["displayvm"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displayvm", vv) } if v, found := p.p["extraconfig"]; found { u.Set("extraconfig", v.(string)) } if v, found := p.p["group"]; found { u.Set("group", v.(string)) } if v, found := p.p["haenable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("haenable", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["instancename"]; found { u.Set("instancename", v.(string)) } if v, found := p.p["isdynamicallyscalable"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isdynamicallyscalable", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["ostypeid"]; found { u.Set("ostypeid", v.(string)) } if v, found := p.p["securitygroupids"]; found { vv := strings.Join(v.([]string), ",") u.Set("securitygroupids", vv) } if v, found := p.p["securitygroupnames"]; found { vv := strings.Join(v.([]string), ",") u.Set("securitygroupnames", vv) } if v, found := p.p["userdata"]; found { u.Set("userdata", v.(string)) } return u } func (p *UpdateVirtualMachineParams) SetCleanupdetails(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["cleanupdetails"] = v return } func (p *UpdateVirtualMachineParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateVirtualMachineParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *UpdateVirtualMachineParams) SetDhcpoptionsnetworklist(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dhcpoptionsnetworklist"] = v return } func (p *UpdateVirtualMachineParams) SetDisplayname(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displayname"] = v return } func (p *UpdateVirtualMachineParams) SetDisplayvm(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displayvm"] = v return } func (p *UpdateVirtualMachineParams) SetExtraconfig(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["extraconfig"] = v return } func (p *UpdateVirtualMachineParams) SetGroup(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["group"] = v return } func (p *UpdateVirtualMachineParams) SetHaenable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["haenable"] = v return } func (p *UpdateVirtualMachineParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateVirtualMachineParams) SetInstancename(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["instancename"] = v return } func (p *UpdateVirtualMachineParams) SetIsdynamicallyscalable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isdynamicallyscalable"] = v return } func (p *UpdateVirtualMachineParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UpdateVirtualMachineParams) SetOstypeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ostypeid"] = v return } func (p *UpdateVirtualMachineParams) SetSecuritygroupids(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupids"] = v return } func (p *UpdateVirtualMachineParams) SetSecuritygroupnames(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupnames"] = v return } func (p *UpdateVirtualMachineParams) SetUserdata(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["userdata"] = v return } // You should always use this function to get a new UpdateVirtualMachineParams instance, // as then you are sure you have configured all required params func (s *VirtualMachineService) NewUpdateVirtualMachineParams(id string) *UpdateVirtualMachineParams { p := &UpdateVirtualMachineParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call. func (s *VirtualMachineService) UpdateVirtualMachine(p *UpdateVirtualMachineParams) (*UpdateVirtualMachineResponse, error) { resp, err := s.cs.newRequest("updateVirtualMachine", p.toURLValues()) if err != nil { return nil, err } var r UpdateVirtualMachineResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateVirtualMachineResponse struct { Account string `json:"account"` Affinitygroup []UpdateVirtualMachineResponseAffinitygroup `json:"affinitygroup"` Cpunumber int `json:"cpunumber"` Cpuspeed int `json:"cpuspeed"` Cpuused string `json:"cpuused"` Created string `json:"created"` Details map[string]string `json:"details"` Diskioread int64 `json:"diskioread"` Diskiowrite int64 `json:"diskiowrite"` Diskkbsread int64 `json:"diskkbsread"` Diskkbswrite int64 `json:"diskkbswrite"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayname string `json:"displayname"` Displayvm bool `json:"displayvm"` Domain string `json:"domain"` Domainid string `json:"domainid"` Forvirtualnetwork bool `json:"forvirtualnetwork"` Group string `json:"group"` Groupid string `json:"groupid"` Guestosid string `json:"guestosid"` Haenable bool `json:"haenable"` Hostid string `json:"hostid"` Hostname string `json:"hostname"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Instancename string `json:"instancename"` Isdynamicallyscalable bool `json:"isdynamicallyscalable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Keypair string `json:"keypair"` Memory int `json:"memory"` Memoryintfreekbs int64 `json:"memoryintfreekbs"` Memorykbs int64 `json:"memorykbs"` Memorytargetkbs int64 `json:"memorytargetkbs"` Name string `json:"name"` Networkkbsread int64 `json:"networkkbsread"` Networkkbswrite int64 `json:"networkkbswrite"` Nic []Nic `json:"nic"` Ostypeid string `json:"ostypeid"` Password string `json:"password"` Passwordenabled bool `json:"passwordenabled"` Project string `json:"project"` Projectid string `json:"projectid"` Publicip string `json:"publicip"` Publicipid string `json:"publicipid"` Rootdeviceid int64 `json:"rootdeviceid"` Rootdevicetype string `json:"rootdevicetype"` Securitygroup []UpdateVirtualMachineResponseSecuritygroup `json:"securitygroup"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Servicestate string `json:"servicestate"` State string `json:"state"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Userid string `json:"userid"` Username string `json:"username"` Vgpu string `json:"vgpu"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateVirtualMachineResponseSecuritygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Egressrule []UpdateVirtualMachineResponseSecuritygroupRule `json:"egressrule"` Id string `json:"id"` Ingressrule []UpdateVirtualMachineResponseSecuritygroupRule `json:"ingressrule"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Tags []Tags `json:"tags"` Virtualmachinecount int `json:"virtualmachinecount"` Virtualmachineids []interface{} `json:"virtualmachineids"` } type UpdateVirtualMachineResponseSecuritygroupRule struct { Account string `json:"account"` Cidr string `json:"cidr"` Endport int `json:"endport"` Icmpcode int `json:"icmpcode"` Icmptype int `json:"icmptype"` Protocol string `json:"protocol"` Ruleid string `json:"ruleid"` Securitygroupname string `json:"securitygroupname"` Startport int `json:"startport"` Tags []Tags `json:"tags"` } type UpdateVirtualMachineResponseAffinitygroup struct { Account string `json:"account"` Description string `json:"description"` Domain string `json:"domain"` Domainid string `json:"domainid"` Id string `json:"id"` Name string `json:"name"` Project string `json:"project"` Projectid string `json:"projectid"` Type string `json:"type"` VirtualmachineIds []string `json:"virtualmachineIds"` } func (r *UpdateVirtualMachineResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias UpdateVirtualMachineResponse return json.Unmarshal(b, (*alias)(r)) } go-cloudstack-2.9.0/cloudstack/VolumeService.go000066400000000000000000002022371364073403100215430ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type AttachVolumeParams struct { p map[string]interface{} } func (p *AttachVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["deviceid"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("deviceid", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *AttachVolumeParams) SetDeviceid(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["deviceid"] = v return } func (p *AttachVolumeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *AttachVolumeParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new AttachVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewAttachVolumeParams(id string, virtualmachineid string) *AttachVolumeParams { p := &AttachVolumeParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["virtualmachineid"] = virtualmachineid return p } // Attaches a disk volume to a virtual machine. func (s *VolumeService) AttachVolume(p *AttachVolumeParams) (*AttachVolumeResponse, error) { resp, err := s.cs.newRequest("attachVolume", p.toURLValues()) if err != nil { return nil, err } var r AttachVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type AttachVolumeResponse struct { Account string `json:"account"` Attached string `json:"attached"` Chaininfo string `json:"chaininfo"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Destroyed bool `json:"destroyed"` Deviceid int64 `json:"deviceid"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` Diskofferingdisplaytext string `json:"diskofferingdisplaytext"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayvolume bool `json:"displayvolume"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isextractable bool `json:"isextractable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Path string `json:"path"` Physicalsize int64 `json:"physicalsize"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Provisioningtype string `json:"provisioningtype"` Quiescevm bool `json:"quiescevm"` Serviceofferingdisplaytext string `json:"serviceofferingdisplaytext"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Size int64 `json:"size"` Snapshotid string `json:"snapshotid"` State string `json:"state"` Status string `json:"status"` Storage string `json:"storage"` Storageid string `json:"storageid"` Storagetype string `json:"storagetype"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Type string `json:"type"` Utilization string `json:"utilization"` Virtualmachineid string `json:"virtualmachineid"` Virtualsize int64 `json:"virtualsize"` Vmdisplayname string `json:"vmdisplayname"` Vmname string `json:"vmname"` Vmstate string `json:"vmstate"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type CreateVolumeParams struct { p map[string]interface{} } func (p *CreateVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["diskofferingid"]; found { u.Set("diskofferingid", v.(string)) } if v, found := p.p["displayvolume"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displayvolume", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["maxiops"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("maxiops", vv) } if v, found := p.p["miniops"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("miniops", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["size"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("size", vv) } if v, found := p.p["snapshotid"]; found { u.Set("snapshotid", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *CreateVolumeParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *CreateVolumeParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *CreateVolumeParams) SetDiskofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["diskofferingid"] = v return } func (p *CreateVolumeParams) SetDisplayvolume(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displayvolume"] = v return } func (p *CreateVolumeParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateVolumeParams) SetMaxiops(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxiops"] = v return } func (p *CreateVolumeParams) SetMiniops(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["miniops"] = v return } func (p *CreateVolumeParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateVolumeParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *CreateVolumeParams) SetSize(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["size"] = v return } func (p *CreateVolumeParams) SetSnapshotid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["snapshotid"] = v return } func (p *CreateVolumeParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } func (p *CreateVolumeParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new CreateVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewCreateVolumeParams() *CreateVolumeParams { p := &CreateVolumeParams{} p.p = make(map[string]interface{}) return p } // Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it. func (s *VolumeService) CreateVolume(p *CreateVolumeParams) (*CreateVolumeResponse, error) { resp, err := s.cs.newRequest("createVolume", p.toURLValues()) if err != nil { return nil, err } var r CreateVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CreateVolumeResponse struct { Account string `json:"account"` Attached string `json:"attached"` Chaininfo string `json:"chaininfo"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Destroyed bool `json:"destroyed"` Deviceid int64 `json:"deviceid"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` Diskofferingdisplaytext string `json:"diskofferingdisplaytext"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayvolume bool `json:"displayvolume"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isextractable bool `json:"isextractable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Path string `json:"path"` Physicalsize int64 `json:"physicalsize"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Provisioningtype string `json:"provisioningtype"` Quiescevm bool `json:"quiescevm"` Serviceofferingdisplaytext string `json:"serviceofferingdisplaytext"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Size int64 `json:"size"` Snapshotid string `json:"snapshotid"` State string `json:"state"` Status string `json:"status"` Storage string `json:"storage"` Storageid string `json:"storageid"` Storagetype string `json:"storagetype"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Type string `json:"type"` Utilization string `json:"utilization"` Virtualmachineid string `json:"virtualmachineid"` Virtualsize int64 `json:"virtualsize"` Vmdisplayname string `json:"vmdisplayname"` Vmname string `json:"vmname"` Vmstate string `json:"vmstate"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DeleteVolumeParams struct { p map[string]interface{} } func (p *DeleteVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteVolumeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewDeleteVolumeParams(id string) *DeleteVolumeParams { p := &DeleteVolumeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a detached disk volume. func (s *VolumeService) DeleteVolume(p *DeleteVolumeParams) (*DeleteVolumeResponse, error) { resp, err := s.cs.newRequest("deleteVolume", p.toURLValues()) if err != nil { return nil, err } var r DeleteVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteVolumeResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteVolumeResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteVolumeResponse return json.Unmarshal(b, (*alias)(r)) } type DetachVolumeParams struct { p map[string]interface{} } func (p *DetachVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["deviceid"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("deviceid", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } return u } func (p *DetachVolumeParams) SetDeviceid(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["deviceid"] = v return } func (p *DetachVolumeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *DetachVolumeParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } // You should always use this function to get a new DetachVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewDetachVolumeParams() *DetachVolumeParams { p := &DetachVolumeParams{} p.p = make(map[string]interface{}) return p } // Detaches a disk volume from a virtual machine. func (s *VolumeService) DetachVolume(p *DetachVolumeParams) (*DetachVolumeResponse, error) { resp, err := s.cs.newRequest("detachVolume", p.toURLValues()) if err != nil { return nil, err } var r DetachVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DetachVolumeResponse struct { Account string `json:"account"` Attached string `json:"attached"` Chaininfo string `json:"chaininfo"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Destroyed bool `json:"destroyed"` Deviceid int64 `json:"deviceid"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` Diskofferingdisplaytext string `json:"diskofferingdisplaytext"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayvolume bool `json:"displayvolume"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isextractable bool `json:"isextractable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Path string `json:"path"` Physicalsize int64 `json:"physicalsize"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Provisioningtype string `json:"provisioningtype"` Quiescevm bool `json:"quiescevm"` Serviceofferingdisplaytext string `json:"serviceofferingdisplaytext"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Size int64 `json:"size"` Snapshotid string `json:"snapshotid"` State string `json:"state"` Status string `json:"status"` Storage string `json:"storage"` Storageid string `json:"storageid"` Storagetype string `json:"storagetype"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Type string `json:"type"` Utilization string `json:"utilization"` Virtualmachineid string `json:"virtualmachineid"` Virtualsize int64 `json:"virtualsize"` Vmdisplayname string `json:"vmdisplayname"` Vmname string `json:"vmname"` Vmstate string `json:"vmstate"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ExtractVolumeParams struct { p map[string]interface{} } func (p *ExtractVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["mode"]; found { u.Set("mode", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ExtractVolumeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ExtractVolumeParams) SetMode(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["mode"] = v return } func (p *ExtractVolumeParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *ExtractVolumeParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ExtractVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewExtractVolumeParams(id string, mode string, zoneid string) *ExtractVolumeParams { p := &ExtractVolumeParams{} p.p = make(map[string]interface{}) p.p["id"] = id p.p["mode"] = mode p.p["zoneid"] = zoneid return p } // Extracts volume func (s *VolumeService) ExtractVolume(p *ExtractVolumeParams) (*ExtractVolumeResponse, error) { resp, err := s.cs.newRequest("extractVolume", p.toURLValues()) if err != nil { return nil, err } var r ExtractVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ExtractVolumeResponse struct { Accountid string `json:"accountid"` Created string `json:"created"` ExtractId string `json:"extractId"` ExtractMode string `json:"extractMode"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Name string `json:"name"` Resultstring string `json:"resultstring"` State string `json:"state"` Status string `json:"status"` Storagetype string `json:"storagetype"` Uploadpercentage int `json:"uploadpercentage"` Url string `json:"url"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type GetPathForVolumeParams struct { p map[string]interface{} } func (p *GetPathForVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["volumeid"]; found { u.Set("volumeid", v.(string)) } return u } func (p *GetPathForVolumeParams) SetVolumeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["volumeid"] = v return } // You should always use this function to get a new GetPathForVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewGetPathForVolumeParams(volumeid string) *GetPathForVolumeParams { p := &GetPathForVolumeParams{} p.p = make(map[string]interface{}) p.p["volumeid"] = volumeid return p } // Get the path associated with the provided volume UUID func (s *VolumeService) GetPathForVolume(p *GetPathForVolumeParams) (*GetPathForVolumeResponse, error) { resp, err := s.cs.newRequest("getPathForVolume", p.toURLValues()) if err != nil { return nil, err } var r GetPathForVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetPathForVolumeResponse struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Path string `json:"path"` } type GetSolidFireVolumeSizeParams struct { p map[string]interface{} } func (p *GetSolidFireVolumeSizeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["volumeid"]; found { u.Set("volumeid", v.(string)) } return u } func (p *GetSolidFireVolumeSizeParams) SetVolumeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["volumeid"] = v return } // You should always use this function to get a new GetSolidFireVolumeSizeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewGetSolidFireVolumeSizeParams(volumeid string) *GetSolidFireVolumeSizeParams { p := &GetSolidFireVolumeSizeParams{} p.p = make(map[string]interface{}) p.p["volumeid"] = volumeid return p } // Get the SF volume size including Hypervisor Snapshot Reserve func (s *VolumeService) GetSolidFireVolumeSize(p *GetSolidFireVolumeSizeParams) (*GetSolidFireVolumeSizeResponse, error) { resp, err := s.cs.newRequest("getSolidFireVolumeSize", p.toURLValues()) if err != nil { return nil, err } var r GetSolidFireVolumeSizeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetSolidFireVolumeSizeResponse struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` SolidFireVolumeSize int64 `json:"solidFireVolumeSize"` } type GetUploadParamsForVolumeParams struct { p map[string]interface{} } func (p *GetUploadParamsForVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["checksum"]; found { u.Set("checksum", v.(string)) } if v, found := p.p["diskofferingid"]; found { u.Set("diskofferingid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["format"]; found { u.Set("format", v.(string)) } if v, found := p.p["imagestoreuuid"]; found { u.Set("imagestoreuuid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *GetUploadParamsForVolumeParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *GetUploadParamsForVolumeParams) SetChecksum(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["checksum"] = v return } func (p *GetUploadParamsForVolumeParams) SetDiskofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["diskofferingid"] = v return } func (p *GetUploadParamsForVolumeParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *GetUploadParamsForVolumeParams) SetFormat(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["format"] = v return } func (p *GetUploadParamsForVolumeParams) SetImagestoreuuid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["imagestoreuuid"] = v return } func (p *GetUploadParamsForVolumeParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *GetUploadParamsForVolumeParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *GetUploadParamsForVolumeParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new GetUploadParamsForVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewGetUploadParamsForVolumeParams(format string, name string, zoneid string) *GetUploadParamsForVolumeParams { p := &GetUploadParamsForVolumeParams{} p.p = make(map[string]interface{}) p.p["format"] = format p.p["name"] = name p.p["zoneid"] = zoneid return p } // Upload a data disk to the cloudstack cloud. func (s *VolumeService) GetUploadParamsForVolume(p *GetUploadParamsForVolumeParams) (*GetUploadParamsForVolumeResponse, error) { resp, err := s.cs.newRequest("getUploadParamsForVolume", p.toURLValues()) if err != nil { return nil, err } var r GetUploadParamsForVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetUploadParamsForVolumeResponse struct { Expires string `json:"expires"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Metadata string `json:"metadata"` PostURL string `json:"postURL"` Signature string `json:"signature"` } type GetVolumeiScsiNameParams struct { p map[string]interface{} } func (p *GetVolumeiScsiNameParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["volumeid"]; found { u.Set("volumeid", v.(string)) } return u } func (p *GetVolumeiScsiNameParams) SetVolumeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["volumeid"] = v return } // You should always use this function to get a new GetVolumeiScsiNameParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewGetVolumeiScsiNameParams(volumeid string) *GetVolumeiScsiNameParams { p := &GetVolumeiScsiNameParams{} p.p = make(map[string]interface{}) p.p["volumeid"] = volumeid return p } // Get Volume's iSCSI Name func (s *VolumeService) GetVolumeiScsiName(p *GetVolumeiScsiNameParams) (*GetVolumeiScsiNameResponse, error) { resp, err := s.cs.newRequest("getVolumeiScsiName", p.toURLValues()) if err != nil { return nil, err } var r GetVolumeiScsiNameResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type GetVolumeiScsiNameResponse struct { JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` VolumeiScsiName string `json:"volumeiScsiName"` } type ListVolumesParams struct { p map[string]interface{} } func (p *ListVolumesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["clusterid"]; found { u.Set("clusterid", v.(string)) } if v, found := p.p["diskofferingid"]; found { u.Set("diskofferingid", v.(string)) } if v, found := p.p["displayvolume"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displayvolume", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["hostid"]; found { u.Set("hostid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["ids"]; found { vv := strings.Join(v.([]string), ",") u.Set("ids", vv) } if v, found := p.p["isrecursive"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("isrecursive", vv) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["listall"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("listall", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["podid"]; found { u.Set("podid", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["storageid"]; found { u.Set("storageid", v.(string)) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } if v, found := p.p["virtualmachineid"]; found { u.Set("virtualmachineid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListVolumesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListVolumesParams) SetClusterid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["clusterid"] = v return } func (p *ListVolumesParams) SetDiskofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["diskofferingid"] = v return } func (p *ListVolumesParams) SetDisplayvolume(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displayvolume"] = v return } func (p *ListVolumesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListVolumesParams) SetHostid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["hostid"] = v return } func (p *ListVolumesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListVolumesParams) SetIds(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ids"] = v return } func (p *ListVolumesParams) SetIsrecursive(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["isrecursive"] = v return } func (p *ListVolumesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListVolumesParams) SetListall(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["listall"] = v return } func (p *ListVolumesParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListVolumesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListVolumesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListVolumesParams) SetPodid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["podid"] = v return } func (p *ListVolumesParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *ListVolumesParams) SetStorageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storageid"] = v return } func (p *ListVolumesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } func (p *ListVolumesParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["type"] = v return } func (p *ListVolumesParams) SetVirtualmachineid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["virtualmachineid"] = v return } func (p *ListVolumesParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListVolumesParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewListVolumesParams() *ListVolumesParams { p := &ListVolumesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VolumeService) GetVolumeID(name string, opts ...OptionFunc) (string, int, error) { p := &ListVolumesParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListVolumes(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Volumes[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Volumes { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VolumeService) GetVolumeByName(name string, opts ...OptionFunc) (*Volume, int, error) { id, count, err := s.GetVolumeID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetVolumeByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *VolumeService) GetVolumeByID(id string, opts ...OptionFunc) (*Volume, int, error) { p := &ListVolumesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListVolumes(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Volumes[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Volume UUID: %s!", id) } // Lists all volumes. func (s *VolumeService) ListVolumes(p *ListVolumesParams) (*ListVolumesResponse, error) { resp, err := s.cs.newRequest("listVolumes", p.toURLValues()) if err != nil { return nil, err } var r ListVolumesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListVolumesResponse struct { Count int `json:"count"` Volumes []*Volume `json:"volume"` } type Volume struct { Account string `json:"account"` Attached string `json:"attached"` Chaininfo string `json:"chaininfo"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Destroyed bool `json:"destroyed"` Deviceid int64 `json:"deviceid"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` Diskofferingdisplaytext string `json:"diskofferingdisplaytext"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayvolume bool `json:"displayvolume"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isextractable bool `json:"isextractable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Path string `json:"path"` Physicalsize int64 `json:"physicalsize"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Provisioningtype string `json:"provisioningtype"` Quiescevm bool `json:"quiescevm"` Serviceofferingdisplaytext string `json:"serviceofferingdisplaytext"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Size int64 `json:"size"` Snapshotid string `json:"snapshotid"` State string `json:"state"` Status string `json:"status"` Storage string `json:"storage"` Storageid string `json:"storageid"` Storagetype string `json:"storagetype"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Type string `json:"type"` Utilization string `json:"utilization"` Virtualmachineid string `json:"virtualmachineid"` Virtualsize int64 `json:"virtualsize"` Vmdisplayname string `json:"vmdisplayname"` Vmname string `json:"vmname"` Vmstate string `json:"vmstate"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type MigrateVolumeParams struct { p map[string]interface{} } func (p *MigrateVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["livemigrate"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("livemigrate", vv) } if v, found := p.p["newdiskofferingid"]; found { u.Set("newdiskofferingid", v.(string)) } if v, found := p.p["storageid"]; found { u.Set("storageid", v.(string)) } if v, found := p.p["volumeid"]; found { u.Set("volumeid", v.(string)) } return u } func (p *MigrateVolumeParams) SetLivemigrate(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["livemigrate"] = v return } func (p *MigrateVolumeParams) SetNewdiskofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["newdiskofferingid"] = v return } func (p *MigrateVolumeParams) SetStorageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storageid"] = v return } func (p *MigrateVolumeParams) SetVolumeid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["volumeid"] = v return } // You should always use this function to get a new MigrateVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewMigrateVolumeParams(storageid string, volumeid string) *MigrateVolumeParams { p := &MigrateVolumeParams{} p.p = make(map[string]interface{}) p.p["storageid"] = storageid p.p["volumeid"] = volumeid return p } // Migrate volume func (s *VolumeService) MigrateVolume(p *MigrateVolumeParams) (*MigrateVolumeResponse, error) { resp, err := s.cs.newRequest("migrateVolume", p.toURLValues()) if err != nil { return nil, err } var r MigrateVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type MigrateVolumeResponse struct { Account string `json:"account"` Attached string `json:"attached"` Chaininfo string `json:"chaininfo"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Destroyed bool `json:"destroyed"` Deviceid int64 `json:"deviceid"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` Diskofferingdisplaytext string `json:"diskofferingdisplaytext"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayvolume bool `json:"displayvolume"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isextractable bool `json:"isextractable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Path string `json:"path"` Physicalsize int64 `json:"physicalsize"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Provisioningtype string `json:"provisioningtype"` Quiescevm bool `json:"quiescevm"` Serviceofferingdisplaytext string `json:"serviceofferingdisplaytext"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Size int64 `json:"size"` Snapshotid string `json:"snapshotid"` State string `json:"state"` Status string `json:"status"` Storage string `json:"storage"` Storageid string `json:"storageid"` Storagetype string `json:"storagetype"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Type string `json:"type"` Utilization string `json:"utilization"` Virtualmachineid string `json:"virtualmachineid"` Virtualsize int64 `json:"virtualsize"` Vmdisplayname string `json:"vmdisplayname"` Vmname string `json:"vmname"` Vmstate string `json:"vmstate"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ResizeVolumeParams struct { p map[string]interface{} } func (p *ResizeVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["diskofferingid"]; found { u.Set("diskofferingid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["maxiops"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("maxiops", vv) } if v, found := p.p["miniops"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("miniops", vv) } if v, found := p.p["shrinkok"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("shrinkok", vv) } if v, found := p.p["size"]; found { vv := strconv.FormatInt(v.(int64), 10) u.Set("size", vv) } return u } func (p *ResizeVolumeParams) SetDiskofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["diskofferingid"] = v return } func (p *ResizeVolumeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ResizeVolumeParams) SetMaxiops(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["maxiops"] = v return } func (p *ResizeVolumeParams) SetMiniops(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["miniops"] = v return } func (p *ResizeVolumeParams) SetShrinkok(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["shrinkok"] = v return } func (p *ResizeVolumeParams) SetSize(v int64) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["size"] = v return } // You should always use this function to get a new ResizeVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewResizeVolumeParams(id string) *ResizeVolumeParams { p := &ResizeVolumeParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Resizes a volume func (s *VolumeService) ResizeVolume(p *ResizeVolumeParams) (*ResizeVolumeResponse, error) { resp, err := s.cs.newRequest("resizeVolume", p.toURLValues()) if err != nil { return nil, err } var r ResizeVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ResizeVolumeResponse struct { Account string `json:"account"` Attached string `json:"attached"` Chaininfo string `json:"chaininfo"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Destroyed bool `json:"destroyed"` Deviceid int64 `json:"deviceid"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` Diskofferingdisplaytext string `json:"diskofferingdisplaytext"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayvolume bool `json:"displayvolume"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isextractable bool `json:"isextractable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Path string `json:"path"` Physicalsize int64 `json:"physicalsize"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Provisioningtype string `json:"provisioningtype"` Quiescevm bool `json:"quiescevm"` Serviceofferingdisplaytext string `json:"serviceofferingdisplaytext"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Size int64 `json:"size"` Snapshotid string `json:"snapshotid"` State string `json:"state"` Status string `json:"status"` Storage string `json:"storage"` Storageid string `json:"storageid"` Storagetype string `json:"storagetype"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Type string `json:"type"` Utilization string `json:"utilization"` Virtualmachineid string `json:"virtualmachineid"` Virtualsize int64 `json:"virtualsize"` Vmdisplayname string `json:"vmdisplayname"` Vmname string `json:"vmname"` Vmstate string `json:"vmstate"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UpdateVolumeParams struct { p map[string]interface{} } func (p *UpdateVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["chaininfo"]; found { u.Set("chaininfo", v.(string)) } if v, found := p.p["customid"]; found { u.Set("customid", v.(string)) } if v, found := p.p["displayvolume"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("displayvolume", vv) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["path"]; found { u.Set("path", v.(string)) } if v, found := p.p["state"]; found { u.Set("state", v.(string)) } if v, found := p.p["storageid"]; found { u.Set("storageid", v.(string)) } return u } func (p *UpdateVolumeParams) SetChaininfo(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["chaininfo"] = v return } func (p *UpdateVolumeParams) SetCustomid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["customid"] = v return } func (p *UpdateVolumeParams) SetDisplayvolume(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["displayvolume"] = v return } func (p *UpdateVolumeParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateVolumeParams) SetPath(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["path"] = v return } func (p *UpdateVolumeParams) SetState(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["state"] = v return } func (p *UpdateVolumeParams) SetStorageid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storageid"] = v return } // You should always use this function to get a new UpdateVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewUpdateVolumeParams() *UpdateVolumeParams { p := &UpdateVolumeParams{} p.p = make(map[string]interface{}) return p } // Updates the volume. func (s *VolumeService) UpdateVolume(p *UpdateVolumeParams) (*UpdateVolumeResponse, error) { resp, err := s.cs.newRequest("updateVolume", p.toURLValues()) if err != nil { return nil, err } var r UpdateVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UpdateVolumeResponse struct { Account string `json:"account"` Attached string `json:"attached"` Chaininfo string `json:"chaininfo"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Destroyed bool `json:"destroyed"` Deviceid int64 `json:"deviceid"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` Diskofferingdisplaytext string `json:"diskofferingdisplaytext"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayvolume bool `json:"displayvolume"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isextractable bool `json:"isextractable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Path string `json:"path"` Physicalsize int64 `json:"physicalsize"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Provisioningtype string `json:"provisioningtype"` Quiescevm bool `json:"quiescevm"` Serviceofferingdisplaytext string `json:"serviceofferingdisplaytext"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Size int64 `json:"size"` Snapshotid string `json:"snapshotid"` State string `json:"state"` Status string `json:"status"` Storage string `json:"storage"` Storageid string `json:"storageid"` Storagetype string `json:"storagetype"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Type string `json:"type"` Utilization string `json:"utilization"` Virtualmachineid string `json:"virtualmachineid"` Virtualsize int64 `json:"virtualsize"` Vmdisplayname string `json:"vmdisplayname"` Vmname string `json:"vmname"` Vmstate string `json:"vmstate"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type UploadVolumeParams struct { p map[string]interface{} } func (p *UploadVolumeParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["checksum"]; found { u.Set("checksum", v.(string)) } if v, found := p.p["diskofferingid"]; found { u.Set("diskofferingid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["format"]; found { u.Set("format", v.(string)) } if v, found := p.p["imagestoreuuid"]; found { u.Set("imagestoreuuid", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["projectid"]; found { u.Set("projectid", v.(string)) } if v, found := p.p["url"]; found { u.Set("url", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *UploadVolumeParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *UploadVolumeParams) SetChecksum(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["checksum"] = v return } func (p *UploadVolumeParams) SetDiskofferingid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["diskofferingid"] = v return } func (p *UploadVolumeParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *UploadVolumeParams) SetFormat(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["format"] = v return } func (p *UploadVolumeParams) SetImagestoreuuid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["imagestoreuuid"] = v return } func (p *UploadVolumeParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *UploadVolumeParams) SetProjectid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["projectid"] = v return } func (p *UploadVolumeParams) SetUrl(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["url"] = v return } func (p *UploadVolumeParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new UploadVolumeParams instance, // as then you are sure you have configured all required params func (s *VolumeService) NewUploadVolumeParams(format string, name string, url string, zoneid string) *UploadVolumeParams { p := &UploadVolumeParams{} p.p = make(map[string]interface{}) p.p["format"] = format p.p["name"] = name p.p["url"] = url p.p["zoneid"] = zoneid return p } // Uploads a data disk. func (s *VolumeService) UploadVolume(p *UploadVolumeParams) (*UploadVolumeResponse, error) { resp, err := s.cs.newRequest("uploadVolume", p.toURLValues()) if err != nil { return nil, err } var r UploadVolumeResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type UploadVolumeResponse struct { Account string `json:"account"` Attached string `json:"attached"` Chaininfo string `json:"chaininfo"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Created string `json:"created"` Destroyed bool `json:"destroyed"` Deviceid int64 `json:"deviceid"` DiskBytesReadRate int64 `json:"diskBytesReadRate"` DiskBytesWriteRate int64 `json:"diskBytesWriteRate"` DiskIopsReadRate int64 `json:"diskIopsReadRate"` DiskIopsWriteRate int64 `json:"diskIopsWriteRate"` Diskofferingdisplaytext string `json:"diskofferingdisplaytext"` Diskofferingid string `json:"diskofferingid"` Diskofferingname string `json:"diskofferingname"` Displayvolume bool `json:"displayvolume"` Domain string `json:"domain"` Domainid string `json:"domainid"` Hypervisor string `json:"hypervisor"` Id string `json:"id"` Isextractable bool `json:"isextractable"` Isodisplaytext string `json:"isodisplaytext"` Isoid string `json:"isoid"` Isoname string `json:"isoname"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Maxiops int64 `json:"maxiops"` Miniops int64 `json:"miniops"` Name string `json:"name"` Path string `json:"path"` Physicalsize int64 `json:"physicalsize"` Podid string `json:"podid"` Podname string `json:"podname"` Project string `json:"project"` Projectid string `json:"projectid"` Provisioningtype string `json:"provisioningtype"` Quiescevm bool `json:"quiescevm"` Serviceofferingdisplaytext string `json:"serviceofferingdisplaytext"` Serviceofferingid string `json:"serviceofferingid"` Serviceofferingname string `json:"serviceofferingname"` Size int64 `json:"size"` Snapshotid string `json:"snapshotid"` State string `json:"state"` Status string `json:"status"` Storage string `json:"storage"` Storageid string `json:"storageid"` Storagetype string `json:"storagetype"` Tags []Tags `json:"tags"` Templatedisplaytext string `json:"templatedisplaytext"` Templateid string `json:"templateid"` Templatename string `json:"templatename"` Type string `json:"type"` Utilization string `json:"utilization"` Virtualmachineid string `json:"virtualmachineid"` Virtualsize int64 `json:"virtualsize"` Vmdisplayname string `json:"vmdisplayname"` Vmname string `json:"vmname"` Vmstate string `json:"vmstate"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/ZoneService.go000066400000000000000000001040461364073403100212060ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "encoding/json" "fmt" "net/url" "strconv" "strings" ) type CreateZoneParams struct { p map[string]interface{} } func (p *CreateZoneParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["dns1"]; found { u.Set("dns1", v.(string)) } if v, found := p.p["dns2"]; found { u.Set("dns2", v.(string)) } if v, found := p.p["domain"]; found { u.Set("domain", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["guestcidraddress"]; found { u.Set("guestcidraddress", v.(string)) } if v, found := p.p["internaldns1"]; found { u.Set("internaldns1", v.(string)) } if v, found := p.p["internaldns2"]; found { u.Set("internaldns2", v.(string)) } if v, found := p.p["ip6dns1"]; found { u.Set("ip6dns1", v.(string)) } if v, found := p.p["ip6dns2"]; found { u.Set("ip6dns2", v.(string)) } if v, found := p.p["localstorageenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("localstorageenabled", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networktype"]; found { u.Set("networktype", v.(string)) } if v, found := p.p["securitygroupenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("securitygroupenabled", vv) } return u } func (p *CreateZoneParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *CreateZoneParams) SetDns1(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dns1"] = v return } func (p *CreateZoneParams) SetDns2(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dns2"] = v return } func (p *CreateZoneParams) SetDomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domain"] = v return } func (p *CreateZoneParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *CreateZoneParams) SetGuestcidraddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["guestcidraddress"] = v return } func (p *CreateZoneParams) SetInternaldns1(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["internaldns1"] = v return } func (p *CreateZoneParams) SetInternaldns2(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["internaldns2"] = v return } func (p *CreateZoneParams) SetIp6dns1(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ip6dns1"] = v return } func (p *CreateZoneParams) SetIp6dns2(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ip6dns2"] = v return } func (p *CreateZoneParams) SetLocalstorageenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["localstorageenabled"] = v return } func (p *CreateZoneParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *CreateZoneParams) SetNetworktype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networktype"] = v return } func (p *CreateZoneParams) SetSecuritygroupenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["securitygroupenabled"] = v return } // You should always use this function to get a new CreateZoneParams instance, // as then you are sure you have configured all required params func (s *ZoneService) NewCreateZoneParams(dns1 string, internaldns1 string, name string, networktype string) *CreateZoneParams { p := &CreateZoneParams{} p.p = make(map[string]interface{}) p.p["dns1"] = dns1 p.p["internaldns1"] = internaldns1 p.p["name"] = name p.p["networktype"] = networktype return p } // Creates a Zone. func (s *ZoneService) CreateZone(p *CreateZoneParams) (*CreateZoneResponse, error) { resp, err := s.cs.newRequest("createZone", p.toURLValues()) if err != nil { return nil, err } var r CreateZoneResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type CreateZoneResponse struct { Allocationstate string `json:"allocationstate"` Capacity []CreateZoneResponseCapacity `json:"capacity"` Description string `json:"description"` Dhcpprovider string `json:"dhcpprovider"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Domainname string `json:"domainname"` Guestcidraddress string `json:"guestcidraddress"` Id string `json:"id"` Internaldns1 string `json:"internaldns1"` Internaldns2 string `json:"internaldns2"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Localstorageenabled bool `json:"localstorageenabled"` Name string `json:"name"` Networktype string `json:"networktype"` Resourcedetails map[string]string `json:"resourcedetails"` Securitygroupsenabled bool `json:"securitygroupsenabled"` Tags []Tags `json:"tags"` Zonetoken string `json:"zonetoken"` } type CreateZoneResponseCapacity struct { Capacityallocated int64 `json:"capacityallocated"` Capacitytotal int64 `json:"capacitytotal"` Capacityused int64 `json:"capacityused"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Name string `json:"name"` Percentused string `json:"percentused"` Podid string `json:"podid"` Podname string `json:"podname"` Type int `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DedicateZoneParams struct { p map[string]interface{} } func (p *DedicateZoneParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *DedicateZoneParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *DedicateZoneParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *DedicateZoneParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new DedicateZoneParams instance, // as then you are sure you have configured all required params func (s *ZoneService) NewDedicateZoneParams(domainid string, zoneid string) *DedicateZoneParams { p := &DedicateZoneParams{} p.p = make(map[string]interface{}) p.p["domainid"] = domainid p.p["zoneid"] = zoneid return p } // Dedicates a zones. func (s *ZoneService) DedicateZone(p *DedicateZoneParams) (*DedicateZoneResponse, error) { resp, err := s.cs.newRequest("dedicateZone", p.toURLValues()) if err != nil { return nil, err } var r DedicateZoneResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DedicateZoneResponse struct { Accountid string `json:"accountid"` Affinitygroupid string `json:"affinitygroupid"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type DeleteZoneParams struct { p map[string]interface{} } func (p *DeleteZoneParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *DeleteZoneParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new DeleteZoneParams instance, // as then you are sure you have configured all required params func (s *ZoneService) NewDeleteZoneParams(id string) *DeleteZoneParams { p := &DeleteZoneParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Deletes a Zone. func (s *ZoneService) DeleteZone(p *DeleteZoneParams) (*DeleteZoneResponse, error) { resp, err := s.cs.newRequest("deleteZone", p.toURLValues()) if err != nil { return nil, err } var r DeleteZoneResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type DeleteZoneResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } func (r *DeleteZoneResponse) UnmarshalJSON(b []byte) error { var m map[string]interface{} err := json.Unmarshal(b, &m) if err != nil { return err } if success, ok := m["success"].(string); ok { m["success"] = success == "true" b, err = json.Marshal(m) if err != nil { return err } } if ostypeid, ok := m["ostypeid"].(float64); ok { m["ostypeid"] = strconv.Itoa(int(ostypeid)) b, err = json.Marshal(m) if err != nil { return err } } type alias DeleteZoneResponse return json.Unmarshal(b, (*alias)(r)) } type DisableOutOfBandManagementForZoneParams struct { p map[string]interface{} } func (p *DisableOutOfBandManagementForZoneParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *DisableOutOfBandManagementForZoneParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new DisableOutOfBandManagementForZoneParams instance, // as then you are sure you have configured all required params func (s *ZoneService) NewDisableOutOfBandManagementForZoneParams(zoneid string) *DisableOutOfBandManagementForZoneParams { p := &DisableOutOfBandManagementForZoneParams{} p.p = make(map[string]interface{}) p.p["zoneid"] = zoneid return p } // Disables out-of-band management for a zone func (s *ZoneService) DisableOutOfBandManagementForZone(p *DisableOutOfBandManagementForZoneParams) (*DisableOutOfBandManagementForZoneResponse, error) { resp, err := s.cs.newRequest("disableOutOfBandManagementForZone", p.toURLValues()) if err != nil { return nil, err } var r DisableOutOfBandManagementForZoneResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type DisableOutOfBandManagementForZoneResponse struct { Action string `json:"action"` Address string `json:"address"` Description string `json:"description"` Driver string `json:"driver"` Enabled bool `json:"enabled"` Hostid string `json:"hostid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Password string `json:"password"` Port string `json:"port"` Powerstate string `json:"powerstate"` Status bool `json:"status"` Username string `json:"username"` } type EnableOutOfBandManagementForZoneParams struct { p map[string]interface{} } func (p *EnableOutOfBandManagementForZoneParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *EnableOutOfBandManagementForZoneParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new EnableOutOfBandManagementForZoneParams instance, // as then you are sure you have configured all required params func (s *ZoneService) NewEnableOutOfBandManagementForZoneParams(zoneid string) *EnableOutOfBandManagementForZoneParams { p := &EnableOutOfBandManagementForZoneParams{} p.p = make(map[string]interface{}) p.p["zoneid"] = zoneid return p } // Enables out-of-band management for a zone func (s *ZoneService) EnableOutOfBandManagementForZone(p *EnableOutOfBandManagementForZoneParams) (*EnableOutOfBandManagementForZoneResponse, error) { resp, err := s.cs.newRequest("enableOutOfBandManagementForZone", p.toURLValues()) if err != nil { return nil, err } var r EnableOutOfBandManagementForZoneResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type EnableOutOfBandManagementForZoneResponse struct { Action string `json:"action"` Address string `json:"address"` Description string `json:"description"` Driver string `json:"driver"` Enabled bool `json:"enabled"` Hostid string `json:"hostid"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Password string `json:"password"` Port string `json:"port"` Powerstate string `json:"powerstate"` Status bool `json:"status"` Username string `json:"username"` } type ListDedicatedZonesParams struct { p map[string]interface{} } func (p *ListDedicatedZonesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["account"]; found { u.Set("account", v.(string)) } if v, found := p.p["affinitygroupid"]; found { u.Set("affinitygroupid", v.(string)) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ListDedicatedZonesParams) SetAccount(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["account"] = v return } func (p *ListDedicatedZonesParams) SetAffinitygroupid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["affinitygroupid"] = v return } func (p *ListDedicatedZonesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListDedicatedZonesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListDedicatedZonesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListDedicatedZonesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListDedicatedZonesParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ListDedicatedZonesParams instance, // as then you are sure you have configured all required params func (s *ZoneService) NewListDedicatedZonesParams() *ListDedicatedZonesParams { p := &ListDedicatedZonesParams{} p.p = make(map[string]interface{}) return p } // List dedicated zones. func (s *ZoneService) ListDedicatedZones(p *ListDedicatedZonesParams) (*ListDedicatedZonesResponse, error) { resp, err := s.cs.newRequest("listDedicatedZones", p.toURLValues()) if err != nil { return nil, err } var r ListDedicatedZonesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListDedicatedZonesResponse struct { Count int `json:"count"` DedicatedZones []*DedicatedZone `json:"dedicatedzone"` } type DedicatedZone struct { Accountid string `json:"accountid"` Affinitygroupid string `json:"affinitygroupid"` Domainid string `json:"domainid"` Id string `json:"id"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ListZonesParams struct { p map[string]interface{} } func (p *ListZonesParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["available"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("available", vv) } if v, found := p.p["domainid"]; found { u.Set("domainid", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } if v, found := p.p["networktype"]; found { u.Set("networktype", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["showcapacities"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("showcapacities", vv) } if v, found := p.p["tags"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("tags[%d].key", i), k) u.Set(fmt.Sprintf("tags[%d].value", i), m[k]) } } return u } func (p *ListZonesParams) SetAvailable(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["available"] = v return } func (p *ListZonesParams) SetDomainid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domainid"] = v return } func (p *ListZonesParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *ListZonesParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListZonesParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } func (p *ListZonesParams) SetNetworktype(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["networktype"] = v return } func (p *ListZonesParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListZonesParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListZonesParams) SetShowcapacities(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["showcapacities"] = v return } func (p *ListZonesParams) SetTags(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["tags"] = v return } // You should always use this function to get a new ListZonesParams instance, // as then you are sure you have configured all required params func (s *ZoneService) NewListZonesParams() *ListZonesParams { p := &ListZonesParams{} p.p = make(map[string]interface{}) return p } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ZoneService) GetZoneID(name string, opts ...OptionFunc) (string, int, error) { p := &ListZonesParams{} p.p = make(map[string]interface{}) p.p["name"] = name for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return "", -1, err } } l, err := s.ListZones(p) if err != nil { return "", -1, err } if l.Count == 0 { return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l) } if l.Count == 1 { return l.Zones[0].Id, l.Count, nil } if l.Count > 1 { for _, v := range l.Zones { if v.Name == name { return v.Id, l.Count, nil } } } return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l) } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ZoneService) GetZoneByName(name string, opts ...OptionFunc) (*Zone, int, error) { id, count, err := s.GetZoneID(name, opts...) if err != nil { return nil, count, err } r, count, err := s.GetZoneByID(id, opts...) if err != nil { return nil, count, err } return r, count, nil } // This is a courtesy helper function, which in some cases may not work as expected! func (s *ZoneService) GetZoneByID(id string, opts ...OptionFunc) (*Zone, int, error) { p := &ListZonesParams{} p.p = make(map[string]interface{}) p.p["id"] = id for _, fn := range append(s.cs.options, opts...) { if err := fn(s.cs, p); err != nil { return nil, -1, err } } l, err := s.ListZones(p) if err != nil { if strings.Contains(err.Error(), fmt.Sprintf( "Invalid parameter id value=%s due to incorrect long value format, "+ "or entity does not exist", id)) { return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l) } return nil, -1, err } if l.Count == 0 { return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l) } if l.Count == 1 { return l.Zones[0], l.Count, nil } return nil, l.Count, fmt.Errorf("There is more then one result for Zone UUID: %s!", id) } // Lists zones func (s *ZoneService) ListZones(p *ListZonesParams) (*ListZonesResponse, error) { resp, err := s.cs.newRequest("listZones", p.toURLValues()) if err != nil { return nil, err } var r ListZonesResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListZonesResponse struct { Count int `json:"count"` Zones []*Zone `json:"zone"` } type Zone struct { Allocationstate string `json:"allocationstate"` Capacity []ZoneCapacity `json:"capacity"` Description string `json:"description"` Dhcpprovider string `json:"dhcpprovider"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Domainname string `json:"domainname"` Guestcidraddress string `json:"guestcidraddress"` Id string `json:"id"` Internaldns1 string `json:"internaldns1"` Internaldns2 string `json:"internaldns2"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Localstorageenabled bool `json:"localstorageenabled"` Name string `json:"name"` Networktype string `json:"networktype"` Resourcedetails map[string]string `json:"resourcedetails"` Securitygroupsenabled bool `json:"securitygroupsenabled"` Tags []Tags `json:"tags"` Zonetoken string `json:"zonetoken"` } type ZoneCapacity struct { Capacityallocated int64 `json:"capacityallocated"` Capacitytotal int64 `json:"capacitytotal"` Capacityused int64 `json:"capacityused"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Name string `json:"name"` Percentused string `json:"percentused"` Podid string `json:"podid"` Podname string `json:"podname"` Type int `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } type ReleaseDedicatedZoneParams struct { p map[string]interface{} } func (p *ReleaseDedicatedZoneParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["zoneid"]; found { u.Set("zoneid", v.(string)) } return u } func (p *ReleaseDedicatedZoneParams) SetZoneid(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["zoneid"] = v return } // You should always use this function to get a new ReleaseDedicatedZoneParams instance, // as then you are sure you have configured all required params func (s *ZoneService) NewReleaseDedicatedZoneParams(zoneid string) *ReleaseDedicatedZoneParams { p := &ReleaseDedicatedZoneParams{} p.p = make(map[string]interface{}) p.p["zoneid"] = zoneid return p } // Release dedication of zone func (s *ZoneService) ReleaseDedicatedZone(p *ReleaseDedicatedZoneParams) (*ReleaseDedicatedZoneResponse, error) { resp, err := s.cs.newRequest("releaseDedicatedZone", p.toURLValues()) if err != nil { return nil, err } var r ReleaseDedicatedZoneResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { if err == AsyncTimeoutErr { return &r, err } return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type ReleaseDedicatedZoneResponse struct { Displaytext string `json:"displaytext"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Success bool `json:"success"` } type UpdateZoneParams struct { p map[string]interface{} } func (p *UpdateZoneParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["allocationstate"]; found { u.Set("allocationstate", v.(string)) } if v, found := p.p["details"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { u.Set(fmt.Sprintf("details[%d].key", i), k) u.Set(fmt.Sprintf("details[%d].value", i), m[k]) } } if v, found := p.p["dhcpprovider"]; found { u.Set("dhcpprovider", v.(string)) } if v, found := p.p["dns1"]; found { u.Set("dns1", v.(string)) } if v, found := p.p["dns2"]; found { u.Set("dns2", v.(string)) } if v, found := p.p["dnssearchorder"]; found { vv := strings.Join(v.([]string), ",") u.Set("dnssearchorder", vv) } if v, found := p.p["domain"]; found { u.Set("domain", v.(string)) } if v, found := p.p["guestcidraddress"]; found { u.Set("guestcidraddress", v.(string)) } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } if v, found := p.p["internaldns1"]; found { u.Set("internaldns1", v.(string)) } if v, found := p.p["internaldns2"]; found { u.Set("internaldns2", v.(string)) } if v, found := p.p["ip6dns1"]; found { u.Set("ip6dns1", v.(string)) } if v, found := p.p["ip6dns2"]; found { u.Set("ip6dns2", v.(string)) } if v, found := p.p["ispublic"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("ispublic", vv) } if v, found := p.p["localstorageenabled"]; found { vv := strconv.FormatBool(v.(bool)) u.Set("localstorageenabled", vv) } if v, found := p.p["name"]; found { u.Set("name", v.(string)) } return u } func (p *UpdateZoneParams) SetAllocationstate(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["allocationstate"] = v return } func (p *UpdateZoneParams) SetDetails(v map[string]string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["details"] = v return } func (p *UpdateZoneParams) SetDhcpprovider(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dhcpprovider"] = v return } func (p *UpdateZoneParams) SetDns1(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dns1"] = v return } func (p *UpdateZoneParams) SetDns2(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dns2"] = v return } func (p *UpdateZoneParams) SetDnssearchorder(v []string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["dnssearchorder"] = v return } func (p *UpdateZoneParams) SetDomain(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["domain"] = v return } func (p *UpdateZoneParams) SetGuestcidraddress(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["guestcidraddress"] = v return } func (p *UpdateZoneParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } func (p *UpdateZoneParams) SetInternaldns1(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["internaldns1"] = v return } func (p *UpdateZoneParams) SetInternaldns2(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["internaldns2"] = v return } func (p *UpdateZoneParams) SetIp6dns1(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ip6dns1"] = v return } func (p *UpdateZoneParams) SetIp6dns2(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ip6dns2"] = v return } func (p *UpdateZoneParams) SetIspublic(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["ispublic"] = v return } func (p *UpdateZoneParams) SetLocalstorageenabled(v bool) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["localstorageenabled"] = v return } func (p *UpdateZoneParams) SetName(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["name"] = v return } // You should always use this function to get a new UpdateZoneParams instance, // as then you are sure you have configured all required params func (s *ZoneService) NewUpdateZoneParams(id string) *UpdateZoneParams { p := &UpdateZoneParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Updates a Zone. func (s *ZoneService) UpdateZone(p *UpdateZoneParams) (*UpdateZoneResponse, error) { resp, err := s.cs.newRequest("updateZone", p.toURLValues()) if err != nil { return nil, err } var r UpdateZoneResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type UpdateZoneResponse struct { Allocationstate string `json:"allocationstate"` Capacity []UpdateZoneResponseCapacity `json:"capacity"` Description string `json:"description"` Dhcpprovider string `json:"dhcpprovider"` Displaytext string `json:"displaytext"` Dns1 string `json:"dns1"` Dns2 string `json:"dns2"` Domain string `json:"domain"` Domainid string `json:"domainid"` Domainname string `json:"domainname"` Guestcidraddress string `json:"guestcidraddress"` Id string `json:"id"` Internaldns1 string `json:"internaldns1"` Internaldns2 string `json:"internaldns2"` Ip6dns1 string `json:"ip6dns1"` Ip6dns2 string `json:"ip6dns2"` JobID string `json:"jobid"` Jobstatus int `json:"jobstatus"` Localstorageenabled bool `json:"localstorageenabled"` Name string `json:"name"` Networktype string `json:"networktype"` Resourcedetails map[string]string `json:"resourcedetails"` Securitygroupsenabled bool `json:"securitygroupsenabled"` Tags []Tags `json:"tags"` Zonetoken string `json:"zonetoken"` } type UpdateZoneResponseCapacity struct { Capacityallocated int64 `json:"capacityallocated"` Capacitytotal int64 `json:"capacitytotal"` Capacityused int64 `json:"capacityused"` Clusterid string `json:"clusterid"` Clustername string `json:"clustername"` Name string `json:"name"` Percentused string `json:"percentused"` Podid string `json:"podid"` Podname string `json:"podname"` Type int `json:"type"` Zoneid string `json:"zoneid"` Zonename string `json:"zonename"` } go-cloudstack-2.9.0/cloudstack/cloudstack.go000066400000000000000000000671631364073403100211160ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack import ( "bytes" "crypto/hmac" "crypto/sha1" "crypto/tls" "encoding/base64" "encoding/json" "errors" "fmt" "io/ioutil" "net" "net/http" "net/http/cookiejar" "net/url" "regexp" "sort" "strings" "time" ) // UnlimitedResourceID is a special ID to define an unlimited resource const UnlimitedResourceID = "-1" var idRegex = regexp.MustCompile(`^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-1)$`) // IsID return true if the passed ID is either a UUID or a UnlimitedResourceID func IsID(id string) bool { return idRegex.MatchString(id) } // ClientOption can be passed to new client functions to set custom options type ClientOption func(*CloudStackClient) // OptionFunc can be passed to the courtesy helper functions to set additional parameters type OptionFunc func(*CloudStackClient, interface{}) error type CSError struct { ErrorCode int `json:"errorcode"` CSErrorCode int `json:"cserrorcode"` ErrorText string `json:"errortext"` } func (e *CSError) Error() error { return fmt.Errorf("CloudStack API error %d (CSExceptionErrorCode: %d): %s", e.ErrorCode, e.CSErrorCode, e.ErrorText) } type CloudStackClient struct { HTTPGETOnly bool // If `true` only use HTTP GET calls client *http.Client // The http client for communicating baseURL string // The base URL of the API apiKey string // Api key secret string // Secret key async bool // Wait for async calls to finish options []OptionFunc // A list of option functions to apply to all API calls timeout int64 // Max waiting timeout in seconds for async jobs to finish; defaults to 300 seconds APIDiscovery *APIDiscoveryService Account *AccountService Address *AddressService AffinityGroup *AffinityGroupService Alert *AlertService Asyncjob *AsyncjobService Authentication *AuthenticationService AutoScale *AutoScaleService Baremetal *BaremetalService BigSwitchBCF *BigSwitchBCFService BrocadeVCS *BrocadeVCSService Certificate *CertificateService CloudIdentifier *CloudIdentifierService Cluster *ClusterService Configuration *ConfigurationService Custom *CustomService DiskOffering *DiskOfferingService Domain *DomainService Event *EventService Firewall *FirewallService GuestOS *GuestOSService Host *HostService Hypervisor *HypervisorService ISO *ISOService ImageStore *ImageStoreService InternalLB *InternalLBService LDAP *LDAPService Limit *LimitService LoadBalancer *LoadBalancerService NAT *NATService NetworkACL *NetworkACLService NetworkDevice *NetworkDeviceService NetworkOffering *NetworkOfferingService Network *NetworkService Nic *NicService NiciraNVP *NiciraNVPService NuageVSP *NuageVSPService OutofbandManagement *OutofbandManagementService OvsElement *OvsElementService Pod *PodService Pool *PoolService PortableIP *PortableIPService Project *ProjectService Quota *QuotaService Region *RegionService Resourcemetadata *ResourcemetadataService Resourcetags *ResourcetagsService Role *RoleService Router *RouterService SSH *SSHService SecurityGroup *SecurityGroupService ServiceOffering *ServiceOfferingService Snapshot *SnapshotService StoragePool *StoragePoolService StratosphereSSP *StratosphereSSPService Swift *SwiftService SystemCapacity *SystemCapacityService SystemVM *SystemVMService Template *TemplateService UCS *UCSService Usage *UsageService User *UserService VLAN *VLANService VMGroup *VMGroupService VPC *VPCService VPN *VPNService VirtualMachine *VirtualMachineService Volume *VolumeService Zone *ZoneService } // Creates a new client for communicating with CloudStack func newClient(apiurl string, apikey string, secret string, async bool, verifyssl bool, options ...ClientOption) *CloudStackClient { jar, _ := cookiejar.New(nil) cs := &CloudStackClient{ client: &http.Client{ Jar: jar, Transport: &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, DualStack: true, }).DialContext, MaxIdleConns: 100, IdleConnTimeout: 90 * time.Second, TLSClientConfig: &tls.Config{InsecureSkipVerify: !verifyssl}, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, }, Timeout: time.Duration(60 * time.Second), }, baseURL: apiurl, apiKey: apikey, secret: secret, async: async, options: []OptionFunc{}, timeout: 300, } for _, fn := range options { fn(cs) } cs.APIDiscovery = NewAPIDiscoveryService(cs) cs.Account = NewAccountService(cs) cs.Address = NewAddressService(cs) cs.AffinityGroup = NewAffinityGroupService(cs) cs.Alert = NewAlertService(cs) cs.Asyncjob = NewAsyncjobService(cs) cs.Authentication = NewAuthenticationService(cs) cs.AutoScale = NewAutoScaleService(cs) cs.Baremetal = NewBaremetalService(cs) cs.BigSwitchBCF = NewBigSwitchBCFService(cs) cs.BrocadeVCS = NewBrocadeVCSService(cs) cs.Certificate = NewCertificateService(cs) cs.CloudIdentifier = NewCloudIdentifierService(cs) cs.Cluster = NewClusterService(cs) cs.Configuration = NewConfigurationService(cs) cs.Custom = NewCustomService(cs) cs.DiskOffering = NewDiskOfferingService(cs) cs.Domain = NewDomainService(cs) cs.Event = NewEventService(cs) cs.Firewall = NewFirewallService(cs) cs.GuestOS = NewGuestOSService(cs) cs.Host = NewHostService(cs) cs.Hypervisor = NewHypervisorService(cs) cs.ISO = NewISOService(cs) cs.ImageStore = NewImageStoreService(cs) cs.InternalLB = NewInternalLBService(cs) cs.LDAP = NewLDAPService(cs) cs.Limit = NewLimitService(cs) cs.LoadBalancer = NewLoadBalancerService(cs) cs.NAT = NewNATService(cs) cs.NetworkACL = NewNetworkACLService(cs) cs.NetworkDevice = NewNetworkDeviceService(cs) cs.NetworkOffering = NewNetworkOfferingService(cs) cs.Network = NewNetworkService(cs) cs.Nic = NewNicService(cs) cs.NiciraNVP = NewNiciraNVPService(cs) cs.NuageVSP = NewNuageVSPService(cs) cs.OutofbandManagement = NewOutofbandManagementService(cs) cs.OvsElement = NewOvsElementService(cs) cs.Pod = NewPodService(cs) cs.Pool = NewPoolService(cs) cs.PortableIP = NewPortableIPService(cs) cs.Project = NewProjectService(cs) cs.Quota = NewQuotaService(cs) cs.Region = NewRegionService(cs) cs.Resourcemetadata = NewResourcemetadataService(cs) cs.Resourcetags = NewResourcetagsService(cs) cs.Role = NewRoleService(cs) cs.Router = NewRouterService(cs) cs.SSH = NewSSHService(cs) cs.SecurityGroup = NewSecurityGroupService(cs) cs.ServiceOffering = NewServiceOfferingService(cs) cs.Snapshot = NewSnapshotService(cs) cs.StoragePool = NewStoragePoolService(cs) cs.StratosphereSSP = NewStratosphereSSPService(cs) cs.Swift = NewSwiftService(cs) cs.SystemCapacity = NewSystemCapacityService(cs) cs.SystemVM = NewSystemVMService(cs) cs.Template = NewTemplateService(cs) cs.UCS = NewUCSService(cs) cs.Usage = NewUsageService(cs) cs.User = NewUserService(cs) cs.VLAN = NewVLANService(cs) cs.VMGroup = NewVMGroupService(cs) cs.VPC = NewVPCService(cs) cs.VPN = NewVPNService(cs) cs.VirtualMachine = NewVirtualMachineService(cs) cs.Volume = NewVolumeService(cs) cs.Zone = NewZoneService(cs) return cs } // Default non-async client. So for async calls you need to implement and check the async job result yourself. When using // HTTPS with a self-signed certificate to connect to your CloudStack API, you would probably want to set 'verifyssl' to // false so the call ignores the SSL errors/warnings. func NewClient(apiurl string, apikey string, secret string, verifyssl bool, options ...ClientOption) *CloudStackClient { cs := newClient(apiurl, apikey, secret, false, verifyssl, options...) return cs } // For sync API calls this client behaves exactly the same as a standard client call, but for async API calls // this client will wait until the async job is finished or until the configured AsyncTimeout is reached. When the async // job finishes successfully it will return actual object received from the API and nil, but when the timout is // reached it will return the initial object containing the async job ID for the running job and a warning. func NewAsyncClient(apiurl string, apikey string, secret string, verifyssl bool, options ...ClientOption) *CloudStackClient { cs := newClient(apiurl, apikey, secret, true, verifyssl, options...) return cs } // When using the async client an api call will wait for the async call to finish before returning. The default is to poll for 300 seconds // seconds, to check if the async job is finished. func (cs *CloudStackClient) AsyncTimeout(timeoutInSeconds int64) { cs.timeout = timeoutInSeconds } // Set any default options that would be added to all API calls that support it. func (cs *CloudStackClient) DefaultOptions(options ...OptionFunc) { if options != nil { cs.options = options } else { cs.options = []OptionFunc{} } } var AsyncTimeoutErr = errors.New("Timeout while waiting for async job to finish") // A helper function that you can use to get the result of a running async job. If the job is not finished within the configured // timeout, the async job returns a AsyncTimeoutErr. func (cs *CloudStackClient) GetAsyncJobResult(jobid string, timeout int64) (json.RawMessage, error) { var timer time.Duration currentTime := time.Now().Unix() for { p := cs.Asyncjob.NewQueryAsyncJobResultParams(jobid) r, err := cs.Asyncjob.QueryAsyncJobResult(p) if err != nil { return nil, err } // Status 1 means the job is finished successfully if r.Jobstatus == 1 { return r.Jobresult, nil } // When the status is 2, the job has failed if r.Jobstatus == 2 { if r.Jobresulttype == "text" { return nil, fmt.Errorf(string(r.Jobresult)) } else { return nil, fmt.Errorf("Undefined error: %s", string(r.Jobresult)) } } if time.Now().Unix()-currentTime > timeout { return nil, AsyncTimeoutErr } // Add an (extremely simple) exponential backoff like feature to prevent // flooding the CloudStack API if timer < 15 { timer++ } time.Sleep(timer * time.Second) } } // Execute the request against a CS API. Will return the raw JSON data returned by the API and nil if // no error occured. If the API returns an error the result will be nil and the HTTP error code and CS // error details. If a processing (code) error occurs the result will be nil and the generated error func (cs *CloudStackClient) newRequest(api string, params url.Values) (json.RawMessage, error) { params.Set("apiKey", cs.apiKey) params.Set("command", api) params.Set("response", "json") // Generate signature for API call // * Serialize parameters, URL encoding only values and sort them by key, done by encodeValues // * Convert the entire argument string to lowercase // * Replace all instances of '+' to '%20' // * Calculate HMAC SHA1 of argument string with CloudStack secret // * URL encode the string and convert to base64 s := encodeValues(params) s2 := strings.ToLower(s) s3 := strings.Replace(s2, "+", "%20", -1) mac := hmac.New(sha1.New, []byte(cs.secret)) mac.Write([]byte(s3)) signature := base64.StdEncoding.EncodeToString(mac.Sum(nil)) var err error var resp *http.Response if !cs.HTTPGETOnly && (api == "deployVirtualMachine" || api == "login" || api == "updateVirtualMachine") { // The deployVirtualMachine API should be called using a POST call // so we don't have to worry about the userdata size // Add the unescaped signature to the POST params params.Set("signature", signature) // Make a POST call resp, err = cs.client.PostForm(cs.baseURL, params) } else { // Create the final URL before we issue the request url := cs.baseURL + "?" + s + "&signature=" + url.QueryEscape(signature) // Make a GET call resp, err = cs.client.Get(url) } if err != nil { return nil, err } defer resp.Body.Close() b, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, err } // Need to get the raw value to make the result play nice b, err = getRawValue(b) if err != nil { return nil, err } if resp.StatusCode != 200 { var e CSError if err := json.Unmarshal(b, &e); err != nil { return nil, err } return nil, e.Error() } return b, nil } // Custom version of net/url Encode that only URL escapes values // Unmodified portions here remain under BSD license of The Go Authors: https://go.googlesource.com/go/+/master/LICENSE func encodeValues(v url.Values) string { if v == nil { return "" } var buf bytes.Buffer keys := make([]string, 0, len(v)) for k := range v { keys = append(keys, k) } sort.Strings(keys) for _, k := range keys { vs := v[k] prefix := k + "=" for _, v := range vs { if buf.Len() > 0 { buf.WriteByte('&') } buf.WriteString(prefix) buf.WriteString(url.QueryEscape(v)) } } return buf.String() } // Generic function to get the first raw value from a response as json.RawMessage func getRawValue(b json.RawMessage) (json.RawMessage, error) { var m map[string]json.RawMessage if err := json.Unmarshal(b, &m); err != nil { return nil, err } for _, v := range m { return v, nil } return nil, fmt.Errorf("Unable to extract the raw value from:\n\n%s\n\n", string(b)) } // getSortedKeysFromMap returns the keys from m in increasing order. func getSortedKeysFromMap(m map[string]string) (keys []string) { for k := range m { keys = append(keys, k) } sort.Strings(keys) return } // WithAsyncTimeout takes a custom timeout to be used by the CloudStackClient func WithAsyncTimeout(timeout int64) ClientOption { return func(cs *CloudStackClient) { if timeout != 0 { cs.timeout = timeout } } } // DomainIDSetter is an interface that every type that can set a domain ID must implement type DomainIDSetter interface { SetDomainid(string) } // WithDomain takes either a domain name or ID and sets the `domainid` parameter func WithDomain(domain string) OptionFunc { return func(cs *CloudStackClient, p interface{}) error { ps, ok := p.(DomainIDSetter) if !ok || domain == "" { return nil } if !IsID(domain) { id, _, err := cs.Domain.GetDomainID(domain) if err != nil { return err } domain = id } ps.SetDomainid(domain) return nil } } // WithHTTPClient takes a custom HTTP client to be used by the CloudStackClient func WithHTTPClient(client *http.Client) ClientOption { return func(cs *CloudStackClient) { if client != nil { if client.Jar == nil { client.Jar = cs.client.Jar } cs.client = client } } } // ProjectIDSetter is an interface that every type that can set a project ID must implement type ProjectIDSetter interface { SetProjectid(string) } // WithProject takes either a project name or ID and sets the `projectid` parameter func WithProject(project string) OptionFunc { return func(cs *CloudStackClient, p interface{}) error { ps, ok := p.(ProjectIDSetter) if !ok || project == "" { return nil } if !IsID(project) { id, _, err := cs.Project.GetProjectID(project) if err != nil { return err } project = id } ps.SetProjectid(project) return nil } } // VPCIDSetter is an interface that every type that can set a vpc ID must implement type VPCIDSetter interface { SetVpcid(string) } // WithVPCID takes a vpc ID and sets the `vpcid` parameter func WithVPCID(id string) OptionFunc { return func(cs *CloudStackClient, p interface{}) error { vs, ok := p.(VPCIDSetter) if !ok || id == "" { return nil } vs.SetVpcid(id) return nil } } // ZoneIDSetter is an interface that every type that can set a zone ID must implement type ZoneIDSetter interface { SetZoneid(string) } // WithZone takes either a zone name or ID and sets the `zoneid` parameter func WithZone(zone string) OptionFunc { return func(cs *CloudStackClient, p interface{}) error { zs, ok := p.(ZoneIDSetter) if !ok || zone == "" { return nil } if !IsID(zone) { id, _, err := cs.Zone.GetZoneID(zone) if err != nil { return err } zone = id } zs.SetZoneid(zone) return nil } } type APIDiscoveryService struct { cs *CloudStackClient } func NewAPIDiscoveryService(cs *CloudStackClient) *APIDiscoveryService { return &APIDiscoveryService{cs: cs} } type AccountService struct { cs *CloudStackClient } func NewAccountService(cs *CloudStackClient) *AccountService { return &AccountService{cs: cs} } type AddressService struct { cs *CloudStackClient } func NewAddressService(cs *CloudStackClient) *AddressService { return &AddressService{cs: cs} } type AffinityGroupService struct { cs *CloudStackClient } func NewAffinityGroupService(cs *CloudStackClient) *AffinityGroupService { return &AffinityGroupService{cs: cs} } type AlertService struct { cs *CloudStackClient } func NewAlertService(cs *CloudStackClient) *AlertService { return &AlertService{cs: cs} } type AsyncjobService struct { cs *CloudStackClient } func NewAsyncjobService(cs *CloudStackClient) *AsyncjobService { return &AsyncjobService{cs: cs} } type AuthenticationService struct { cs *CloudStackClient } func NewAuthenticationService(cs *CloudStackClient) *AuthenticationService { return &AuthenticationService{cs: cs} } type AutoScaleService struct { cs *CloudStackClient } func NewAutoScaleService(cs *CloudStackClient) *AutoScaleService { return &AutoScaleService{cs: cs} } type BaremetalService struct { cs *CloudStackClient } func NewBaremetalService(cs *CloudStackClient) *BaremetalService { return &BaremetalService{cs: cs} } type BigSwitchBCFService struct { cs *CloudStackClient } func NewBigSwitchBCFService(cs *CloudStackClient) *BigSwitchBCFService { return &BigSwitchBCFService{cs: cs} } type BrocadeVCSService struct { cs *CloudStackClient } func NewBrocadeVCSService(cs *CloudStackClient) *BrocadeVCSService { return &BrocadeVCSService{cs: cs} } type CertificateService struct { cs *CloudStackClient } func NewCertificateService(cs *CloudStackClient) *CertificateService { return &CertificateService{cs: cs} } type CloudIdentifierService struct { cs *CloudStackClient } func NewCloudIdentifierService(cs *CloudStackClient) *CloudIdentifierService { return &CloudIdentifierService{cs: cs} } type ClusterService struct { cs *CloudStackClient } func NewClusterService(cs *CloudStackClient) *ClusterService { return &ClusterService{cs: cs} } type ConfigurationService struct { cs *CloudStackClient } func NewConfigurationService(cs *CloudStackClient) *ConfigurationService { return &ConfigurationService{cs: cs} } type CustomService struct { cs *CloudStackClient } func NewCustomService(cs *CloudStackClient) *CustomService { return &CustomService{cs: cs} } type DiskOfferingService struct { cs *CloudStackClient } func NewDiskOfferingService(cs *CloudStackClient) *DiskOfferingService { return &DiskOfferingService{cs: cs} } type DomainService struct { cs *CloudStackClient } func NewDomainService(cs *CloudStackClient) *DomainService { return &DomainService{cs: cs} } type EventService struct { cs *CloudStackClient } func NewEventService(cs *CloudStackClient) *EventService { return &EventService{cs: cs} } type FirewallService struct { cs *CloudStackClient } func NewFirewallService(cs *CloudStackClient) *FirewallService { return &FirewallService{cs: cs} } type GuestOSService struct { cs *CloudStackClient } func NewGuestOSService(cs *CloudStackClient) *GuestOSService { return &GuestOSService{cs: cs} } type HostService struct { cs *CloudStackClient } func NewHostService(cs *CloudStackClient) *HostService { return &HostService{cs: cs} } type HypervisorService struct { cs *CloudStackClient } func NewHypervisorService(cs *CloudStackClient) *HypervisorService { return &HypervisorService{cs: cs} } type ISOService struct { cs *CloudStackClient } func NewISOService(cs *CloudStackClient) *ISOService { return &ISOService{cs: cs} } type ImageStoreService struct { cs *CloudStackClient } func NewImageStoreService(cs *CloudStackClient) *ImageStoreService { return &ImageStoreService{cs: cs} } type InternalLBService struct { cs *CloudStackClient } func NewInternalLBService(cs *CloudStackClient) *InternalLBService { return &InternalLBService{cs: cs} } type LDAPService struct { cs *CloudStackClient } func NewLDAPService(cs *CloudStackClient) *LDAPService { return &LDAPService{cs: cs} } type LimitService struct { cs *CloudStackClient } func NewLimitService(cs *CloudStackClient) *LimitService { return &LimitService{cs: cs} } type LoadBalancerService struct { cs *CloudStackClient } func NewLoadBalancerService(cs *CloudStackClient) *LoadBalancerService { return &LoadBalancerService{cs: cs} } type NATService struct { cs *CloudStackClient } func NewNATService(cs *CloudStackClient) *NATService { return &NATService{cs: cs} } type NetworkACLService struct { cs *CloudStackClient } func NewNetworkACLService(cs *CloudStackClient) *NetworkACLService { return &NetworkACLService{cs: cs} } type NetworkDeviceService struct { cs *CloudStackClient } func NewNetworkDeviceService(cs *CloudStackClient) *NetworkDeviceService { return &NetworkDeviceService{cs: cs} } type NetworkOfferingService struct { cs *CloudStackClient } func NewNetworkOfferingService(cs *CloudStackClient) *NetworkOfferingService { return &NetworkOfferingService{cs: cs} } type NetworkService struct { cs *CloudStackClient } func NewNetworkService(cs *CloudStackClient) *NetworkService { return &NetworkService{cs: cs} } type NicService struct { cs *CloudStackClient } func NewNicService(cs *CloudStackClient) *NicService { return &NicService{cs: cs} } type NiciraNVPService struct { cs *CloudStackClient } func NewNiciraNVPService(cs *CloudStackClient) *NiciraNVPService { return &NiciraNVPService{cs: cs} } type NuageVSPService struct { cs *CloudStackClient } func NewNuageVSPService(cs *CloudStackClient) *NuageVSPService { return &NuageVSPService{cs: cs} } type OutofbandManagementService struct { cs *CloudStackClient } func NewOutofbandManagementService(cs *CloudStackClient) *OutofbandManagementService { return &OutofbandManagementService{cs: cs} } type OvsElementService struct { cs *CloudStackClient } func NewOvsElementService(cs *CloudStackClient) *OvsElementService { return &OvsElementService{cs: cs} } type PodService struct { cs *CloudStackClient } func NewPodService(cs *CloudStackClient) *PodService { return &PodService{cs: cs} } type PoolService struct { cs *CloudStackClient } func NewPoolService(cs *CloudStackClient) *PoolService { return &PoolService{cs: cs} } type PortableIPService struct { cs *CloudStackClient } func NewPortableIPService(cs *CloudStackClient) *PortableIPService { return &PortableIPService{cs: cs} } type ProjectService struct { cs *CloudStackClient } func NewProjectService(cs *CloudStackClient) *ProjectService { return &ProjectService{cs: cs} } type QuotaService struct { cs *CloudStackClient } func NewQuotaService(cs *CloudStackClient) *QuotaService { return &QuotaService{cs: cs} } type RegionService struct { cs *CloudStackClient } func NewRegionService(cs *CloudStackClient) *RegionService { return &RegionService{cs: cs} } type ResourcemetadataService struct { cs *CloudStackClient } func NewResourcemetadataService(cs *CloudStackClient) *ResourcemetadataService { return &ResourcemetadataService{cs: cs} } type ResourcetagsService struct { cs *CloudStackClient } func NewResourcetagsService(cs *CloudStackClient) *ResourcetagsService { return &ResourcetagsService{cs: cs} } type RoleService struct { cs *CloudStackClient } func NewRoleService(cs *CloudStackClient) *RoleService { return &RoleService{cs: cs} } type RouterService struct { cs *CloudStackClient } func NewRouterService(cs *CloudStackClient) *RouterService { return &RouterService{cs: cs} } type SSHService struct { cs *CloudStackClient } func NewSSHService(cs *CloudStackClient) *SSHService { return &SSHService{cs: cs} } type SecurityGroupService struct { cs *CloudStackClient } func NewSecurityGroupService(cs *CloudStackClient) *SecurityGroupService { return &SecurityGroupService{cs: cs} } type ServiceOfferingService struct { cs *CloudStackClient } func NewServiceOfferingService(cs *CloudStackClient) *ServiceOfferingService { return &ServiceOfferingService{cs: cs} } type SnapshotService struct { cs *CloudStackClient } func NewSnapshotService(cs *CloudStackClient) *SnapshotService { return &SnapshotService{cs: cs} } type StoragePoolService struct { cs *CloudStackClient } func NewStoragePoolService(cs *CloudStackClient) *StoragePoolService { return &StoragePoolService{cs: cs} } type StratosphereSSPService struct { cs *CloudStackClient } func NewStratosphereSSPService(cs *CloudStackClient) *StratosphereSSPService { return &StratosphereSSPService{cs: cs} } type SwiftService struct { cs *CloudStackClient } func NewSwiftService(cs *CloudStackClient) *SwiftService { return &SwiftService{cs: cs} } type SystemCapacityService struct { cs *CloudStackClient } func NewSystemCapacityService(cs *CloudStackClient) *SystemCapacityService { return &SystemCapacityService{cs: cs} } type SystemVMService struct { cs *CloudStackClient } func NewSystemVMService(cs *CloudStackClient) *SystemVMService { return &SystemVMService{cs: cs} } type TemplateService struct { cs *CloudStackClient } func NewTemplateService(cs *CloudStackClient) *TemplateService { return &TemplateService{cs: cs} } type UCSService struct { cs *CloudStackClient } func NewUCSService(cs *CloudStackClient) *UCSService { return &UCSService{cs: cs} } type UsageService struct { cs *CloudStackClient } func NewUsageService(cs *CloudStackClient) *UsageService { return &UsageService{cs: cs} } type UserService struct { cs *CloudStackClient } func NewUserService(cs *CloudStackClient) *UserService { return &UserService{cs: cs} } type VLANService struct { cs *CloudStackClient } func NewVLANService(cs *CloudStackClient) *VLANService { return &VLANService{cs: cs} } type VMGroupService struct { cs *CloudStackClient } func NewVMGroupService(cs *CloudStackClient) *VMGroupService { return &VMGroupService{cs: cs} } type VPCService struct { cs *CloudStackClient } func NewVPCService(cs *CloudStackClient) *VPCService { return &VPCService{cs: cs} } type VPNService struct { cs *CloudStackClient } func NewVPNService(cs *CloudStackClient) *VPNService { return &VPNService{cs: cs} } type VirtualMachineService struct { cs *CloudStackClient } func NewVirtualMachineService(cs *CloudStackClient) *VirtualMachineService { return &VirtualMachineService{cs: cs} } type VolumeService struct { cs *CloudStackClient } func NewVolumeService(cs *CloudStackClient) *VolumeService { return &VolumeService{cs: cs} } type ZoneService struct { cs *CloudStackClient } func NewZoneService(cs *CloudStackClient) *ZoneService { return &ZoneService{cs: cs} } go-cloudstack-2.9.0/generate/000077500000000000000000000000001364073403100160545ustar00rootroot00000000000000go-cloudstack-2.9.0/generate/generate.go000066400000000000000000001327061364073403100202060ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package main import ( "bytes" "encoding/json" "flag" "fmt" "go/format" "io/ioutil" "log" "os" "os/exec" "path" "sort" "strings" "unicode" ) const pkg = "cloudstack" // detailsRequireKeyValue is a prefilled map with a list of details // that need to be encoded using an explicit key and a value entry. var detailsRequireKeyValue = map[string]bool{ "addGuestOs": true, "addImageStore": true, "addResourceDetail": true, "createSecondaryStagingStore": true, "updateCloudToUseObjectStore": true, "updateGuestOs": true, "updateZone": true, } // We prefill this one value to make sure it is not // created twice, as this is also a top level type. var typeNames = map[string]bool{"Nic": true} type apiInfo map[string][]string type allServices struct { services services } type apiInfoNotFoundError struct { api string } func (e *apiInfoNotFoundError) Error() string { return fmt.Sprintf("Could not find API details for: %s", e.api) } type generateError struct { service *service error error } func (e *generateError) Error() string { return fmt.Sprintf("API %s failed to generate code: %v", e.service.name, e.error) } type goimportError struct { output string } func (e *goimportError) Error() string { return fmt.Sprintf("GoImport failed to format:\n%v", e.output) } type service struct { name string apis []*API p func(format string, args ...interface{}) // print raw pn func(format string, args ...interface{}) // print with indent and newline } type services []*service // Add functions for the Sort interface func (s services) Len() int { return len(s) } func (s services) Less(i, j int) bool { return s[i].name < s[j].name } func (s services) Swap(i, j int) { s[i], s[j] = s[j], s[i] } // APIParams represents a list of API params type APIParams []*APIParam // Add functions for the Sort interface func (s APIParams) Len() int { return len(s) } func (s APIParams) Less(i, j int) bool { return s[i].Name < s[j].Name } func (s APIParams) Swap(i, j int) { s[i], s[j] = s[j], s[i] } // API represents an API endpoint we can call type API struct { Name string `json:"name"` Description string `json:"description"` Isasync bool `json:"isasync"` Params APIParams `json:"params"` Response APIResponses `json:"response"` } // APIParam represents a single API parameter type APIParam struct { Name string `json:"name"` Description string `json:"description"` Type string `json:"type"` Required bool `json:"required"` } // APIResponse represents a API response type APIResponse struct { Name string `json:"name"` Description string `json:"description"` Type string `json:"type"` Response APIResponses `json:"response"` } // APIResponses represents a list of API responses type APIResponses []*APIResponse // Add functions for the Sort interface func (s APIResponses) Len() int { return len(s) } func (s APIResponses) Less(i, j int) bool { return s[i].Name < s[j].Name } func (s APIResponses) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func main() { listApis := flag.String("api", "listApis.json", "path to the saved JSON output of listApis") flag.Parse() as, errors, err := getAllServices(*listApis) if err != nil { log.Fatal(err) } if err = as.WriteGeneralCode(); err != nil { log.Fatal(err) } for _, s := range as.services { if err = s.WriteGeneratedCode(); err != nil { errors = append(errors, &generateError{s, err}) } } outdir, err := sourceDir() if err != nil { log.Fatal(err) } out, err := exec.Command("goimports", "-w", outdir).CombinedOutput() if err != nil { errors = append(errors, &goimportError{string(out)}) } if len(errors) > 0 { log.Printf("%d API(s) failed to generate:", len(errors)) for _, ce := range errors { log.Printf(ce.Error()) } os.Exit(1) } } func (as *allServices) WriteGeneralCode() error { outdir, err := sourceDir() if err != nil { log.Fatalf("Failed to get source dir: %s", err) } code, err := as.GeneralCode() if err != nil { return err } file := path.Join(outdir, "cloudstack.go") return ioutil.WriteFile(file, code, 0644) } func (as *allServices) GeneralCode() ([]byte, error) { // Buffer the output in memory, for gofmt'ing later in the defer. var buf bytes.Buffer p := func(format string, args ...interface{}) { _, err := fmt.Fprintf(&buf, format, args...) if err != nil { panic(err) } } pn := func(format string, args ...interface{}) { p(format+"\n", args...) } pn("//") pn("// Copyright 2018, Sander van Harmelen") pn("//") pn("// Licensed under the Apache License, Version 2.0 (the \"License\");") pn("// you may not use this file except in compliance with the License.") pn("// You may obtain a copy of the License at") pn("//") pn("// http://www.apache.org/licenses/LICENSE-2.0") pn("//") pn("// Unless required by applicable law or agreed to in writing, software") pn("// distributed under the License is distributed on an \"AS IS\" BASIS,") pn("// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.") pn("// See the License for the specific language governing permissions and") pn("// limitations under the License.") pn("//") pn("") pn("package %s", pkg) pn("") pn("// UnlimitedResourceID is a special ID to define an unlimited resource") pn("const UnlimitedResourceID = \"-1\"") pn("") pn("var idRegex = regexp.MustCompile(`^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-1)$`)") pn("") pn("// IsID return true if the passed ID is either a UUID or a UnlimitedResourceID") pn("func IsID(id string) bool {") pn(" return idRegex.MatchString(id)") pn("}") pn("") pn("// ClientOption can be passed to new client functions to set custom options") pn("type ClientOption func(*CloudStackClient)") pn("") pn("// OptionFunc can be passed to the courtesy helper functions to set additional parameters") pn("type OptionFunc func(*CloudStackClient, interface{}) error") pn("") pn("type CSError struct {") pn(" ErrorCode int `json:\"errorcode\"`") pn(" CSErrorCode int `json:\"cserrorcode\"`") pn(" ErrorText string `json:\"errortext\"`") pn("}") pn("") pn("func (e *CSError) Error() error {") pn(" return fmt.Errorf(\"CloudStack API error %%d (CSExceptionErrorCode: %%d): %%s\", e.ErrorCode, e.CSErrorCode, e.ErrorText)") pn("}") pn("") pn("type CloudStackClient struct {") pn(" HTTPGETOnly bool // If `true` only use HTTP GET calls") pn("") pn(" client *http.Client // The http client for communicating") pn(" baseURL string // The base URL of the API") pn(" apiKey string // Api key") pn(" secret string // Secret key") pn(" async bool // Wait for async calls to finish") pn(" options []OptionFunc // A list of option functions to apply to all API calls") pn(" timeout int64 // Max waiting timeout in seconds for async jobs to finish; defaults to 300 seconds") pn("") for _, s := range as.services { pn(" %s *%s", strings.TrimSuffix(s.name, "Service"), s.name) } pn("}") pn("") pn("// Creates a new client for communicating with CloudStack") pn("func newClient(apiurl string, apikey string, secret string, async bool, verifyssl bool, options ...ClientOption) *CloudStackClient {") pn(" jar, _ := cookiejar.New(nil)") pn(" cs := &CloudStackClient{") pn(" client: &http.Client{") pn(" Jar: jar,") pn(" Transport: &http.Transport{") pn(" Proxy: http.ProxyFromEnvironment,") pn(" DialContext: (&net.Dialer{") pn(" Timeout: 30 * time.Second,") pn(" KeepAlive: 30 * time.Second,") pn(" DualStack: true,") pn(" }).DialContext,") pn(" MaxIdleConns: 100,") pn(" IdleConnTimeout: 90 * time.Second,") pn(" TLSClientConfig: &tls.Config{InsecureSkipVerify: !verifyssl},") pn(" TLSHandshakeTimeout: 10 * time.Second,") pn(" ExpectContinueTimeout: 1 * time.Second,") pn(" },") pn(" Timeout: time.Duration(60 * time.Second),") pn(" },") pn(" baseURL: apiurl,") pn(" apiKey: apikey,") pn(" secret: secret,") pn(" async: async,") pn(" options: []OptionFunc{},") pn(" timeout: 300,") pn(" }") pn("") pn(" for _, fn := range options {") pn(" fn(cs)") pn(" }") pn("") for _, s := range as.services { pn(" cs.%s = New%s(cs)", strings.TrimSuffix(s.name, "Service"), s.name) } pn("") pn(" return cs") pn("}") pn("") pn("// Default non-async client. So for async calls you need to implement and check the async job result yourself. When using") pn("// HTTPS with a self-signed certificate to connect to your CloudStack API, you would probably want to set 'verifyssl' to") pn("// false so the call ignores the SSL errors/warnings.") pn("func NewClient(apiurl string, apikey string, secret string, verifyssl bool, options ...ClientOption) *CloudStackClient {") pn(" cs := newClient(apiurl, apikey, secret, false, verifyssl, options...)") pn(" return cs") pn("}") pn("") pn("// For sync API calls this client behaves exactly the same as a standard client call, but for async API calls") pn("// this client will wait until the async job is finished or until the configured AsyncTimeout is reached. When the async") pn("// job finishes successfully it will return actual object received from the API and nil, but when the timout is") pn("// reached it will return the initial object containing the async job ID for the running job and a warning.") pn("func NewAsyncClient(apiurl string, apikey string, secret string, verifyssl bool, options ...ClientOption) *CloudStackClient {") pn(" cs := newClient(apiurl, apikey, secret, true, verifyssl, options...)") pn(" return cs") pn("}") pn("") pn("// When using the async client an api call will wait for the async call to finish before returning. The default is to poll for 300 seconds") pn("// seconds, to check if the async job is finished.") pn("func (cs *CloudStackClient) AsyncTimeout(timeoutInSeconds int64) {") pn(" cs.timeout = timeoutInSeconds") pn("}") pn("") pn("// Set any default options that would be added to all API calls that support it.") pn("func (cs *CloudStackClient) DefaultOptions(options ...OptionFunc) {") pn(" if options != nil {") pn(" cs.options = options") pn(" } else {") pn(" cs.options = []OptionFunc{}") pn(" }") pn("}") pn("") pn("var AsyncTimeoutErr = errors.New(\"Timeout while waiting for async job to finish\")") pn("") pn("// A helper function that you can use to get the result of a running async job. If the job is not finished within the configured") pn("// timeout, the async job returns a AsyncTimeoutErr.") pn("func (cs *CloudStackClient) GetAsyncJobResult(jobid string, timeout int64) (json.RawMessage, error) {") pn(" var timer time.Duration") pn(" currentTime := time.Now().Unix()") pn("") pn(" for {") pn(" p := cs.Asyncjob.NewQueryAsyncJobResultParams(jobid)") pn(" r, err := cs.Asyncjob.QueryAsyncJobResult(p)") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn("") pn(" // Status 1 means the job is finished successfully") pn(" if r.Jobstatus == 1 {") pn(" return r.Jobresult, nil") pn(" }") pn("") pn(" // When the status is 2, the job has failed") pn(" if r.Jobstatus == 2 {") pn(" if r.Jobresulttype == \"text\" {") pn(" return nil, fmt.Errorf(string(r.Jobresult))") pn(" } else {") pn(" return nil, fmt.Errorf(\"Undefined error: %%s\", string(r.Jobresult))") pn(" }") pn(" }") pn("") pn(" if time.Now().Unix()-currentTime > timeout {") pn(" return nil, AsyncTimeoutErr") pn(" }") pn("") pn(" // Add an (extremely simple) exponential backoff like feature to prevent") pn(" // flooding the CloudStack API") pn(" if timer < 15 {") pn(" timer++") pn(" }") pn("") pn(" time.Sleep(timer * time.Second)") pn(" }") pn("}") pn("") pn("// Execute the request against a CS API. Will return the raw JSON data returned by the API and nil if") pn("// no error occured. If the API returns an error the result will be nil and the HTTP error code and CS") pn("// error details. If a processing (code) error occurs the result will be nil and the generated error") pn("func (cs *CloudStackClient) newRequest(api string, params url.Values) (json.RawMessage, error) {") pn(" params.Set(\"apiKey\", cs.apiKey)") pn(" params.Set(\"command\", api)") pn(" params.Set(\"response\", \"json\")") pn("") pn(" // Generate signature for API call") pn(" // * Serialize parameters, URL encoding only values and sort them by key, done by encodeValues") pn(" // * Convert the entire argument string to lowercase") pn(" // * Replace all instances of '+' to '%%20'") pn(" // * Calculate HMAC SHA1 of argument string with CloudStack secret") pn(" // * URL encode the string and convert to base64") pn(" s := encodeValues(params)") pn(" s2 := strings.ToLower(s)") pn(" s3 := strings.Replace(s2, \"+\", \"%%20\", -1)") pn(" mac := hmac.New(sha1.New, []byte(cs.secret))") pn(" mac.Write([]byte(s3))") pn(" signature := base64.StdEncoding.EncodeToString(mac.Sum(nil))") pn("") pn(" var err error") pn(" var resp *http.Response") pn(" if !cs.HTTPGETOnly && (api == \"deployVirtualMachine\" || api == \"login\" || api == \"updateVirtualMachine\") {") pn(" // The deployVirtualMachine API should be called using a POST call") pn(" // so we don't have to worry about the userdata size") pn("") pn(" // Add the unescaped signature to the POST params") pn(" params.Set(\"signature\", signature)") pn("") pn(" // Make a POST call") pn(" resp, err = cs.client.PostForm(cs.baseURL, params)") pn(" } else {") pn(" // Create the final URL before we issue the request") pn(" url := cs.baseURL + \"?\" + s + \"&signature=\" + url.QueryEscape(signature)") pn("") pn(" // Make a GET call") pn(" resp, err = cs.client.Get(url)") pn(" }") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn(" defer resp.Body.Close()") pn("") pn(" b, err := ioutil.ReadAll(resp.Body)") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn("") pn(" // Need to get the raw value to make the result play nice") pn(" b, err = getRawValue(b)") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn("") pn(" if resp.StatusCode != 200 {") pn(" var e CSError") pn(" if err := json.Unmarshal(b, &e); err != nil {") pn(" return nil, err") pn(" }") pn(" return nil, e.Error()") pn(" }") pn(" return b, nil") pn("}") pn("") pn("// Custom version of net/url Encode that only URL escapes values") pn("// Unmodified portions here remain under BSD license of The Go Authors: https://go.googlesource.com/go/+/master/LICENSE") pn("func encodeValues(v url.Values) string {") pn(" if v == nil {") pn(" return \"\"") pn(" }") pn(" var buf bytes.Buffer") pn(" keys := make([]string, 0, len(v))") pn(" for k := range v {") pn(" keys = append(keys, k)") pn(" }") pn(" sort.Strings(keys)") pn(" for _, k := range keys {") pn(" vs := v[k]") pn(" prefix := k + \"=\"") pn(" for _, v := range vs {") pn(" if buf.Len() > 0 {") pn(" buf.WriteByte('&')") pn(" }") pn(" buf.WriteString(prefix)") pn(" buf.WriteString(url.QueryEscape(v))") pn(" }") pn(" }") pn(" return buf.String()") pn("}") pn("") pn("// Generic function to get the first raw value from a response as json.RawMessage") pn("func getRawValue(b json.RawMessage) (json.RawMessage, error) {") pn(" var m map[string]json.RawMessage") pn(" if err := json.Unmarshal(b, &m); err != nil {") pn(" return nil, err") pn(" }") pn(" for _, v := range m {") pn(" return v, nil") pn(" }") pn(" return nil, fmt.Errorf(\"Unable to extract the raw value from:\\n\\n%%s\\n\\n\", string(b))") pn("}") pn("") pn("// getSortedKeysFromMap returns the keys from m in increasing order.") pn("func getSortedKeysFromMap(m map[string]string) (keys []string) {") pn(" for k := range m {") pn(" keys = append(keys, k)") pn(" }") pn(" sort.Strings(keys)") pn(" return") pn("}") pn("") pn("// WithAsyncTimeout takes a custom timeout to be used by the CloudStackClient") pn("func WithAsyncTimeout(timeout int64) ClientOption {") pn(" return func(cs *CloudStackClient) {") pn(" if timeout != 0 {") pn(" cs.timeout = timeout") pn(" }") pn(" }") pn("}") pn("") pn("// DomainIDSetter is an interface that every type that can set a domain ID must implement") pn("type DomainIDSetter interface {") pn(" SetDomainid(string)") pn("}") pn("") pn("// WithDomain takes either a domain name or ID and sets the `domainid` parameter") pn("func WithDomain(domain string) OptionFunc {") pn(" return func(cs *CloudStackClient, p interface{}) error {") pn(" ps, ok := p.(DomainIDSetter)") pn("") pn(" if !ok || domain == \"\" {") pn(" return nil") pn(" }") pn("") pn(" if !IsID(domain) {") pn(" id, _, err := cs.Domain.GetDomainID(domain)") pn(" if err != nil {") pn(" return err") pn(" }") pn(" domain = id") pn(" }") pn("") pn(" ps.SetDomainid(domain)") pn("") pn(" return nil") pn(" }") pn("}") pn("") pn("// WithHTTPClient takes a custom HTTP client to be used by the CloudStackClient") pn("func WithHTTPClient(client *http.Client) ClientOption {") pn(" return func(cs *CloudStackClient) {") pn(" if client != nil {") pn(" if client.Jar == nil {") pn(" client.Jar = cs.client.Jar") pn(" }") pn(" cs.client = client") pn(" }") pn(" }") pn("}") pn("") pn("// ProjectIDSetter is an interface that every type that can set a project ID must implement") pn("type ProjectIDSetter interface {") pn(" SetProjectid(string)") pn("}") pn("") pn("// WithProject takes either a project name or ID and sets the `projectid` parameter") pn("func WithProject(project string) OptionFunc {") pn(" return func(cs *CloudStackClient, p interface{}) error {") pn(" ps, ok := p.(ProjectIDSetter)") pn("") pn(" if !ok || project == \"\" {") pn(" return nil") pn(" }") pn("") pn(" if !IsID(project) {") pn(" id, _, err := cs.Project.GetProjectID(project)") pn(" if err != nil {") pn(" return err") pn(" }") pn(" project = id") pn(" }") pn("") pn(" ps.SetProjectid(project)") pn("") pn(" return nil") pn(" }") pn("}") pn("") pn("// VPCIDSetter is an interface that every type that can set a vpc ID must implement") pn("type VPCIDSetter interface {") pn(" SetVpcid(string)") pn("}") pn("") pn("// WithVPCID takes a vpc ID and sets the `vpcid` parameter") pn("func WithVPCID(id string) OptionFunc {") pn(" return func(cs *CloudStackClient, p interface{}) error {") pn(" vs, ok := p.(VPCIDSetter)") pn("") pn(" if !ok || id == \"\" {") pn(" return nil") pn(" }") pn("") pn(" vs.SetVpcid(id)") pn("") pn(" return nil") pn(" }") pn("}") pn("") pn("// ZoneIDSetter is an interface that every type that can set a zone ID must implement") pn("type ZoneIDSetter interface {") pn(" SetZoneid(string)") pn("}") pn("") pn("// WithZone takes either a zone name or ID and sets the `zoneid` parameter") pn("func WithZone(zone string) OptionFunc {") pn(" return func(cs *CloudStackClient, p interface{}) error {") pn(" zs, ok := p.(ZoneIDSetter)") pn("") pn(" if !ok || zone == \"\" {") pn(" return nil") pn(" }") pn("") pn(" if !IsID(zone) {") pn(" id, _, err := cs.Zone.GetZoneID(zone)") pn(" if err != nil {") pn(" return err") pn(" }") pn(" zone = id") pn(" }") pn("") pn(" zs.SetZoneid(zone)") pn("") pn(" return nil") pn(" }") pn("}") pn("") for _, s := range as.services { pn("type %s struct {", s.name) pn(" cs *CloudStackClient") pn("}") pn("") pn("func New%s(cs *CloudStackClient) *%s {", s.name, s.name) pn(" return &%s{cs: cs}", s.name) pn("}") pn("") } clean, err := format.Source(buf.Bytes()) if err != nil { return buf.Bytes(), err } return clean, err } func (s *service) WriteGeneratedCode() error { outdir, err := sourceDir() if err != nil { log.Fatalf("Failed to get source dir: %s", err) } code, err := s.GenerateCode() if err != nil { return err } file := path.Join(outdir, s.name+".go") return ioutil.WriteFile(file, code, 0644) } func (s *service) GenerateCode() ([]byte, error) { // Buffer the output in memory, for gofmt'ing later in the defer. var buf bytes.Buffer s.p = func(format string, args ...interface{}) { _, err := fmt.Fprintf(&buf, format, args...) if err != nil { panic(err) } } s.pn = func(format string, args ...interface{}) { s.p(format+"\n", args...) } pn := s.pn pn("//") pn("// Copyright 2018, Sander van Harmelen") pn("//") pn("// Licensed under the Apache License, Version 2.0 (the \"License\");") pn("// you may not use this file except in compliance with the License.") pn("// You may obtain a copy of the License at") pn("//") pn("// http://www.apache.org/licenses/LICENSE-2.0") pn("//") pn("// Unless required by applicable law or agreed to in writing, software") pn("// distributed under the License is distributed on an \"AS IS\" BASIS,") pn("// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.") pn("// See the License for the specific language governing permissions and") pn("// limitations under the License.") pn("//") pn("") pn("package %s", pkg) pn("") if s.name == "FirewallService" { pn("// Helper function for maintaining backwards compatibility") pn("func convertFirewallServiceResponse(b []byte) ([]byte, error) {") pn(" var raw map[string]interface{}") pn(" if err := json.Unmarshal(b, &raw); err != nil {") pn(" return nil, err") pn(" }") pn("") pn(" if _, ok := raw[\"firewallrule\"]; ok {") pn(" return convertFirewallServiceListResponse(b)") pn(" }") pn("") pn(" for _, k := range []string{\"endport\", \"startport\"} {") pn(" if sVal, ok := raw[k].(string); ok {") pn(" iVal, err := strconv.Atoi(sVal)") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn(" raw[k] = iVal") pn(" }") pn(" }") pn("") pn(" return json.Marshal(raw)") pn("}") pn("") pn("// Helper function for maintaining backwards compatibility") pn("func convertFirewallServiceListResponse(b []byte) ([]byte, error) {") pn(" var rawList struct {") pn(" Count int `json:\"count\"`") pn(" FirewallRules []map[string]interface{} `json:\"firewallrule\"`") pn(" }") pn("") pn(" if err := json.Unmarshal(b, &rawList); err != nil {") pn(" return nil, err") pn(" }") pn("") pn(" for _, r := range rawList.FirewallRules {") pn(" for _, k := range []string{\"endport\", \"startport\"} {") pn(" if sVal, ok := r[k].(string); ok {") pn(" iVal, err := strconv.Atoi(sVal)") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn(" r[k] = iVal") pn(" }") pn(" }") pn(" }") pn("") pn(" return json.Marshal(rawList)") pn("}") pn("") } if s.name == "SecurityGroupService" { pn("// Helper function for maintaining backwards compatibility") pn("func convertAuthorizeSecurityGroupIngressResponse(b []byte) ([]byte, error) {") pn(" var raw struct {") pn(" Ingressrule []interface{} `json:\"ingressrule\"`") pn(" }") pn(" if err := json.Unmarshal(b, &raw); err != nil {") pn(" return nil, err") pn(" }") pn("") pn(" if len(raw.Ingressrule) != 1 {") pn(" return b, nil") pn(" }") pn("") pn(" return json.Marshal(raw.Ingressrule[0])") pn("}") pn("") pn("// Helper function for maintaining backwards compatibility") pn("func convertAuthorizeSecurityGroupEgressResponse(b []byte) ([]byte, error) {") pn(" var raw struct {") pn(" Egressrule []interface{} `json:\"egressrule\"`") pn(" }") pn(" if err := json.Unmarshal(b, &raw); err != nil {") pn(" return nil, err") pn(" }") pn("") pn(" if len(raw.Egressrule) != 1 {") pn(" return b, nil") pn(" }") pn("") pn(" return json.Marshal(raw.Egressrule[0])") pn("}") pn("") } if s.name == "CustomService" { pn("type CustomServiceParams struct {") pn(" p map[string]interface{}") pn("}") pn("") pn("func (p *CustomServiceParams) toURLValues() url.Values {") pn(" u := url.Values{}") pn(" if p.p == nil {") pn(" return u") pn(" }") pn("") pn(" for k, v := range p.p {") pn(" switch t := v.(type) {") pn(" case bool:") pn(" u.Set(k, strconv.FormatBool(t))") pn(" case int:") pn(" u.Set(k, strconv.Itoa(t))") pn(" case int64:") pn(" vv := strconv.FormatInt(t, 10)") pn(" u.Set(k, vv)") pn(" case string:") pn(" u.Set(k, t)") pn(" case []string:") pn(" u.Set(k, strings.Join(t, \", \"))") pn(" case map[string]string:") pn(" i := 0") pn(" for kk, vv := range t {") pn(" u.Set(fmt.Sprintf(\"%%s[%%d].%%s\", k, i, kk), vv)") pn(" i++") pn(" }") pn(" }") pn(" }") pn("") pn(" return u") pn("}") pn("") pn("func (p *CustomServiceParams) SetParam(param string, v interface{}) {") pn(" if p.p == nil {") pn(" p.p = make(map[string]interface{})") pn(" }") pn(" p.p[param] = v") pn(" return") pn("}") pn("") pn("func (s *CustomService) CustomRequest(api string, p *CustomServiceParams, result interface{}) error {") pn(" resp, err := s.cs.newRequest(api, p.toURLValues())") pn(" if err != nil {") pn(" return err") pn(" }") pn("") pn(" return json.Unmarshal(resp, result)") pn("}") } for _, a := range s.apis { s.generateParamType(a) s.generateToURLValuesFunc(a) s.generateParamSettersFunc(a) s.generateNewParamTypeFunc(a) s.generateHelperFuncs(a) s.generateNewAPICallFunc(a) s.generateResponseType(a) } clean, err := format.Source(buf.Bytes()) if err != nil { buf.WriteTo(os.Stdout) return buf.Bytes(), err } return clean, nil } func (s *service) generateParamType(a *API) { pn := s.pn pn("type %s struct {", capitalize(a.Name+"Params")) pn(" p map[string]interface{}") pn("}\n") return } func (s *service) generateToURLValuesFunc(a *API) { pn := s.pn pn("func (p *%s) toURLValues() url.Values {", capitalize(a.Name+"Params")) pn(" u := url.Values{}") pn(" if p.p == nil {") pn(" return u") pn(" }") for _, ap := range a.Params { pn(" if v, found := p.p[\"%s\"]; found {", ap.Name) s.generateConvertCode(a.Name, ap.Name, mapType(ap.Type)) pn(" }") } pn(" return u") pn("}") pn("") return } func (s *service) generateConvertCode(cmd, name, typ string) { pn := s.pn switch typ { case "string": pn("u.Set(\"%s\", v.(string))", name) case "int": pn("vv := strconv.Itoa(v.(int))") pn("u.Set(\"%s\", vv)", name) case "int64": pn("vv := strconv.FormatInt(v.(int64), 10)") pn("u.Set(\"%s\", vv)", name) case "bool": pn("vv := strconv.FormatBool(v.(bool))") pn("u.Set(\"%s\", vv)", name) case "[]string": pn("vv := strings.Join(v.([]string), \",\")") pn("u.Set(\"%s\", vv)", name) case "map[string]string": pn("m := v.(map[string]string)") pn("for i, k := range getSortedKeysFromMap(m) {") switch name { case "details": if detailsRequireKeyValue[cmd] { pn(" u.Set(fmt.Sprintf(\"%s[%%d].key\", i), k)", name) pn(" u.Set(fmt.Sprintf(\"%s[%%d].value\", i), m[k])", name) } else { pn(" u.Set(fmt.Sprintf(\"%s[%%d].%%s\", i, k), m[k])", name) } case "serviceproviderlist": pn(" u.Set(fmt.Sprintf(\"%s[%%d].service\", i), k)", name) pn(" u.Set(fmt.Sprintf(\"%s[%%d].provider\", i), m[k])", name) case "usersecuritygrouplist": pn(" u.Set(fmt.Sprintf(\"%s[%%d].account\", i), k)", name) pn(" u.Set(fmt.Sprintf(\"%s[%%d].group\", i), m[k])", name) default: pn(" u.Set(fmt.Sprintf(\"%s[%%d].key\", i), k)", name) pn(" u.Set(fmt.Sprintf(\"%s[%%d].value\", i), m[k])", name) } pn("}") } return } func (s *service) parseParamName(name string) string { if name != "type" { return name } return uncapitalize(strings.TrimSuffix(s.name, "Service")) + "Type" } func (s *service) generateParamSettersFunc(a *API) { pn := s.pn found := make(map[string]bool) for _, ap := range a.Params { if !found[ap.Name] { pn("func (p *%s) Set%s(v %s) {", capitalize(a.Name+"Params"), capitalize(ap.Name), mapType(ap.Type)) pn(" if p.p == nil {") pn(" p.p = make(map[string]interface{})") pn(" }") pn(" p.p[\"%s\"] = v", ap.Name) pn(" return") pn("}") pn("") found[ap.Name] = true } } return } func (s *service) generateNewParamTypeFunc(a *API) { p, pn := s.p, s.pn tn := capitalize(a.Name + "Params") rp := APIParams{} // Generate the function signature pn("// You should always use this function to get a new %s instance,", tn) pn("// as then you are sure you have configured all required params") p("func (s *%s) New%s(", s.name, tn) for _, ap := range a.Params { if ap.Required { rp = append(rp, ap) p("%s %s, ", s.parseParamName(ap.Name), mapType(ap.Type)) } } pn(") *%s {", tn) // Generate the function body pn(" p := &%s{}", tn) pn(" p.p = make(map[string]interface{})") sort.Sort(rp) for _, ap := range rp { pn(" p.p[\"%s\"] = %s", ap.Name, s.parseParamName(ap.Name)) } pn(" return p") pn("}") pn("") return } func (s *service) generateHelperFuncs(a *API) { p, pn := s.p, s.pn if strings.HasPrefix(a.Name, "list") { v, found := hasNameOrKeywordParamField(a.Params) if found && hasIDAndNameResponseField(a.Response) { ln := strings.TrimPrefix(a.Name, "list") // Check if ID is a required parameters and bail if so for _, ap := range a.Params { if ap.Required && ap.Name == "id" { return } } // Generate the function signature pn("// This is a courtesy helper function, which in some cases may not work as expected!") p("func (s *%s) Get%sID(%s string, ", s.name, parseSingular(ln), v) for _, ap := range a.Params { if ap.Required { p("%s %s, ", s.parseParamName(ap.Name), mapType(ap.Type)) } } if parseSingular(ln) == "Iso" { p("isofilter string, ") } if parseSingular(ln) == "Template" || parseSingular(ln) == "Iso" { p("zoneid string, ") } pn("opts ...OptionFunc) (string, int, error) {") // Generate the function body pn(" p := &List%sParams{}", ln) pn(" p.p = make(map[string]interface{})") pn("") pn(" p.p[\"%s\"] = %s", v, v) for _, ap := range a.Params { if ap.Required { pn(" p.p[\"%s\"] = %s", ap.Name, s.parseParamName(ap.Name)) } } if parseSingular(ln) == "Iso" { pn(" p.p[\"isofilter\"] = isofilter") } if parseSingular(ln) == "Template" || parseSingular(ln) == "Iso" { pn(" p.p[\"zoneid\"] = zoneid") } pn("") pn(" for _, fn := range append(s.cs.options, opts...) {") pn(" if err := fn(s.cs, p); err != nil {") pn(" return \"\", -1, err") pn(" }") pn(" }") pn("") pn(" l, err := s.List%s(p)", ln) pn(" if err != nil {") pn(" return \"\", -1, err") pn(" }") pn("") if ln == "AffinityGroups" { pn(" // This is needed because of a bug with the listAffinityGroup call. It reports the") pn(" // number of VirtualMachines in the groups as being the number of groups found.") pn(" l.Count = len(l.%s)", ln) pn("") } pn(" if l.Count == 0 {") pn(" return \"\", l.Count, fmt.Errorf(\"No match found for %%s: %%+v\", %s, l)", v) pn(" }") pn("") pn(" if l.Count == 1 {") pn(" return l.%s[0].Id, l.Count, nil", ln) pn(" }") pn("") pn(" if l.Count > 1 {") pn(" for _, v := range l.%s {", ln) pn(" if v.Name == %s {", v) pn(" return v.Id, l.Count, nil") pn(" }") pn(" }") pn(" }") pn(" return \"\", l.Count, fmt.Errorf(\"Could not find an exact match for %%s: %%+v\", %s, l)", v) pn("}\n") pn("") if hasIDParamField(a.Params) { // Generate the function signature pn("// This is a courtesy helper function, which in some cases may not work as expected!") p("func (s *%s) Get%sByName(name string, ", s.name, parseSingular(ln)) for _, ap := range a.Params { if ap.Required { p("%s %s, ", s.parseParamName(ap.Name), mapType(ap.Type)) } } if parseSingular(ln) == "Iso" { p("isofilter string, ") } if parseSingular(ln) == "Template" || parseSingular(ln) == "Iso" { p("zoneid string, ") } pn("opts ...OptionFunc) (*%s, int, error) {", parseSingular(ln)) // Generate the function body p(" id, count, err := s.Get%sID(name, ", parseSingular(ln)) for _, ap := range a.Params { if ap.Required { p("%s, ", s.parseParamName(ap.Name)) } } if parseSingular(ln) == "Iso" { p("isofilter, ") } if parseSingular(ln) == "Template" || parseSingular(ln) == "Iso" { p("zoneid, ") } pn("opts...)") pn(" if err != nil {") pn(" return nil, count, err") pn(" }") pn("") p(" r, count, err := s.Get%sByID(id, ", parseSingular(ln)) for _, ap := range a.Params { if ap.Required { p("%s, ", s.parseParamName(ap.Name)) } } pn("opts...)") pn(" if err != nil {") pn(" return nil, count, err") pn(" }") pn(" return r, count, nil") pn("}") pn("") } } if hasIDParamField(a.Params) { ln := strings.TrimPrefix(a.Name, "list") // Generate the function signature pn("// This is a courtesy helper function, which in some cases may not work as expected!") p("func (s *%s) Get%sByID(id string, ", s.name, parseSingular(ln)) for _, ap := range a.Params { if ap.Required && s.parseParamName(ap.Name) != "id" { p("%s %s, ", ap.Name, mapType(ap.Type)) } } if ln == "LoadBalancerRuleInstances" { pn("opts ...OptionFunc) (*VirtualMachine, int, error) {") } else { pn("opts ...OptionFunc) (*%s, int, error) {", parseSingular(ln)) } // Generate the function body pn(" p := &List%sParams{}", ln) pn(" p.p = make(map[string]interface{})") pn("") pn(" p.p[\"id\"] = id") for _, ap := range a.Params { if ap.Required && s.parseParamName(ap.Name) != "id" { pn(" p.p[\"%s\"] = %s", ap.Name, s.parseParamName(ap.Name)) } } pn("") pn(" for _, fn := range append(s.cs.options, opts...) {") pn(" if err := fn(s.cs, p); err != nil {") pn(" return nil, -1, err") pn(" }") pn(" }") pn("") pn(" l, err := s.List%s(p)", ln) pn(" if err != nil {") pn(" if strings.Contains(err.Error(), fmt.Sprintf(") pn(" \"Invalid parameter id value=%%s due to incorrect long value format, \"+") pn(" \"or entity does not exist\", id)) {") pn(" return nil, 0, fmt.Errorf(\"No match found for %%s: %%+v\", id, l)") pn(" }") pn(" return nil, -1, err") pn(" }") pn("") if ln == "AffinityGroups" { pn(" // This is needed because of a bug with the listAffinityGroup call. It reports the") pn(" // number of VirtualMachines in the groups as being the number of groups found.") pn(" l.Count = len(l.%s)", ln) pn("") } pn(" if l.Count == 0 {") pn(" return nil, l.Count, fmt.Errorf(\"No match found for %%s: %%+v\", id, l)") pn(" }") pn("") pn(" if l.Count == 1 {") pn(" return l.%s[0], l.Count, nil", ln) pn(" }") pn(" return nil, l.Count, fmt.Errorf(\"There is more then one result for %s UUID: %%s!\", id)", parseSingular(ln)) pn("}\n") pn("") } } return } func hasNameOrKeywordParamField(params APIParams) (v string, found bool) { for _, p := range params { if p.Name == "keyword" && mapType(p.Type) == "string" { v = "keyword" found = true } if p.Name == "name" && mapType(p.Type) == "string" { return "name", true } } return v, found } func hasIDParamField(params APIParams) bool { for _, p := range params { if p.Name == "id" && mapType(p.Type) == "string" { return true } } return false } func hasIDAndNameResponseField(resp APIResponses) bool { id := false name := false for _, r := range resp { if r.Name == "id" && mapType(r.Type) == "string" { id = true } if r.Name == "name" && mapType(r.Type) == "string" { name = true } } return id && name } func (s *service) generateNewAPICallFunc(a *API) { pn := s.pn n := capitalize(a.Name) // Generate the function signature pn("// %s", a.Description) pn("func (s *%s) %s(p *%s) (*%s, error) {", s.name, n, n+"Params", strings.TrimPrefix(n, "Configure")+"Response") // Generate the function body if n == "QueryAsyncJobResult" { pn(" var resp json.RawMessage") pn(" var err error") pn("") pn(" // We should be able to retry on failure as this call is idempotent") pn(" for i := 0; i < 3; i++ {") pn(" resp, err = s.cs.newRequest(\"%s\", p.toURLValues())", a.Name) pn(" if err == nil {") pn(" break") pn(" }") pn(" time.Sleep(500 * time.Millisecond)") pn(" }") } else { pn(" resp, err := s.cs.newRequest(\"%s\", p.toURLValues())", a.Name) } pn(" if err != nil {") pn(" return nil, err") pn(" }") pn("") switch n { case "CreateAccount", "CreateNetwork", "CreateNetworkOffering", "CreateSSHKeyPair", "CreateSecurityGroup", "CreateServiceOffering", "CreateUser", "GetVirtualMachineUserData", "RegisterSSHKeyPair", "RegisterUserKeys": pn(" if resp, err = getRawValue(resp); err != nil {") pn(" return nil, err") pn(" }") pn("") } if !a.Isasync && s.name == "FirewallService" { pn(" resp, err = convertFirewallServiceResponse(resp)") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn("") } pn(" var r %s", strings.TrimPrefix(n, "Configure")+"Response") pn(" if err := json.Unmarshal(resp, &r); err != nil {") pn(" return nil, err") pn(" }") pn("") if a.Isasync { pn(" // If we have a async client, we need to wait for the async result") pn(" if s.cs.async {") pn(" b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)") pn(" if err != nil {") pn(" if err == AsyncTimeoutErr {") pn(" return &r, err") pn(" }") pn(" return nil, err") pn(" }") pn("") if !isSuccessOnlyResponse(a.Response) { pn(" b, err = getRawValue(b)") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn("") } if s.name == "FirewallService" { pn(" b, err = convertFirewallServiceResponse(b)") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn("") } if n == "AuthorizeSecurityGroupIngress" { pn(" b, err = convertAuthorizeSecurityGroupIngressResponse(b)") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn("") } if n == "AuthorizeSecurityGroupEgress" { pn(" b, err = convertAuthorizeSecurityGroupEgressResponse(b)") pn(" if err != nil {") pn(" return nil, err") pn(" }") pn("") } pn(" if err := json.Unmarshal(b, &r); err != nil {") pn(" return nil, err") pn(" }") pn(" }") pn("") } pn(" return &r, nil") pn("}") pn("") } func isSuccessOnlyResponse(resp APIResponses) bool { success := false displaytext := false for _, r := range resp { if r.Name == "displaytext" { displaytext = true } if r.Name == "success" { success = true } } return displaytext && success } func (s *service) generateResponseType(a *API) { pn := s.pn tn := capitalize(strings.TrimPrefix(a.Name, "configure") + "Response") ln := capitalize(strings.TrimPrefix(a.Name, "list")) // If this is a 'list' response, we need an separate list struct. There seem to be other // types of responses that also need a separate list struct, so checking on exact matches // for those once. if strings.HasPrefix(a.Name, "list") || a.Name == "registerTemplate" { pn("type %s struct {", tn) pn(" Count int `json:\"count\"`") // This nasty check is for some specific response that do not behave consistent switch a.Name { case "listAsyncJobs": pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "asyncjobs") case "listEgressFirewallRules": pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "firewallrule") case "listLoadBalancerRuleInstances": pn(" LBRuleVMIDIPs []*%s `json:\"%s\"`", parseSingular(ln), "lbrulevmidip") pn(" LoadBalancerRuleInstances []*VirtualMachine `json:\"%s\"`", strings.ToLower(parseSingular(ln))) case "registerTemplate": pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "template") default: pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), strings.ToLower(parseSingular(ln))) } pn("}") pn("") tn = parseSingular(ln) } sort.Sort(a.Response) customMarshal := s.recusiveGenerateResponseType(tn, a.Response, a.Isasync) if customMarshal { pn("func (r *%s) UnmarshalJSON(b []byte) error {", tn) pn(" var m map[string]interface{}") pn(" err := json.Unmarshal(b, &m)") pn(" if err != nil {") pn(" return err") pn(" }") pn("") pn(" if success, ok := m[\"success\"].(string); ok {") pn(" m[\"success\"] = success == \"true\"") pn(" b, err = json.Marshal(m)") pn(" if err != nil {") pn(" return err") pn(" }") pn(" }") pn("") pn(" if ostypeid, ok := m[\"ostypeid\"].(float64); ok {") pn(" m[\"ostypeid\"] = strconv.Itoa(int(ostypeid))") pn(" b, err = json.Marshal(m)") pn(" if err != nil {") pn(" return err") pn(" }") pn(" }") pn("") pn(" type alias %s", tn) pn(" return json.Unmarshal(b, (*alias)(r))") pn("}") pn("") } } func parseSingular(n string) string { if strings.HasSuffix(n, "ies") { return strings.TrimSuffix(n, "ies") + "y" } if strings.HasSuffix(n, "sses") { return strings.TrimSuffix(n, "es") } return strings.TrimSuffix(n, "s") } func (s *service) recusiveGenerateResponseType(tn string, resp APIResponses, async bool) bool { pn := s.pn customMarshal := false found := make(map[string]bool) pn("type %s struct {", tn) for _, r := range resp { if r.Name == "" { continue } if r.Name == "secondaryip" { pn("%s []struct {", capitalize(r.Name)) pn(" Id string `json:\"id\"`") pn(" Ipaddress string `json:\"ipaddress\"`") pn("} `json:\"%s\"`", r.Name) continue } if r.Response != nil { sort.Sort(r.Response) typeName, create := getUniqueTypeName(tn, r.Name) pn("%s []%s `json:\"%s\"`", capitalize(r.Name), typeName, r.Name) if create { defer s.recusiveGenerateResponseType(typeName, r.Response, false) } } else { if !found[r.Name] { switch r.Name { case "success": // This case is because the response field is different for sync and async calls :( pn("%s bool `json:\"%s\"`", capitalize(r.Name), r.Name) if !async { customMarshal = true } case "ostypeid": // This case is needed for backwards compatibility. pn("%s string `json:\"%s\"`", capitalize(r.Name), r.Name) customMarshal = true default: pn("%s %s `json:\"%s\"`", capitalize(r.Name), mapType(r.Type), r.Name) } found[r.Name] = true } } } pn("}") pn("") return customMarshal } func getUniqueTypeName(prefix, name string) (string, bool) { // We have special cases for [in|e]gressrules, nics and tags as the exact // sames types are used used in multiple different locations. switch { case strings.HasSuffix(name, "gressrule"): name = "rule" case strings.HasSuffix(name, "nic"): prefix = "" name = "nic" case strings.HasSuffix(name, "tags"): prefix = "" name = "tags" } tn := prefix + capitalize(name) if !typeNames[tn] { typeNames[tn] = true return tn, true } // Return here as this means the type already exists. if name == "rule" || name == "nic" || name == "tags" { return tn, false } return getUniqueTypeName(prefix, name+"Internal") } func getAllServices(listApis string) (*allServices, []error, error) { // Get a map with all API info ai, err := getAPIInfo(listApis) if err != nil { return nil, nil, err } // Generate a complete set of services with their methods (APIs) as := &allServices{} errors := []error{} for sn, apis := range layout { typeNames[sn] = true s := &service{name: sn} for _, api := range apis { a, found := ai[api] if !found { errors = append(errors, &apiInfoNotFoundError{api}) continue } s.apis = append(s.apis, a) } for _, apis := range s.apis { sort.Sort(apis.Params) } as.services = append(as.services, s) } // Add an extra field to enable adding a custom service as.services = append(as.services, &service{name: "CustomService"}) sort.Sort(as.services) return as, errors, nil } func getAPIInfo(listApis string) (map[string]*API, error) { apis, err := ioutil.ReadFile(listApis) if err != nil { return nil, err } var ar struct { Count int `json:"count"` APIs []*API `json:"api"` } if err := json.Unmarshal(apis, &ar); err != nil { return nil, err } // Make a map of all retrieved APIs ai := make(map[string]*API) for _, api := range ar.APIs { ai[api.Name] = api } return ai, nil } func sourceDir() (string, error) { wd, err := os.Getwd() if err != nil { return "", err } outdir := path.Join(path.Dir(wd), pkg) if err := os.MkdirAll(outdir, 0755); err != nil { return "", fmt.Errorf("Failed to Mkdir %s: %v", outdir, err) } return outdir, nil } func mapType(t string) string { switch t { case "boolean": return "bool" case "short", "int", "integer": return "int" case "long": return "int64" case "float": return "float64" case "list": return "[]string" case "map": return "map[string]string" case "set": return "[]interface{}" case "responseobject": return "json.RawMessage" case "uservmresponse": // This is a really specific anomaly of the API return "*VirtualMachine" case "outofbandmanagementresponse": return "OutOfBandManagementResponse" default: return "string" } } func capitalize(s string) string { if s == "jobid" { return "JobID" } r := []rune(s) r[0] = unicode.ToUpper(r[0]) return string(r) } func uncapitalize(s string) string { r := []rune(s) r[0] = unicode.ToLower(r[0]) return string(r) } go-cloudstack-2.9.0/generate/layout.go000066400000000000000000000347141364073403100177310ustar00rootroot00000000000000// // Copyright 2018, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package main var layout = apiInfo{ "LoadBalancerService": { "addNetscalerLoadBalancer", "assignCertToLoadBalancer", "assignToGlobalLoadBalancerRule", "assignToLoadBalancerRule", "configureNetscalerLoadBalancer", "createGlobalLoadBalancerRule", "createLBHealthCheckPolicy", "createLBStickinessPolicy", "createLoadBalancer", "createLoadBalancerRule", "deleteGlobalLoadBalancerRule", "deleteLBHealthCheckPolicy", "deleteLBStickinessPolicy", "deleteLoadBalancer", "deleteLoadBalancerRule", "deleteNetscalerLoadBalancer", "deleteSslCert", "listGlobalLoadBalancerRules", "listLBHealthCheckPolicies", "listLBStickinessPolicies", "listLoadBalancerRuleInstances", "listLoadBalancerRules", "listLoadBalancers", "listNetscalerLoadBalancers", "listSslCerts", "removeCertFromLoadBalancer", "removeFromGlobalLoadBalancerRule", "removeFromLoadBalancerRule", "updateGlobalLoadBalancerRule", "updateLBHealthCheckPolicy", "updateLBStickinessPolicy", "updateLoadBalancer", "updateLoadBalancerRule", "uploadSslCert", }, "NetworkService": { "addNetworkServiceProvider", "addOpenDaylightController", "createNetwork", "createPhysicalNetwork", "createServiceInstance", "createStorageNetworkIpRange", "dedicatePublicIpRange", "deleteNetwork", "deleteNetworkServiceProvider", "deleteOpenDaylightController", "deletePhysicalNetwork", "deleteStorageNetworkIpRange", "listNetscalerLoadBalancerNetworks", "listNetworkIsolationMethods", "listNetworkServiceProviders", "listNetworks", "listNiciraNvpDeviceNetworks", "listOpenDaylightControllers", "listPaloAltoFirewallNetworks", "listPhysicalNetworks", "listStorageNetworkIpRange", "listSupportedNetworkServices", "releasePublicIpRange", "restartNetwork", "updateNetwork", "updateNetworkServiceProvider", "updatePhysicalNetwork", "updateStorageNetworkIpRange", }, "VirtualMachineService": { "addNicToVirtualMachine", "assignVirtualMachine", "changeServiceForVirtualMachine", "cleanVMReservations", "deployVirtualMachine", "destroyVirtualMachine", "expungeVirtualMachine", "getVMPassword", "listVirtualMachines", "migrateVirtualMachine", "migrateVirtualMachineWithVolume", "rebootVirtualMachine", "recoverVirtualMachine", "removeNicFromVirtualMachine", "resetPasswordForVirtualMachine", "restoreVirtualMachine", "scaleVirtualMachine", "startVirtualMachine", "stopVirtualMachine", "updateDefaultNicForVirtualMachine", "updateVirtualMachine", }, "VPNService": { "addVpnUser", "createRemoteAccessVpn", "createVpnConnection", "createVpnCustomerGateway", "createVpnGateway", "deleteRemoteAccessVpn", "deleteVpnConnection", "deleteVpnCustomerGateway", "deleteVpnGateway", "listRemoteAccessVpns", "listVpnConnections", "listVpnCustomerGateways", "listVpnGateways", "listVpnUsers", "removeVpnUser", "resetVpnConnection", "updateRemoteAccessVpn", "updateVpnConnection", "updateVpnCustomerGateway", "updateVpnGateway", }, "FirewallService": { "addPaloAltoFirewall", "configurePaloAltoFirewall", "createEgressFirewallRule", "createFirewallRule", "createPortForwardingRule", "deleteEgressFirewallRule", "deleteFirewallRule", "deletePaloAltoFirewall", "deletePortForwardingRule", "listEgressFirewallRules", "listFirewallRules", "listPaloAltoFirewalls", "listPortForwardingRules", "updateEgressFirewallRule", "updateFirewallRule", "updatePortForwardingRule", }, "AutoScaleService": { "createAutoScalePolicy", "createAutoScaleVmGroup", "createAutoScaleVmProfile", "createCondition", "createCounter", "deleteAutoScalePolicy", "deleteAutoScaleVmGroup", "deleteAutoScaleVmProfile", "deleteCondition", "deleteCounter", "disableAutoScaleVmGroup", "enableAutoScaleVmGroup", "listAutoScalePolicies", "listAutoScaleVmGroups", "listAutoScaleVmProfiles", "listConditions", "listCounters", "updateAutoScalePolicy", "updateAutoScaleVmGroup", "updateAutoScaleVmProfile", }, "HostService": { "addBaremetalHost", "addGloboDnsHost", "addHost", "addSecondaryStorage", "cancelHostMaintenance", "dedicateHost", "deleteHost", "disableOutOfBandManagementForHost", "enableOutOfBandManagementForHost", "findHostsForMigration", "listDedicatedHosts", "listHostTags", "listHosts", "prepareHostForMaintenance", "reconnectHost", "releaseDedicatedHost", "releaseHostReservation", "updateHost", "updateHostPassword", }, "VolumeService": { "attachVolume", "createVolume", "deleteVolume", "detachVolume", "extractVolume", "getPathForVolume", "getSolidFireVolumeSize", "getUploadParamsForVolume", "getVolumeiScsiName", "listVolumes", "migrateVolume", "resizeVolume", "updateVolume", "uploadVolume", }, "VPCService": { "createPrivateGateway", "createStaticRoute", "createVPC", "createVPCOffering", "deletePrivateGateway", "deleteStaticRoute", "deleteVPC", "deleteVPCOffering", "listPrivateGateways", "listStaticRoutes", "listVPCOfferings", "listVPCs", "restartVPC", "updateVPC", "updateVPCOffering", }, "TemplateService": { "copyTemplate", "createTemplate", "deleteTemplate", "extractTemplate", "getUploadParamsForTemplate", "listTemplatePermissions", "listTemplates", "prepareTemplate", "registerTemplate", "updateTemplate", "updateTemplatePermissions", "upgradeRouterTemplate", }, "AccountService": { "addAccountToProject", "createAccount", "deleteAccount", "deleteAccountFromProject", "disableAccount", "enableAccount", "getSolidFireAccountId", "listAccounts", "listProjectAccounts", "lockAccount", "markDefaultZoneForAccount", "updateAccount", }, "ZoneService": { "createZone", "dedicateZone", "deleteZone", "disableOutOfBandManagementForZone", "enableOutOfBandManagementForZone", "listDedicatedZones", "listZones", "releaseDedicatedZone", "updateZone", }, "UsageService": { "addTrafficMonitor", "addTrafficType", "deleteTrafficMonitor", "deleteTrafficType", "generateUsageRecords", "listTrafficMonitors", "listTrafficTypeImplementors", "listTrafficTypes", "listUsageRecords", "listUsageTypes", "removeRawUsageRecords", "updateTrafficType", }, "SnapshotService": { "createSnapshot", "createSnapshotPolicy", "createVMSnapshot", "deleteSnapshot", "deleteSnapshotPolicies", "deleteVMSnapshot", "listSnapshotPolicies", "listSnapshots", "listVMSnapshot", "revertSnapshot", "revertToVMSnapshot", "updateSnapshotPolicy", }, "UserService": { "createUser", "deleteUser", "disableUser", "enableUser", "getUser", "getVirtualMachineUserData", "listUsers", "lockUser", "registerUserKeys", "updateUser", }, "LDAPService": { "addLdapConfiguration", "deleteLdapConfiguration", "importLdapUsers", "ldapConfig", "ldapCreateAccount", "ldapRemove", "linkDomainToLdap", "listLdapConfigurations", "listLdapUsers", "searchLdap", }, "ISOService": { "attachIso", "copyIso", "deleteIso", "detachIso", "extractIso", "listIsoPermissions", "listIsos", "registerIso", "updateIso", "updateIsoPermissions", }, "RouterService": { "changeServiceForRouter", "configureVirtualRouterElement", "createVirtualRouterElement", "destroyRouter", "listRouters", "listVirtualRouterElements", "rebootRouter", "startRouter", "stopRouter", }, "ProjectService": { "activateProject", "createProject", "deleteProject", "deleteProjectInvitation", "listProjectInvitations", "listProjects", "suspendProject", "updateProject", "updateProjectInvitation", }, "PoolService": { "createStoragePool", "deleteStoragePool", "findStoragePoolsForMigration", "listStoragePools", "updateStoragePool", }, "NetworkACLService": { "createNetworkACL", "createNetworkACLList", "deleteNetworkACL", "deleteNetworkACLList", "listNetworkACLLists", "listNetworkACLs", "replaceNetworkACLList", "updateNetworkACLItem", "updateNetworkACLList", }, "GuestOSService": { "addGuestOs", "addGuestOsMapping", "listGuestOsMapping", "listOsCategories", "listOsTypes", "removeGuestOs", "removeGuestOsMapping", "updateGuestOs", "updateGuestOsMapping", }, "ClusterService": { "addCluster", "dedicateCluster", "deleteCluster", "disableOutOfBandManagementForCluster", "enableOutOfBandManagementForCluster", "listClusters", "listDedicatedClusters", "releaseDedicatedCluster", "updateCluster", }, "BaremetalService": { "addBaremetalDhcp", "addBaremetalPxeKickStartServer", "addBaremetalPxePingServer", "addBaremetalRct", "deleteBaremetalRct", "listBaremetalDhcp", "listBaremetalPxeServers", "listBaremetalRct", "notifyBaremetalProvisionDone", }, "SystemVMService": { "changeServiceForSystemVm", "destroySystemVm", "listSystemVms", "migrateSystemVm", "rebootSystemVm", "scaleSystemVm", "startSystemVm", "stopSystemVm", }, "RoleService": { "createRole", "createRolePermission", "deleteRole", "deleteRolePermission", "listRolePermissions", "listRoles", "updateRole", "updateRolePermission", }, "ImageStoreService": { "addImageStore", "addImageStoreS3", "createSecondaryStagingStore", "deleteImageStore", "deleteSecondaryStagingStore", "listImageStores", "listSecondaryStagingStores", "updateCloudToUseObjectStore", }, "AuthenticationService": { "login", "logout", }, "SecurityGroupService": { "authorizeSecurityGroupEgress", "authorizeSecurityGroupIngress", "createSecurityGroup", "deleteSecurityGroup", "listSecurityGroups", "revokeSecurityGroupEgress", "revokeSecurityGroupIngress", }, "QuotaService": { "quotaIsEnabled", }, "PodService": { "createPod", "dedicatePod", "deletePod", "listDedicatedPods", "listPods", "releaseDedicatedPod", "updatePod", }, "VLANService": { "createVlanIpRange", "dedicateGuestVlanRange", "deleteVlanIpRange", "listDedicatedGuestVlanRanges", "listVlanIpRanges", "releaseDedicatedGuestVlanRange", }, "UCSService": { "addUcsManager", "associateUcsProfileToBlade", "deleteUcsManager", "listUcsBlades", "listUcsManagers", "listUcsProfiles", }, "InternalLBService": { "configureInternalLoadBalancerElement", "createInternalLoadBalancerElement", "listInternalLoadBalancerElements", "listInternalLoadBalancerVMs", "startInternalLoadBalancerVM", "stopInternalLoadBalancerVM", }, "SSHService": { "createSSHKeyPair", "deleteSSHKeyPair", "listSSHKeyPairs", "registerSSHKeyPair", "resetSSHKeyForVirtualMachine", }, "NATService": { "createIpForwardingRule", "deleteIpForwardingRule", "disableStaticNat", "enableStaticNat", "listIpForwardingRules", }, "LimitService": { "getApiLimit", "listResourceLimits", "resetApiLimit", "updateResourceCount", "updateResourceLimit", }, "DomainService": { "createDomain", "deleteDomain", "listDomainChildren", "listDomains", "updateDomain", }, "AffinityGroupService": { "createAffinityGroup", "deleteAffinityGroup", "listAffinityGroupTypes", "listAffinityGroups", "updateVMAffinityGroup", }, "VMGroupService": { "createInstanceGroup", "deleteInstanceGroup", "listInstanceGroups", "updateInstanceGroup", }, "ServiceOfferingService": { "createServiceOffering", "deleteServiceOffering", "listServiceOfferings", "updateServiceOffering", }, "ResourcetagsService": { "createTags", "deleteTags", "listStorageTags", "listTags", }, "ResourcemetadataService": { "addResourceDetail", "getVolumeSnapshotDetails", "listResourceDetails", "removeResourceDetail", }, "RegionService": { "addRegion", "listRegions", "removeRegion", "updateRegion", }, "NuageVSPService": { "addNuageVspDevice", "deleteNuageVspDevice", "listNuageVspDevices", "updateNuageVspDevice", }, "NicService": { "addIpToNic", "listNics", "removeIpFromNic", "updateVmNicIp", }, "NetworkOfferingService": { "createNetworkOffering", "deleteNetworkOffering", "listNetworkOfferings", "updateNetworkOffering", }, "EventService": { "archiveEvents", "deleteEvents", "listEventTypes", "listEvents", }, "DiskOfferingService": { "createDiskOffering", "deleteDiskOffering", "listDiskOfferings", "updateDiskOffering", }, "ConfigurationService": { "listCapabilities", "listConfigurations", "listDeploymentPlanners", "updateConfiguration", }, "BrocadeVCSService": { "addBrocadeVcsDevice", "deleteBrocadeVcsDevice", "listBrocadeVcsDeviceNetworks", "listBrocadeVcsDevices", }, "AlertService": { "archiveAlerts", "deleteAlerts", "generateAlert", "listAlerts", }, "AddressService": { "associateIpAddress", "disassociateIpAddress", "listPublicIpAddresses", "updateIpAddress", }, "StoragePoolService": { "cancelStorageMaintenance", "enableStorageMaintenance", "listStorageProviders", }, "PortableIPService": { "createPortableIpRange", "deletePortableIpRange", "listPortableIpRanges", }, "OutofbandManagementService": { "changeOutOfBandManagementPassword", "configureOutOfBandManagement", "issueOutOfBandManagementPowerAction", }, "NiciraNVPService": { "addNiciraNvpDevice", "deleteNiciraNvpDevice", "listNiciraNvpDevices", }, "NetworkDeviceService": { "addNetworkDevice", "deleteNetworkDevice", "listNetworkDevice", }, "HypervisorService": { "listHypervisorCapabilities", "listHypervisors", "updateHypervisorCapabilities", }, "BigSwitchBCFService": { "addBigSwitchBcfDevice", "deleteBigSwitchBcfDevice", "listBigSwitchBcfDevices", }, "SwiftService": { "addSwift", "listSwifts", }, "OvsElementService": { "configureOvsElement", "listOvsElements", }, "AsyncjobService": { "listAsyncJobs", "queryAsyncJobResult", }, "StratosphereSSPService": { "addStratosphereSsp", "deleteStratosphereSsp", }, "SystemCapacityService": { "listCapacity", }, "CloudIdentifierService": { "getCloudIdentifier", }, "CertificateService": { "uploadCustomCertificate", }, "APIDiscoveryService": { "listApis", }, } go-cloudstack-2.9.0/generate/listApis.json000066400000000000000000205017511364073403100205520ustar00rootroot00000000000000{ "api": [ { "name": "createVPCOffering", "description": "Creates VPC offering", "isasync": true, "related": "updateVPCOffering,listVPCOfferings", "params": [ { "name": "servicecapabilitylist", "description": "desired service capabilities as part of vpc offering", "type": "map", "length": 255, "required": false, "since": "4.4" }, { "name": "displaytext", "description": "the display text of the vpc offering", "type": "string", "length": 255, "required": true }, { "name": "serviceproviderlist", "description": "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network", "type": "map", "length": 255, "required": false }, { "name": "supportedservices", "description": "services supported by the vpc offering", "type": "list", "length": 255, "required": true }, { "name": "serviceofferingid", "description": "the ID of the service offering for the VPC router appliance", "type": "uuid", "length": 255, "required": false, "related": "createServiceOffering,listServiceOfferings,updateServiceOffering" }, { "name": "name", "description": "the name of the vpc offering", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "created", "description": "the date this vpc offering was created", "type": "date" }, { }, { "name": "id", "description": "the id of the vpc offering", "type": "string" }, { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "name", "description": "the provider name", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" } ] }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "name", "description": "the capability name", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" } ] }, { "name": "distributedvpcrouter", "description": " indicates if the vpc offering supports distributed router for one-hop forwarding", "type": "boolean" }, { "name": "supportsregionLevelvpc", "description": " indicated if the offering can support region level vpc", "type": "boolean" }, { "name": "state", "description": "state of the vpc offering. Can be Disabled/Enabled", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "isdefault", "description": "true if vpc offering is default, false otherwise", "type": "boolean" }, { "name": "name", "description": "the name of the vpc offering", "type": "string" }, { "name": "displaytext", "description": "an alternate display text of the vpc offering.", "type": "string" } ] }, { "name": "createPod", "description": "Creates a new Pod.", "isasync": false, "related": "listPods,createManagementNetworkIpRange,updatePod", "params": [ { "name": "netmask", "description": "the netmask for the Pod", "type": "string", "length": 255, "required": true }, { "name": "allocationstate", "description": "Allocation state of this Pod for allocation of new resources", "type": "string", "length": 255, "required": false }, { "name": "startip", "description": "the starting IP address for the Pod", "type": "string", "length": 255, "required": true }, { "name": "name", "description": "the name of the Pod", "type": "string", "length": 255, "required": true }, { "name": "endip", "description": "the ending IP address for the Pod", "type": "string", "length": 255, "required": false }, { "name": "gateway", "description": "the gateway for the Pod", "type": "string", "length": 255, "required": true }, { "name": "zoneid", "description": "the Zone ID in which the Pod will be created", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { "name": "forsystemvms", "description": "indicates if range is dedicated for CPVM and SSVM", "type": "list" }, { "name": "zonename", "description": "the Zone name of the Pod", "type": "string" }, { }, { "name": "gateway", "description": "the gateway of the Pod", "type": "string" }, { "name": "name", "description": "the name of the Pod", "type": "string" }, { "name": "vlanid", "description": "indicates Vlan ID for the range", "type": "list" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "capacity", "description": "the capacity of the Pod", "type": "list", "response": [ { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "name", "description": "the capacity name", "type": "string" }, { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" } ] }, { "name": "zoneid", "description": "the Zone ID of the Pod", "type": "string" }, { }, { "name": "id", "description": "the ID of the Pod", "type": "string" }, { "name": "startip", "description": "the starting IP for the Pod", "type": "list" }, { "name": "netmask", "description": "the netmask of the Pod", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "allocationstate", "description": "the allocation state of the Pod", "type": "string" }, { "name": "endip", "description": "the ending IP for the Pod", "type": "list" } ] }, { "name": "ldapCreateAccount", "description": "Creates an account from an LDAP user", "since": "4.2.0", "isasync": false, "related": "enableAccount,createAccount,markDefaultZoneForAccount,lockAccount,updateAccount,listAccounts,disableAccount,listAccounts", "params": [ { "name": "roleid", "description": "Creates the account under the specified role.", "type": "uuid", "length": 255, "required": false, "related": "updateRole,createRole,listRoles" }, { "name": "domainid", "description": "Creates the user under the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "userid", "description": "User UUID, required for adding account from external provisioning system", "type": "string", "length": 255, "required": false }, { "name": "timezone", "description": "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.", "type": "string", "length": 255, "required": false }, { "name": "networkdomain", "description": "Network domain for the account's networks", "type": "string", "length": 255, "required": false }, { "name": "username", "description": "Unique username.", "type": "string", "length": 255, "required": true }, { "name": "accounttype", "description": "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin", "type": "short", "length": 255, "required": false }, { "name": "accountdetails", "description": "details for account used to store specific parameters", "type": "map", "length": 255, "required": false }, { "name": "account", "description": "Creates the user under the specified account. If no account is specified, the username will be used as the account name.", "type": "string", "length": 255, "required": false }, { "name": "accountid", "description": "Account UUID, required for adding account from external provisioning system", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "memorytotal", "description": "the total memory (in MB) owned by account", "type": "long" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this account", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this account", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the account can own", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this account", "type": "string" }, { "name": "id", "description": "the id of the account", "type": "string" }, { "name": "projecttotal", "description": "the total number of projects being administrated by this account", "type": "long" }, { "name": "name", "description": "the name of the account", "type": "string" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this account", "type": "long" }, { "name": "roletype", "description": "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this account", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "accounttype", "description": "account type (admin, domain-admin, user)", "type": "short" }, { "name": "memorylimit", "description": "the total memory (in MB) the account can own", "type": "string" }, { "name": "volumetotal", "description": "the total volume being used by this account", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this account", "type": "long" }, { "name": "iscleanuprequired", "description": "true if the account requires cleanup", "type": "boolean" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this account", "type": "long" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this account", "type": "string" }, { "name": "defaultzoneid", "description": "the default zone of the account", "type": "string" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this account to acquire", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this account", "type": "string" }, { "name": "iplimit", "description": "the total number of public ip addresses this account can acquire", "type": "string" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this account", "type": "integer" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this account", "type": "string" }, { "name": "user", "description": "the list of users associated with account", "type": "list", "response": [ { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" } ] }, { "name": "vpclimit", "description": "the total number of vpcs the account can own", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "volumelimit", "description": "the total volume which can be used by this account", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the account can own", "type": "string" }, { }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this account", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by account", "type": "float" }, { "name": "networktotal", "description": "the total number of networks owned by account", "type": "long" }, { "name": "sentbytes", "description": "the total number of network traffic bytes sent", "type": "long" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by account", "type": "long" }, { "name": "projectlimit", "description": "the total number of projects the account can own", "type": "string" }, { "name": "domainid", "description": "id of the Domain the account belongs too", "type": "string" }, { "name": "receivedbytes", "description": "the total number of network traffic bytes received", "type": "long" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this account", "type": "integer" }, { "name": "cputotal", "description": "the total number of cpu cores owned by account", "type": "long" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this account", "type": "string" }, { }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this account", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the account can own", "type": "string" }, { "name": "domain", "description": "name of the Domain the account belongs too", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this account to acquire", "type": "string" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this account", "type": "string" }, { "name": "isdefault", "description": "true if account is default, false otherwise", "type": "boolean" }, { "name": "groups", "description": "the list of acl groups that account belongs to", "type": "list" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by account", "type": "long" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this account", "type": "string" }, { "name": "state", "description": "the state of the account", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the account can own", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this account", "type": "long" }, { "name": "accountdetails", "description": "details for the account", "type": "map" } ] }, { "name": "removeRawUsageRecords", "description": "Safely removes raw records from cloud_usage table", "since": "4.6.0", "isasync": false, "params": [ { "name": "interval", "description": "Specify the number of days (greater than zero) to remove records that are older than those number of days from today. For example, specifying 10 would result in removing all the records created before 10 days from today", "type": "integer", "length": 255, "required": true } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "copyIso", "description": "Copies an iso from one zone to another.", "isasync": true, "related": "updateTemplate,listIsos,createTemplate,listTemplates,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates", "params": [ { "name": "destzoneid", "description": "ID of the zone the template is being copied to.", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "sourcezoneid", "description": "ID of the zone the template is currently hosted on. If not specified and template is cross-zone, then we will sync this template to region wide image store.", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "destzoneids", "description": "A list of IDs of the zones that the template needs to be copied to.Specify this list if the template needs to copied to multiple zones in one go. Do not specify destzoneid and destzoneids together, however one of them is required.", "type": "list", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "id", "description": "Template ID.", "type": "uuid", "length": 255, "required": true, "related": "updateTemplate,listIsos,createTemplate,listTemplates,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,copyIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates" } ], "response": [ { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "project", "description": "the project name of the template", "type": "string" }, { "name": "crossZones", "description": "true if the template is managed across all Zones, false otherwise", "type": "boolean" }, { "name": "ostypeid", "description": "the ID of the OS type for this template.", "type": "string" }, { "name": "isextractable", "description": "true if the template is extractable, false otherwise", "type": "boolean" }, { "name": "zoneid", "description": "the ID of the zone for this template", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "account", "description": "the account name to which the template belongs", "type": "string" }, { "name": "hostname", "description": "the name of the secondary storage host for the template", "type": "string" }, { "name": "accountid", "description": "the account id to which the template belongs", "type": "string" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "sourcetemplateid", "description": "the template ID of the parent template if present", "type": "string" }, { "name": "size", "description": "the size of the template", "type": "long" }, { "name": "checksum", "description": "checksum of the template", "type": "string" }, { "name": "templatetype", "description": "the type of the template", "type": "string" }, { "name": "requireshvm", "description": "true if template requires HVM enabled, false otherwise", "type": "boolean" }, { "name": "parenttemplateid", "description": "if Datadisk template, then id of the root disk template this template belongs to", "type": "string" }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "format", "description": "the format of the template.", "type": "imageformat" }, { "name": "directdownload", "description": "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage", "type": "boolean" }, { "name": "zonename", "description": "the name of the zone for this template", "type": "string" }, { "name": "name", "description": "the template name", "type": "string" }, { "name": "created", "description": "the date this template was created", "type": "date" }, { }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean" }, { "name": "hostid", "description": "the ID of the secondary storage host for the template", "type": "string" }, { "name": "childtemplates", "description": "if root disk template, then ids of the datas disk templates this template owns", "type": "set" }, { "name": "removed", "description": "the date this template was removed", "type": "date" }, { "name": "isready", "description": "true if the template is ready to be deployed from, false otherwise.", "type": "boolean" }, { "name": "status", "description": "the status of the template", "type": "string" }, { "name": "passwordenabled", "description": "true if the reset password feature is enabled, false otherwise", "type": "boolean" }, { "name": "domain", "description": "the name of the domain to which the template belongs", "type": "string" }, { "name": "details", "description": "additional key/value details tied with template", "type": "map" }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean" }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean" }, { "name": "displaytext", "description": "the template display text", "type": "string" }, { "name": "sshkeyenabled", "description": "true if template is sshkey enabled, false otherwise", "type": "boolean" }, { "name": "physicalsize", "description": "the physical size of the template", "type": "long" }, { "name": "templatetag", "description": "the tag of this template", "type": "string" }, { "name": "projectid", "description": "the project id of the template", "type": "string" }, { "name": "ostypename", "description": "the name of the OS type for this template.", "type": "string" }, { }, { "name": "bits", "description": "the processor bit size", "type": "int" } ] }, { "name": "deleteAutoScaleVmProfile", "description": "Deletes a autoscale vm profile.", "isasync": true, "params": [ { "name": "id", "description": "the ID of the autoscale profile", "type": "uuid", "length": 255, "required": true, "related": "updateAutoScaleVmProfile,listAutoScaleVmProfiles,createAutoScaleVmProfile" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "provisionCertificate", "description": "Issues and propagates client certificate on a connected host/agent using configured CA plugin", "since": "4.11.0", "isasync": true, "params": [ { "name": "hostid", "description": "The host/agent uuid to which the certificate has to be provisioned (issued and propagated)", "type": "uuid", "length": 255, "required": true, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,listHosts,addBaremetalHost,updateHost" }, { "name": "provider", "description": "Name of the CA service provider, otherwise the default configured provider plugin will be used", "type": "string", "length": 255, "required": false }, { "name": "reconnect", "description": "Whether to attempt reconnection with host/agent after successful deployment of certificate. When option is not provided, configured global setting is used", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "listVirtualMachinesMetrics", "description": "Lists VM metrics", "since": "4.9.3", "isasync": false, "related": "", "params": [ { "name": "isoid", "description": "list vms by iso", "type": "uuid", "length": 255, "required": false }, { "name": "groupid", "description": "the group ID", "type": "uuid", "length": 255, "required": false, "related": "createInstanceGroup,listInstanceGroups,updateInstanceGroup" }, { "name": "id", "description": "the ID of the virtual machine", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,changeServiceForVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,restoreVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "affinitygroupid", "description": "list vms by affinity group", "type": "uuid", "length": 255, "required": false, "related": "createAffinityGroup,listAffinityGroups" }, { "name": "hypervisor", "description": "the target hypervisor for the template", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "storageid", "description": "the storage ID where vm's volumes belong to", "type": "uuid", "length": 255, "required": false, "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,updateStoragePool,cancelStorageMaintenance,createStoragePool" }, { "name": "vpcid", "description": "list vms by vpc", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,updateVPC,listVPCs,createVPC,restartVPC,createVPC,updateVPC" }, { "name": "displayvm", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "keypair", "description": "list vms by ssh keypair name", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "storageid", "description": "the storage ID where vm's volumes belong to", "type": "uuid", "length": 255, "required": false, "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,updateStoragePool,cancelStorageMaintenance,createStoragePool" }, { "name": "hostid", "description": "the host ID", "type": "uuid", "length": 255, "required": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,listHosts,addBaremetalHost,updateHost" }, { "name": "userid", "description": "the user ID that created the VM and is under the account that owns the VM", "type": "uuid", "length": 255, "required": false, "related": "updateUser,lockUser,getUser,enableUser,listUsers,createUser,disableUser" }, { "name": "state", "description": "state of the virtual machine. Possible values are: Running, Stopped, Present, Destroyed, Expunged. Present is used for the state equal not destroyed.", "type": "string", "length": 255, "required": false }, { "name": "networkid", "description": "list by network id", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "hostid", "description": "the host ID", "type": "uuid", "length": 255, "required": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,listHosts,addBaremetalHost,updateHost" }, { "name": "zoneid", "description": "the availability zone ID", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "podid", "description": "the pod ID", "type": "uuid", "length": 255, "required": false, "related": "listPods,createManagementNetworkIpRange,updatePod" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "ids", "description": "the IDs of the virtual machines, mutually exclusive with id", "type": "list", "length": 255, "required": false, "since": "4.4", "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,changeServiceForVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,restoreVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "name", "description": "name of the virtual machine (a substring match is made against the parameter value, data for all matching VMs will be returned)", "type": "string", "length": 255, "required": false }, { "name": "podid", "description": "the pod ID", "type": "uuid", "length": 255, "required": false, "related": "listPods,createManagementNetworkIpRange,updatePod" }, { "name": "templateid", "description": "list vms by template", "type": "uuid", "length": 255, "required": false, "related": "updateTemplate,listIsos,createTemplate,listTemplates,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "forvirtualnetwork", "description": "list by network type; true if need to list vms using Virtual Network, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "details", "description": "comma separated list of host details requested, value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, diskoff, iso, volume, min, affgrp]. If no parameter is passed in, the details will be defaulted to all", "type": "list", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "serviceofferingid", "description": "list by the service offering", "type": "uuid", "length": 255, "required": false, "since": "4.4", "related": "createServiceOffering,listServiceOfferings,updateServiceOffering" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" } ], "response": [ { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "diskiopstotal", "description": "the total disk iops", "type": "long" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "networkwrite", "description": "network write in MiB", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" } ] }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" } ] }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "ipaddress", "description": "the VM's primary IP address", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "memorytotal", "description": "the total memory capacity in GiB", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "cputotal", "description": "the total cpu capacity in Ghz", "type": "string" }, { "name": "diskwrite", "description": "disk write in MiB", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "networkread", "description": "network read in MiB", "type": "string" }, { "name": "diskread", "description": "disk read in MiB", "type": "string" }, { }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "description", "description": "the description of the affinity group", "type": "string" } ] }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" } ] }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" } ] }, { "name": "deleteStoragePool", "description": "Deletes a storage pool.", "isasync": false, "params": [ { "name": "forced", "description": "Force destroy storage pool (force expunge volumes in Destroyed state as a part of pool removal)", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "Storage pool id", "type": "uuid", "length": 255, "required": true, "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,updateStoragePool,cancelStorageMaintenance,createStoragePool" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "listHosts", "description": "Lists hosts.", "isasync": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost,updateHost", "params": [ { "name": "outofbandmanagementpowerstate", "description": "list hosts by its out-of-band management interface's power state. Its value can be one of [On, Off, Unknown]", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "outofbandmanagementenabled", "description": "list hosts for which out-of-band management is enabled", "type": "boolean", "length": 255, "required": false }, { "name": "hypervisor", "description": "hypervisor type of host: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator", "type": "string", "length": 255, "required": false }, { "name": "details", "description": "comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]", "type": "list", "length": 255, "required": false }, { "name": "hahost", "description": "if true, list only hosts dedicated to HA", "type": "boolean", "length": 255, "required": false }, { "name": "state", "description": "the state of the host", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "type", "description": "the host type", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the id of the host", "type": "uuid", "length": 255, "required": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,listHosts,addBaremetalHost,updateHost" }, { "name": "resourcestate", "description": "list hosts by resource state. Resource state represents current state determined by admin of host, value can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]", "type": "string", "length": 255, "required": false }, { "name": "podid", "description": "the Pod ID for the host", "type": "uuid", "length": 255, "required": false, "related": "listPods,createManagementNetworkIpRange,updatePod" }, { "name": "virtualmachineid", "description": "lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,changeServiceForVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,restoreVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "name", "description": "the name of the host", "type": "string", "length": 255, "required": false }, { "name": "clusterid", "description": "lists hosts existing in particular cluster", "type": "uuid", "length": 255, "required": false, "related": "addCluster,listClusters,updateCluster" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID for the host", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { "name": "clusterid", "description": "the cluster ID of the host", "type": "string" }, { "name": "username", "description": "the admin that annotated this host", "type": "string" }, { "name": "version", "description": "the host version", "type": "string" }, { "name": "cpusockets", "description": "the number of CPU sockets on the host", "type": "integer" }, { "name": "clustertype", "description": "the cluster type of the cluster that host belongs to", "type": "string" }, { "name": "oscategoryname", "description": "the OS category name of the host", "type": "string" }, { "name": "podid", "description": "the Pod ID of the host", "type": "string" }, { "name": "podname", "description": "the Pod name of the host", "type": "string" }, { "name": "memoryallocated", "description": "the amount of the host's memory currently allocated", "type": "long" }, { "name": "clustername", "description": "the cluster name of the host", "type": "string" }, { "name": "capabilities", "description": "capabilities of the host", "type": "string" }, { "name": "annotation", "description": "the last annotation set on this host by an admin", "type": "string" }, { "name": "disconnected", "description": "true if the host is disconnected. False otherwise.", "type": "date" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "islocalstorageactive", "description": "true if local storage is active, false otherwise", "type": "boolean" }, { "name": "gpugroup", "description": "GPU cards present in the host", "type": "list", "response": [ { "name": "vgpu", "description": "the list of enabled vGPUs", "type": "list", "response": [ { "name": "maxresolutiony", "description": "Maximum Y resolution per display", "type": "long" }, { "name": "maxheads", "description": "Maximum displays per user", "type": "long" }, { "name": "maxresolutionx", "description": "Maximum X resolution per display", "type": "long" }, { "name": "maxvgpuperpgpu", "description": "Maximum no. of vgpu per gpu card (pgpu)", "type": "long" }, { "name": "maxcapacity", "description": "Maximum vgpu can be created with this vgpu type on the given gpu group", "type": "long" }, { "name": "remainingcapacity", "description": "Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type", "type": "long" }, { "name": "vgputype", "description": "Model Name of vGPU", "type": "string" }, { "name": "videoram", "description": "Video RAM for this vGPU type", "type": "long" } ] }, { "name": "gpugroupname", "description": "GPU cards present in the host", "type": "string" } ] }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { }, { "name": "state", "description": "the state of the host", "type": "status" }, { "name": "networkkbsread", "description": "the incoming network traffic on the host", "type": "long" }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "cpuallocated", "description": "the amount of the host's CPU currently allocated", "type": "string" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "name", "description": "the name of the host", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the host", "type": "string" }, { "name": "cpuspeed", "description": "the CPU speed of the host", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "zonename", "description": "the Zone name of the host", "type": "string" }, { "name": "hosttags", "description": "comma-separated list of tags for the host", "type": "string" }, { "name": "averageload", "description": "the cpu average load on the host", "type": "long" }, { "name": "hasenoughcapacity", "description": "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise", "type": "boolean" }, { "name": "cpuused", "description": "the amount of the host's CPU currently used", "type": "string" }, { "name": "memorytotal", "description": "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning", "type": "long" }, { "name": "type", "description": "the host type", "type": "type" }, { "name": "events", "description": "events available for the host", "type": "string" }, { "name": "memoryused", "description": "the amount of the host's memory currently used", "type": "long" }, { "name": "memorywithoverprovisioning", "description": "the amount of the host's memory after applying the mem.overprovisioning.factor", "type": "string" }, { "name": "cpunumber", "description": "the CPU number of the host", "type": "integer" }, { "name": "id", "description": "the ID of the host", "type": "string" }, { "name": "disksizetotal", "description": "the total disk size of the host", "type": "long" }, { "name": "ipaddress", "description": "the IP address of the host", "type": "string" }, { "name": "lastpinged", "description": "the date and time the host was last pinged", "type": "date" }, { "name": "suitableformigration", "description": "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise", "type": "boolean" }, { "name": "hahost", "description": "true if the host is Ha host (dedicated to vms started by HA process; false otherwise", "type": "boolean" }, { "name": "hypervisor", "description": "the host hypervisor", "type": "hypervisortype" }, { "name": "outofbandmanagement", "description": "the host out-of-band management information", "type": "outofbandmanagementresponse" }, { "name": "oscategoryid", "description": "the OS category ID of the host", "type": "string" }, { "name": "details", "description": "Host details in key/value pairs.", "type": "map" }, { "name": "managementserverid", "description": "the management server ID of the host", "type": "long" }, { "name": "cpuwithoverprovisioning", "description": "the amount of the host's CPU after applying the cpu.overprovisioning.factor ", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "resourcestate", "description": "the resource state of the host", "type": "string" }, { "name": "lastannotated", "description": "the last time this host was annotated", "type": "date" }, { "name": "hostha", "description": "the host HA information information", "type": "hostharesponse" } ] }, { "name": "updateStoragePool", "description": "Updates a storage pool.", "since": "3.0.0", "isasync": false, "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool", "params": [ { "name": "id", "description": "the Id of the storage pool", "type": "uuid", "length": 255, "required": true, "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,updateStoragePool,cancelStorageMaintenance,createStoragePool" }, { "name": "capacityiops", "description": "IOPS CloudStack can provision from this storage pool", "type": "long", "length": 255, "required": false }, { "name": "enabled", "description": "false to disable the pool for allocation of new volumes, true to enable it back.", "type": "boolean", "length": 255, "required": false }, { "name": "tags", "description": "comma-separated list of tags for the storage pool", "type": "list", "length": 255, "required": false }, { "name": "capacitybytes", "description": "bytes CloudStack can provision from this storage pool", "type": "long", "length": 255, "required": false } ], "response": [ { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { }, { "name": "state", "description": "the state of the storage pool", "type": "storagepoolstatus" }, { "name": "name", "description": "the name of the storage pool", "type": "string" }, { "name": "created", "description": "the date and time the storage pool was created", "type": "date" }, { "name": "disksizetotal", "description": "the total disk size of the storage pool", "type": "long" }, { "name": "overprovisionfactor", "description": "the overprovisionfactor for the storage pool", "type": "string" }, { "name": "clustername", "description": "the name of the cluster for the storage pool", "type": "string" }, { "name": "suitableformigration", "description": "true if this pool is suitable to migrate a volume, false otherwise", "type": "boolean" }, { "name": "disksizeused", "description": "the host's currently used disk size", "type": "long" }, { "name": "zoneid", "description": "the Zone ID of the storage pool", "type": "string" }, { }, { "name": "zonename", "description": "the Zone name of the storage pool", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "path", "description": "the storage pool path", "type": "string" }, { "name": "id", "description": "the ID of the storage pool", "type": "string" }, { "name": "clusterid", "description": "the ID of the cluster for the storage pool", "type": "string" }, { "name": "tags", "description": "the tags for the storage pool", "type": "string" }, { "name": "allocatediops", "description": "total min IOPS currently in use by volumes", "type": "long" }, { "name": "storagecapabilities", "description": "the storage pool capabilities", "type": "map" }, { "name": "capacityiops", "description": "IOPS CloudStack can provision from this storage pool", "type": "long" }, { "name": "podname", "description": "the Pod name of the storage pool", "type": "string" }, { "name": "provider", "description": "Storage provider for this pool", "type": "string" }, { "name": "podid", "description": "the Pod ID of the storage pool", "type": "string" }, { "name": "scope", "description": "the scope of the storage pool", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor type of the storage pool", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "type", "description": "the storage pool type", "type": "string" }, { "name": "ipaddress", "description": "the IP address of the storage pool", "type": "string" } ] }, { "name": "rebootSystemVm", "description": "Reboots a system VM.", "isasync": true, "related": "stopSystemVm,migrateSystemVm,changeServiceForSystemVm,startSystemVm,destroySystemVm,listSystemVms,scaleSystemVm", "params": [ { "name": "id", "description": "The ID of the system virtual machine", "type": "uuid", "length": 255, "required": true, "related": "stopSystemVm,rebootSystemVm,migrateSystemVm,changeServiceForSystemVm,startSystemVm,destroySystemVm,listSystemVms,scaleSystemVm" } ], "response": [ { "name": "name", "description": "the name of the system VM", "type": "string" }, { "name": "podid", "description": "the Pod ID for the system VM", "type": "string" }, { }, { "name": "privateip", "description": "the private IP address for the system VM", "type": "string" }, { "name": "gateway", "description": "the gateway for the system VM", "type": "string" }, { "name": "dns1", "description": "the first DNS for the system VM", "type": "string" }, { "name": "created", "description": "the date and time the system VM was created", "type": "date" }, { "name": "publicmacaddress", "description": "the public MAC address for the system VM", "type": "string" }, { "name": "hostname", "description": "the hostname for the system VM", "type": "string" }, { "name": "systemvmtype", "description": "the system VM type", "type": "string" }, { "name": "jobstatus", "description": "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "integer" }, { "name": "zonename", "description": "the Zone name for the system VM", "type": "string" }, { "name": "publicvlan", "description": "public vlan range", "type": "list" }, { "name": "publicnetmask", "description": "the public netmask for the system VM", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "state", "description": "the state of the system VM", "type": "string" }, { }, { "name": "dns2", "description": "the second DNS for the system VM", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the system vm", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the system VM", "type": "string" }, { "name": "activeviewersessions", "description": "the number of active console sessions for the console proxy system vm", "type": "integer" }, { "name": "jobid", "description": "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the system VM", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the system vm", "type": "string" }, { "name": "id", "description": "the ID of the system VM", "type": "string" }, { "name": "guestvlan", "description": "guest vlan range", "type": "string" }, { "name": "privatemacaddress", "description": "the private MAC address for the system VM", "type": "string" }, { "name": "publicip", "description": "the public IP address for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "templateid", "description": "the template ID for the system VM", "type": "string" }, { "name": "hostid", "description": "the host ID for the system VM", "type": "string" }, { "name": "privatenetmask", "description": "the private netmask for the system VM", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the system vm", "type": "string" } ] }, { "name": "importLdapUsers", "description": "Import LDAP users", "since": "4.3.0", "isasync": false, "related": "searchLdap,listLdapUsers", "params": [ { "name": "account", "description": "Creates the user under the specified account. If no account is specified, the username will be used as the account name.", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "timezone", "description": "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "group", "description": "Specifies the group name from which the ldap users are to be imported. If no group is specified, all the users will be imported.", "type": "string", "length": 255, "required": false }, { "name": "accounttype", "description": "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin", "type": "short", "length": 255, "required": false }, { "name": "roleid", "description": "Creates the account under the specified role.", "type": "uuid", "length": 255, "required": false, "related": "updateRole,createRole,listRoles" }, { "name": "accountdetails", "description": "details for account used to store specific parameters", "type": "map", "length": 255, "required": false }, { "name": "domainid", "description": "Specifies the domain to which the ldap users are to be imported. If no domain is specified, a domain will created using group parameter. If the group is also not specified, a domain name based on the OU information will be created. If no OU hierarchy exists, will be defaulted to ROOT domain", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" } ], "response": [ { }, { "name": "firstname", "description": "The user's firstname", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "email", "description": "The user's email", "type": "string" }, { "name": "principal", "description": "The user's principle", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domain", "description": "The user's domain", "type": "string" }, { "name": "username", "description": "The user's username", "type": "string" }, { }, { "name": "lastname", "description": "The user's lastname", "type": "string" } ] }, { "name": "listDedicatedZones", "description": "List dedicated zones.", "isasync": false, "related": "dedicateZone", "params": [ { "name": "domainid", "description": "the ID of the domain associated with the zone", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "zoneid", "description": "the ID of the Zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "the name of the account associated with the zone. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "affinitygroupid", "description": "list dedicated zones by affinity group", "type": "uuid", "length": 255, "required": false, "related": "createAffinityGroup,listAffinityGroups" } ], "response": [ { }, { "name": "accountid", "description": "the Account Id to which the Zone is dedicated", "type": "string" }, { "name": "id", "description": "the ID of the dedicated resource", "type": "string" }, { }, { "name": "affinitygroupid", "description": "the Dedication Affinity Group ID of the zone", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "zonename", "description": "the Name of the Zone", "type": "string" }, { "name": "zoneid", "description": "the ID of the Zone", "type": "string" }, { "name": "domainid", "description": "the domain ID to which the Zone is dedicated", "type": "string" } ] }, { "name": "listNetworks", "description": "Lists all available networks.", "isasync": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "restartrequired", "description": "list networks by restartRequired", "type": "boolean", "length": 255, "required": false }, { "name": "canusefordeploy", "description": "list networks available for VM deployment", "type": "boolean", "length": 255, "required": false }, { "name": "vpcid", "description": "List networks by VPC", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,updateVPC,listVPCs,createVPC,restartVPC,createVPC,updateVPC" }, { "name": "forvpc", "description": "the network belongs to VPC", "type": "boolean", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "list networks by physical network id", "type": "uuid", "length": 255, "required": false, "related": "updatePhysicalNetwork,createPhysicalNetwork,listPhysicalNetworks" }, { "name": "supportedservices", "description": "list networks supporting certain services", "type": "list", "length": 255, "required": false }, { "name": "id", "description": "list networks by ID", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "specifyipranges", "description": "true if need to list only networks which support specifying IP ranges", "type": "boolean", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "traffictype", "description": "type of the traffic", "type": "string", "length": 255, "required": false }, { "name": "displaynetwork", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "type", "description": "the type of the network. Supported values are: isolated and shared", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the zone ID of the network", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "acltype", "description": "list networks by ACL (access control list) type. Supported values are account and domain", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "name", "description": "the service name", "type": "string" }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" } ] }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" } ] } ] }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listElastistorPool", "description": "Lists the pools of elastistor", "isasync": false, "related": "", "params": [ { "name": "id", "description": "the ID of the Pool", "type": "long", "length": 255, "required": false } ], "response": [ { "name": "gateway", "description": "default gateway of the pool", "type": "string" }, { "name": "maxiops", "description": "available iops of the pool", "type": "long" }, { }, { "name": "name", "description": "the name of the storage pool", "type": "string" }, { "name": "state", "description": "the state of the storage pool", "type": "string" }, { "name": "size", "description": "the current available space of the pool", "type": "long" }, { "name": "controllerid", "description": "controller of the pool", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "id", "description": "the ID of the storage pool", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "updateFirewallRule", "description": "Updates firewall rule ", "since": "4.4", "isasync": true, "related": "updateEgressFirewallRule,listFirewallRules,createEgressFirewallRule,listEgressFirewallRules,createFirewallRule", "params": [ { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "the ID of the firewall rule", "type": "uuid", "length": 255, "required": true, "related": "createIpForwardingRule,listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "protocol", "description": "the protocol of the firewall rule", "type": "string" }, { }, { "name": "networkid", "description": "the network id of the firewall rule", "type": "string" }, { "name": "endport", "description": "the ending port of firewall rule's port range", "type": "integer" }, { "name": "startport", "description": "the starting port of firewall rule's port range", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "ipaddress", "description": "the public ip address for the firewall rule", "type": "string" }, { "name": "destcidrlist", "description": "the cidr list to forward traffic to", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer" }, { "name": "id", "description": "the ID of the firewall rule", "type": "string" }, { "name": "ipaddressid", "description": "the public ip address id for the firewall rule", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" } ] }, { "name": "quotaIsEnabled", "description": "Return true if the plugin is enabled", "since": "4.7.0", "isasync": false, "related": "", "params": [ ], "response": [ { "name": "isenabled", "description": "is quota service enabled", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { } ] }, { "name": "listHypervisors", "description": "List hypervisors", "isasync": false, "related": "", "params": [ { "name": "zoneid", "description": "the zone id for listing hypervisors.", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { "name": "name", "description": "Hypervisor name", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "deleteAccountFromProject", "description": "Deletes account from the project", "since": "3.0.0", "isasync": true, "params": [ { "name": "account", "description": "name of the account to be removed from the project", "type": "string", "length": 255, "required": true }, { "name": "projectid", "description": "ID of the project to remove the account from", "type": "uuid", "length": 255, "required": true, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "updateGuestOs", "description": "Updates the information about Guest OS", "since": "4.4.0", "isasync": true, "related": "addGuestOs,listOsTypes", "params": [ { "name": "id", "description": "UUID of the Guest OS", "type": "uuid", "length": 255, "required": true, "related": "addGuestOs,updateGuestOs,listOsTypes" }, { "name": "details", "description": "Map of (key/value pairs)", "type": "map", "length": 255, "required": true }, { "name": "osdisplayname", "description": "Unique display name for Guest OS", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "description", "description": "the name/description of the OS type", "type": "string" }, { "name": "oscategoryid", "description": "the ID of the OS category", "type": "string" }, { "name": "isuserdefined", "description": "is the guest OS user defined", "type": "boolean" }, { "name": "id", "description": "the ID of the OS type", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "updateResourceLimit", "description": "Updates resource limits for an account or domain.", "isasync": false, "related": "listResourceLimits", "params": [ { "name": "resourcetype", "description": "Type of resource to update. Values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 and 11. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create. 3 - Snapshot. Number of snapshots a user can create. 4 - Template. Number of templates that a user can register/create. 6 - Network. Number of guest network a user can create. 7 - VPC. Number of VPC a user can create. 8 - CPU. Total number of CPU cores a user can use. 9 - Memory. Total Memory (in MB) a user can use. 10 - PrimaryStorage. Total primary storage space (in GiB) a user can use. 11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. ", "type": "integer", "length": 255, "required": true }, { "name": "account", "description": "Update resource for a specified account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "Update resource limits for project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "domainid", "description": "Update resource limits for all accounts in specified domain. If used with the account parameter, updates resource limits for a specified account in specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "max", "description": " Maximum resource limit.", "type": "long", "length": 255, "required": false } ], "response": [ { "name": "projectid", "description": "the project id of the resource limit", "type": "string" }, { }, { }, { "name": "account", "description": "the account of the resource limit", "type": "string" }, { "name": "max", "description": "the maximum number of the resource. A -1 means the resource currently has no limit.", "type": "long" }, { "name": "domainid", "description": "the domain ID of the resource limit", "type": "string" }, { "name": "resourcetypename", "description": "resource type name. Values include user_vm, public_ip, volume, snapshot, template, project, network, vpc, cpu, memory, primary_storage, secondary_storage.", "type": "string" }, { "name": "resourcetype", "description": "resource type. Values include 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.", "type": "string" }, { "name": "domain", "description": "the domain name of the resource limit", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "project", "description": "the project name of the resource limit", "type": "string" } ] }, { "name": "deleteStaticRoute", "description": "Deletes a static route", "isasync": true, "params": [ { "name": "id", "description": "the ID of the static route", "type": "uuid", "length": 255, "required": true, "related": "listStaticRoutes,createStaticRoute" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listHostsMetrics", "description": "Lists hosts metrics", "since": "4.9.3", "isasync": false, "related": "", "params": [ { "name": "state", "description": "the state of the host", "type": "string", "length": 255, "required": false }, { "name": "hahost", "description": "if true, list only hosts dedicated to HA", "type": "boolean", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,changeServiceForVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,restoreVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "id", "description": "the id of the host", "type": "uuid", "length": 255, "required": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost,updateHost" }, { "name": "outofbandmanagementenabled", "description": "list hosts for which out-of-band management is enabled", "type": "boolean", "length": 255, "required": false }, { "name": "type", "description": "the host type", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "the name of the host", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID for the host", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "podid", "description": "the Pod ID for the host", "type": "uuid", "length": 255, "required": false, "related": "listPods,createManagementNetworkIpRange,updatePod" }, { "name": "resourcestate", "description": "list hosts by resource state. Resource state represents current state determined by admin of host, value can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]", "type": "string", "length": 255, "required": false }, { "name": "outofbandmanagementpowerstate", "description": "list hosts by its out-of-band management interface's power state. Its value can be one of [On, Off, Unknown]", "type": "string", "length": 255, "required": false }, { "name": "clusterid", "description": "lists hosts existing in particular cluster", "type": "uuid", "length": 255, "required": false, "related": "addCluster,listClusters,updateCluster" }, { "name": "details", "description": "comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]", "type": "list", "length": 255, "required": false }, { "name": "hypervisor", "description": "hypervisor type of host: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "averageload", "description": "the cpu average load on the host", "type": "long" }, { "name": "cpuspeed", "description": "the CPU speed of the host", "type": "long" }, { "name": "memorytotal", "description": "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning", "type": "long" }, { "name": "zoneid", "description": "the Zone ID of the host", "type": "string" }, { "name": "capabilities", "description": "capabilities of the host", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "memoryallocatedthreshold", "description": "memory allocated notification threshold exceeded", "type": "boolean" }, { "name": "memoryusedgb", "description": "the total cpu used in GiB", "type": "string" }, { "name": "cpuallocated", "description": "the amount of the host's CPU currently allocated", "type": "string" }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "clustername", "description": "the cluster name of the host", "type": "string" }, { "name": "id", "description": "the ID of the host", "type": "string" }, { "name": "events", "description": "events available for the host", "type": "string" }, { "name": "podid", "description": "the Pod ID of the host", "type": "string" }, { "name": "zonename", "description": "the Zone name of the host", "type": "string" }, { "name": "outofbandmanagement", "description": "the host out-of-band management information", "type": "outofbandmanagementresponse" }, { "name": "memorythreshold", "description": "memory usage notification threshold exceeded", "type": "boolean" }, { "name": "memoryallocated", "description": "the amount of the host's memory currently allocated", "type": "long" }, { "name": "suitableformigration", "description": "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise", "type": "boolean" }, { "name": "powerstate", "description": "out-of-band management power state", "type": "powerstate" }, { "name": "cpuusedghz", "description": "the total cpu used in Ghz", "type": "string" }, { "name": "networkwrite", "description": "network write in GiB", "type": "string" }, { "name": "disconnected", "description": "true if the host is disconnected. False otherwise.", "type": "date" }, { }, { "name": "details", "description": "Host details in key/value pairs.", "type": "map" }, { }, { "name": "type", "description": "the host type", "type": "type" }, { "name": "resourcestate", "description": "the resource state of the host", "type": "string" }, { "name": "oscategoryid", "description": "the OS category ID of the host", "type": "string" }, { "name": "clustertype", "description": "the cluster type of the cluster that host belongs to", "type": "string" }, { "name": "cputhreshold", "description": "cpu usage notification threshold exceeded", "type": "boolean" }, { "name": "cpunumber", "description": "the CPU number of the host", "type": "integer" }, { "name": "hostha", "description": "the host HA information information", "type": "hostharesponse" }, { "name": "clusterid", "description": "the cluster ID of the host", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "memoryallocateddisablethreshold", "description": "memory allocated disable threshold exceeded", "type": "boolean" }, { "name": "memorywithoverprovisioning", "description": "the amount of the host's memory after applying the mem.overprovisioning.factor", "type": "string" }, { "name": "hahost", "description": "true if the host is Ha host (dedicated to vms started by HA process; false otherwise", "type": "boolean" }, { "name": "cpuallocatedghz", "description": "the total cpu allocated in Ghz", "type": "string" }, { "name": "cpuused", "description": "the amount of the host's CPU currently used", "type": "string" }, { "name": "hypervisor", "description": "the host hypervisor", "type": "hypervisortype" }, { "name": "hasenoughcapacity", "description": "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise", "type": "boolean" }, { "name": "networkread", "description": "network read in GiB", "type": "string" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "cpusockets", "description": "the number of CPU sockets on the host", "type": "integer" }, { "name": "oscategoryname", "description": "the OS category name of the host", "type": "string" }, { "name": "gpugroup", "description": "GPU cards present in the host", "type": "list", "response": [ { "name": "gpugroupname", "description": "GPU cards present in the host", "type": "string" }, { "name": "vgpu", "description": "the list of enabled vGPUs", "type": "list", "response": [ { "name": "remainingcapacity", "description": "Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type", "type": "long" }, { "name": "vgputype", "description": "Model Name of vGPU", "type": "string" }, { "name": "maxheads", "description": "Maximum displays per user", "type": "long" }, { "name": "maxresolutionx", "description": "Maximum X resolution per display", "type": "long" }, { "name": "maxresolutiony", "description": "Maximum Y resolution per display", "type": "long" }, { "name": "videoram", "description": "Video RAM for this vGPU type", "type": "long" }, { "name": "maxcapacity", "description": "Maximum vgpu can be created with this vgpu type on the given gpu group", "type": "long" }, { "name": "maxvgpuperpgpu", "description": "Maximum no. of vgpu per gpu card (pgpu)", "type": "long" } ] } ] }, { "name": "memorytotalgb", "description": "the total cpu capacity in GiB", "type": "string" }, { "name": "hosttags", "description": "comma-separated list of tags for the host", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "memorydisablethreshold", "description": "memory usage disable threshold exceeded", "type": "boolean" }, { "name": "version", "description": "the host version", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the host", "type": "long" }, { "name": "cpuwithoverprovisioning", "description": "the amount of the host's CPU after applying the cpu.overprovisioning.factor ", "type": "string" }, { "name": "lastannotated", "description": "the last time this host was annotated", "type": "date" }, { "name": "cputotalghz", "description": "the total cpu capacity in Ghz", "type": "string" }, { "name": "state", "description": "the state of the host", "type": "status" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "managementserverid", "description": "the management server ID of the host", "type": "long" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "cpudisablethreshold", "description": "cpu usage disable threshold exceeded", "type": "boolean" }, { "name": "ipaddress", "description": "the IP address of the host", "type": "string" }, { "name": "lastpinged", "description": "the date and time the host was last pinged", "type": "date" }, { "name": "cpuallocateddisablethreshold", "description": "cpu allocated disable threshold exceeded", "type": "boolean" }, { "name": "podname", "description": "the Pod name of the host", "type": "string" }, { "name": "islocalstorageactive", "description": "true if local storage is active, false otherwise", "type": "boolean" }, { "name": "disksizetotal", "description": "the total disk size of the host", "type": "long" }, { "name": "cpuallocatedthreshold", "description": "cpu allocated notification threshold exceeded", "type": "boolean" }, { "name": "memoryallocatedgb", "description": "the total cpu allocated in GiB", "type": "string" }, { "name": "name", "description": "the name of the host", "type": "string" }, { "name": "instances", "description": "instances on the host", "type": "string" }, { "name": "memoryused", "description": "the amount of the host's memory currently used", "type": "long" }, { "name": "annotation", "description": "the last annotation set on this host by an admin", "type": "string" }, { "name": "username", "description": "the admin that annotated this host", "type": "string" } ] }, { "name": "releaseDedicatedPod", "description": "Release the dedication for the pod", "isasync": true, "params": [ { "name": "podid", "description": "the ID of the Pod", "type": "uuid", "length": 255, "required": true, "related": "listPods,createManagementNetworkIpRange,updatePod" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "listAffinityGroups", "description": "Lists affinity groups", "isasync": false, "related": "createAffinityGroup", "params": [ { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "lists affinity groups by virtual machine ID", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,changeServiceForVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,restoreVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "name", "description": "lists affinity groups by name", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "list the affinity group by the ID provided", "type": "uuid", "length": 255, "required": false, "related": "createAffinityGroup,listAffinityGroups" }, { "name": "type", "description": "lists affinity groups by type", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" } ] }, { "name": "registerSSHKeyPair", "description": "Register a public key in a keypair under a certain name", "isasync": false, "related": "listSSHKeyPairs", "params": [ { "name": "name", "description": "Name of the keypair", "type": "string", "length": 255, "required": true }, { "name": "publickey", "description": "Public key material of the keypair", "type": "string", "length": 5120, "required": true }, { "name": "projectid", "description": "an optional project for the ssh key", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "domainid", "description": "an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "account", "description": "an optional account for the ssh key. Must be used with domainId.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "fingerprint", "description": "Fingerprint of the public key", "type": "string" }, { "name": "domain", "description": "the domain name of the keypair owner", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "Name of the keypair", "type": "string" }, { "name": "account", "description": "the owner of the keypair", "type": "string" }, { }, { "name": "domainid", "description": "the domain id of the keypair owner", "type": "string" } ] }, { "name": "deleteRemoteAccessVpn", "description": "Destroys a l2tp/ipsec remote access vpn", "isasync": true, "params": [ { "name": "publicipid", "description": "public ip address id of the vpn server", "type": "uuid", "length": 255, "required": true, "related": "restartNetwork,updateIpAddress,listPublicIpAddresses,associateIpAddress,associateIpAddress,listPublicIpAddresses" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { } ] }, { "name": "updateNetworkACLList", "description": "Updates network ACL list", "since": "4.4", "isasync": true, "params": [ { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "fordisplay", "description": "an optional field, whether to the display the list to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "the ID of the network ACL", "type": "uuid", "length": 255, "required": true, "related": "createNetworkACLList,listNetworkACLLists" }, { "name": "description", "description": "Description of the network ACL list", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "Name of the network ACL list", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "deleteNiciraNvpDevice", "description": " delete a nicira nvp device", "isasync": true, "params": [ { "name": "nvpdeviceid", "description": "Nicira device ID", "type": "uuid", "length": 255, "required": true, "related": "addNiciraNvpDevice,listNiciraNvpDevices" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "restoreVirtualMachine", "description": "Restore a VM to original template/ISO or new template/ISO", "since": "3.0.0", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,changeServiceForVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "virtualmachineid", "description": "Virtual Machine ID", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,changeServiceForVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,restoreVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "templateid", "description": "an optional template Id to restore vm from the new template. This can be an ISO id in case of restore vm deployed using ISO", "type": "uuid", "length": 255, "required": false, "related": "updateTemplate,listIsos,createTemplate,listTemplates,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates" } ], "response": [ { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" } ] }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" } ] }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" } ] }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" } ] }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" } ] }, { "name": "deleteEvents", "description": "Delete one or more events.", "isasync": false, "params": [ { "name": "startdate", "description": "start date range to delete events (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")", "type": "date", "length": 255, "required": false }, { "name": "ids", "description": "the IDs of the events", "type": "list", "length": 255, "required": false, "related": "listEvents" }, { "name": "enddate", "description": "end date range to delete events (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")", "type": "date", "length": 255, "required": false }, { "name": "type", "description": "delete by event type", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "getVolumeSnapshotDetails", "description": "Get Volume Snapshot Details", "isasync": false, "related": "getVolumeiScsiName", "params": [ { "name": "snapshotid", "description": "CloudStack Snapshot UUID", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "volumeiScsiName", "description": "Volume iSCSI Name", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "listUcsBlades", "description": "List ucs blades", "isasync": false, "related": "associateUcsProfileToBlade", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "ucsmanagerid", "description": "ucs manager id", "type": "uuid", "length": 255, "required": true, "related": "listUcsManagers,addUcsManager" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "id", "description": "ucs blade id", "type": "string" }, { "name": "profiledn", "description": "associated ucs profile dn", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "ucsmanagerid", "description": "ucs manager id", "type": "string" }, { "name": "bladedn", "description": "ucs blade dn", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "hostid", "description": "cloudstack host id this blade associates to", "type": "string" } ] }, { "name": "notifyBaremetalProvisionDone", "description": "Notify provision has been done on a host. This api is for baremetal virtual router service, not for end user", "isasync": true, "params": [ { "name": "mac", "description": "mac of the nic used for provision", "type": "object", "length": 255, "required": true } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "deleteIso", "description": "Deletes an ISO file.", "isasync": true, "params": [ { "name": "id", "description": "the ID of the ISO file", "type": "uuid", "length": 255, "required": true, "related": "updateTemplate,listIsos,createTemplate,listTemplates,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "zoneid", "description": "the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "updateHost", "description": "Updates a host.", "isasync": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost", "params": [ { "name": "url", "description": "the new uri for the secondary storage: nfs://host/path", "type": "string", "length": 255, "required": false }, { "name": "allocationstate", "description": "Change resource state of host, valid values are [Enable, Disable]. Operation may failed if host in states not allowing Enable/Disable", "type": "string", "length": 255, "required": false }, { "name": "hosttags", "description": "list of tags to be added to the host", "type": "list", "length": 255, "required": false }, { "name": "id", "description": "the ID of the host to update", "type": "uuid", "length": 255, "required": true, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost,updateHost" }, { "name": "oscategoryid", "description": "the id of Os category to update the host with", "type": "uuid", "length": 255, "required": false, "related": "listOsCategories" }, { "name": "annotation", "description": "Add an annotation to this host", "type": "string", "length": 255, "required": false, "since": "4.11" } ], "response": [ { "name": "zoneid", "description": "the Zone ID of the host", "type": "string" }, { "name": "podname", "description": "the Pod name of the host", "type": "string" }, { "name": "clustername", "description": "the cluster name of the host", "type": "string" }, { "name": "details", "description": "Host details in key/value pairs.", "type": "map" }, { "name": "oscategoryid", "description": "the OS category ID of the host", "type": "string" }, { "name": "cpusockets", "description": "the number of CPU sockets on the host", "type": "integer" }, { "name": "ipaddress", "description": "the IP address of the host", "type": "string" }, { "name": "podid", "description": "the Pod ID of the host", "type": "string" }, { "name": "annotation", "description": "the last annotation set on this host by an admin", "type": "string" }, { "name": "hostha", "description": "the host HA information information", "type": "hostharesponse" }, { "name": "clusterid", "description": "the cluster ID of the host", "type": "string" }, { "name": "oscategoryname", "description": "the OS category name of the host", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "the name of the host", "type": "string" }, { "name": "lastannotated", "description": "the last time this host was annotated", "type": "date" }, { "name": "version", "description": "the host version", "type": "string" }, { "name": "cpuwithoverprovisioning", "description": "the amount of the host's CPU after applying the cpu.overprovisioning.factor ", "type": "string" }, { "name": "cpunumber", "description": "the CPU number of the host", "type": "integer" }, { "name": "clustertype", "description": "the cluster type of the cluster that host belongs to", "type": "string" }, { "name": "hahost", "description": "true if the host is Ha host (dedicated to vms started by HA process; false otherwise", "type": "boolean" }, { "name": "memorywithoverprovisioning", "description": "the amount of the host's memory after applying the mem.overprovisioning.factor", "type": "string" }, { "name": "cpuused", "description": "the amount of the host's CPU currently used", "type": "string" }, { "name": "memoryused", "description": "the amount of the host's memory currently used", "type": "long" }, { "name": "id", "description": "the ID of the host", "type": "string" }, { "name": "state", "description": "the state of the host", "type": "status" }, { "name": "hasenoughcapacity", "description": "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise", "type": "boolean" }, { "name": "hypervisor", "description": "the host hypervisor", "type": "hypervisortype" }, { "name": "memoryallocated", "description": "the amount of the host's memory currently allocated", "type": "long" }, { "name": "capabilities", "description": "capabilities of the host", "type": "string" }, { "name": "resourcestate", "description": "the resource state of the host", "type": "string" }, { "name": "averageload", "description": "the cpu average load on the host", "type": "long" }, { "name": "cpuallocated", "description": "the amount of the host's CPU currently allocated", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "events", "description": "events available for the host", "type": "string" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "zonename", "description": "the Zone name of the host", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "managementserverid", "description": "the management server ID of the host", "type": "long" }, { "name": "cpuspeed", "description": "the CPU speed of the host", "type": "long" }, { "name": "memorytotal", "description": "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning", "type": "long" }, { "name": "disconnected", "description": "true if the host is disconnected. False otherwise.", "type": "date" }, { "name": "outofbandmanagement", "description": "the host out-of-band management information", "type": "outofbandmanagementresponse" }, { "name": "type", "description": "the host type", "type": "type" }, { "name": "username", "description": "the admin that annotated this host", "type": "string" }, { "name": "hosttags", "description": "comma-separated list of tags for the host", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "disksizetotal", "description": "the total disk size of the host", "type": "long" }, { "name": "islocalstorageactive", "description": "true if local storage is active, false otherwise", "type": "boolean" }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the host", "type": "long" }, { "name": "gpugroup", "description": "GPU cards present in the host", "type": "list", "response": [ { "name": "vgpu", "description": "the list of enabled vGPUs", "type": "list", "response": [ { "name": "vgputype", "description": "Model Name of vGPU", "type": "string" }, { "name": "maxheads", "description": "Maximum displays per user", "type": "long" }, { "name": "maxvgpuperpgpu", "description": "Maximum no. of vgpu per gpu card (pgpu)", "type": "long" }, { "name": "maxresolutiony", "description": "Maximum Y resolution per display", "type": "long" }, { "name": "remainingcapacity", "description": "Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type", "type": "long" }, { "name": "maxresolutionx", "description": "Maximum X resolution per display", "type": "long" }, { "name": "maxcapacity", "description": "Maximum vgpu can be created with this vgpu type on the given gpu group", "type": "long" }, { "name": "videoram", "description": "Video RAM for this vGPU type", "type": "long" } ] }, { "name": "gpugroupname", "description": "GPU cards present in the host", "type": "string" } ] }, { "name": "suitableformigration", "description": "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise", "type": "boolean" }, { }, { "name": "lastpinged", "description": "the date and time the host was last pinged", "type": "date" } ] }, { "name": "createEgressFirewallRule", "description": "Creates a egress firewall rule for a given network ", "isasync": true, "related": "updateEgressFirewallRule,listFirewallRules,listEgressFirewallRules,createFirewallRule", "params": [ { "name": "type", "description": "type of firewallrule: system/user", "type": "string", "length": 255, "required": false }, { "name": "destcidrlist", "description": "the cidr list to forward traffic to", "type": "list", "length": 255, "required": false }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer", "length": 255, "required": false }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "list", "length": 255, "required": false }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer", "length": 255, "required": false }, { "name": "protocol", "description": "the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.", "type": "string", "length": 255, "required": true }, { "name": "startport", "description": "the starting port of firewall rule", "type": "integer", "length": 255, "required": false }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "networkid", "description": "the network id of the port forwarding rule", "type": "uuid", "length": 255, "required": true, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "endport", "description": "the ending port of firewall rule", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "destcidrlist", "description": "the cidr list to forward traffic to", "type": "string" }, { "name": "networkid", "description": "the network id of the firewall rule", "type": "string" }, { }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer" }, { "name": "startport", "description": "the starting port of firewall rule's port range", "type": "integer" }, { }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer" }, { "name": "ipaddress", "description": "the public ip address for the firewall rule", "type": "string" }, { "name": "endport", "description": "the ending port of firewall rule's port range", "type": "integer" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "id", "description": "the ID of the firewall rule", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "protocol", "description": "the protocol of the firewall rule", "type": "string" }, { "name": "ipaddressid", "description": "the public ip address id for the firewall rule", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" } ] }, { "name": "getSolidFireVolumeSize", "description": "Get the SF volume size including Hypervisor Snapshot Reserve", "isasync": false, "related": "", "params": [ { "name": "volumeid", "description": "Volume UUID", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "solidFireVolumeSize", "description": "SolidFire Volume Size Including Hypervisor Snapshot Reserve", "type": "long" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listVPCOfferings", "description": "Lists VPC offerings", "isasync": false, "related": "updateVPCOffering", "params": [ { "name": "supportedservices", "description": "list VPC offerings supporting certain services", "type": "list", "length": 255, "required": false }, { "name": "displaytext", "description": "list VPC offerings by display text", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "state", "description": "list VPC offerings by state", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "list VPC offerings by id", "type": "uuid", "length": 255, "required": false, "related": "updateVPCOffering,listVPCOfferings" }, { "name": "name", "description": "list VPC offerings by name", "type": "string", "length": 255, "required": false }, { "name": "isdefault", "description": "true if need to list only default VPC offerings. Default value is false", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "supportsregionLevelvpc", "description": " indicated if the offering can support region level vpc", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "id", "description": "the id of the vpc offering", "type": "string" }, { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "name", "description": "the capability name", "type": "string" } ] }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "id", "description": "uuid of the network provider", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" } ] }, { "name": "created", "description": "the date this vpc offering was created", "type": "date" }, { "name": "displaytext", "description": "an alternate display text of the vpc offering.", "type": "string" }, { "name": "state", "description": "state of the vpc offering. Can be Disabled/Enabled", "type": "string" }, { "name": "isdefault", "description": "true if vpc offering is default, false otherwise", "type": "boolean" }, { }, { "name": "name", "description": "the name of the vpc offering", "type": "string" }, { "name": "distributedvpcrouter", "description": " indicates if the vpc offering supports distributed router for one-hop forwarding", "type": "boolean" } ] }, { "name": "uploadVolume", "description": "Uploads a data disk.", "isasync": true, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,detachVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume", "params": [ { "name": "url", "description": "the URL of where the volume is hosted. Possible URL include http:// and https://", "type": "string", "length": 2048, "required": true }, { "name": "imagestoreuuid", "description": "Image store uuid", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "an optional accountName. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the ID of the zone the volume is to be hosted on", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "projectid", "description": "Upload volume for the project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "diskofferingid", "description": "the ID of the disk offering. This must be a custom sized offering since during uploadVolume volume size is unknown.", "type": "uuid", "length": 255, "required": false, "related": "createDiskOffering,listDiskOfferings,updateDiskOffering" }, { "name": "name", "description": "the name of the volume", "type": "string", "length": 255, "required": true }, { "name": "format", "description": "the format for the volume. Possible values include QCOW2, OVA, and VHD.", "type": "string", "length": 255, "required": true }, { "name": "domainid", "description": "an optional domainId. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "checksum", "description": "the checksum value of this volume. The parameter containing the checksum will be considered a MD5sum if it is not prefixed\n and just a plain ascii/utf8 representation of a hexadecimal string. If it is required to\n use another algorithm the hexadecimal string is to be prefixed with a string of the form,\n \"{}\", not including the double quotes. In this is the exact string\n representing the java supported algorithm, i.e. MD5 or SHA-256. Note that java does not\n contain an algorithm called SHA256 or one called sha-256, only SHA-256.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "virtualmachineid", "description": "id of the virtual machine", "type": "string" }, { "name": "id", "description": "ID of the disk volume", "type": "string" }, { "name": "serviceofferingdisplaytext", "description": "the display text of the service offering for root disk", "type": "string" }, { "name": "displayvolume", "description": "an optional field whether to the display the volume to the end user or not.", "type": "boolean" }, { "name": "attached", "description": "the date the volume was attached to a VM instance", "type": "date" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "snapshotid", "description": "ID of the snapshot from which this volume was created", "type": "string" }, { "name": "vmdisplayname", "description": "display name of the virtual machine", "type": "string" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk volume", "type": "long" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk volume", "type": "long" }, { "name": "deviceid", "description": "the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached.", "type": "long" }, { "name": "podid", "description": "pod id of the volume", "type": "string" }, { "name": "diskofferingid", "description": "ID of the disk offering", "type": "string" }, { "name": "zoneid", "description": "ID of the availability zone", "type": "string" }, { "name": "path", "description": "the path of the volume", "type": "string" }, { "name": "vmname", "description": "name of the virtual machine", "type": "string" }, { }, { "name": "status", "description": "the status of the volume", "type": "string" }, { "name": "chaininfo", "description": "the chain info of the volume", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "clusterid", "description": "cluster id of the volume", "type": "string" }, { "name": "storage", "description": "name of the primary storage hosting the disk volume", "type": "string" }, { "name": "serviceofferingid", "description": "ID of the service offering for root disk", "type": "string" }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "isextractable", "description": "true if the volume is extractable, false otherwise", "type": "boolean" }, { "name": "vmstate", "description": "state of the virtual machine", "type": "string" }, { "name": "maxiops", "description": "max iops of the disk volume", "type": "long" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "quiescevm", "description": "need quiesce vm or not when taking snapshot", "type": "boolean" }, { }, { "name": "provisioningtype", "description": "provisioning type used to create volumes.", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "clustername", "description": "cluster name where the volume is allocated", "type": "string" }, { "name": "diskofferingname", "description": "name of the disk offering", "type": "string" }, { "name": "storageid", "description": "id of the primary storage hosting the disk volume; returned to admin user only", "type": "string" }, { "name": "size", "description": "size of the disk volume", "type": "long" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "miniops", "description": "min iops of the disk volume", "type": "long" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk volume", "type": "long" }, { "name": "utilization", "description": "the disk utilization", "type": "string" }, { "name": "physicalsize", "description": "the bytes alloaated", "type": "long" }, { "name": "diskofferingdisplaytext", "description": "the display text of the disk offering", "type": "string" }, { "name": "storagetype", "description": "shared or local storage", "type": "string" }, { "name": "destroyed", "description": "the boolean state of whether the volume is destroyed or not", "type": "boolean" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk volume", "type": "long" }, { "name": "virtualsize", "description": "the bytes actually consumed on disk", "type": "long" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "name", "description": "name of the disk volume", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "podname", "description": "pod name of the volume", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the disk volume", "type": "string" }, { "name": "type", "description": "type of the disk volume (ROOT or DATADISK)", "type": "string" }, { "name": "zonename", "description": "name of the availability zone", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "created", "description": "the date the disk volume was created", "type": "date" }, { "name": "hypervisor", "description": "Hypervisor the volume belongs to", "type": "string" }, { "name": "serviceofferingname", "description": "name of the service offering for root disk", "type": "string" } ] }, { "name": "listSecurityGroups", "description": "Lists security groups", "isasync": false, "related": "createSecurityGroup", "params": [ { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "lists security groups by virtual machine id", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,changeServiceForVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "securitygroupname", "description": "lists security groups by name", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "list the security group by the id provided", "type": "uuid", "length": 255, "required": false, "related": "createSecurityGroup,listSecurityGroups" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" } ], "response": [ { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" } ] }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { }, { }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" } ] }, { "name": "name", "description": "the name of the security group", "type": "string" } ] }, { "name": "configureOutOfBandManagement", "description": "Configures a host's out-of-band management interface", "since": "4.9.0", "isasync": false, "related": "disableOutOfBandManagementForHost,enableOutOfBandManagementForHost,disableOutOfBandManagementForCluster,enableOutOfBandManagementForZone,disableOutOfBandManagementForZone,enableOutOfBandManagementForCluster,issueOutOfBandManagementPowerAction,changeOutOfBandManagementPassword", "params": [ { "name": "port", "description": "the host management interface port", "type": "string", "length": 255, "required": true }, { "name": "driver", "description": "the host management interface driver, for example: ipmitool", "type": "string", "length": 255, "required": true }, { "name": "address", "description": "the host management interface IP address", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "the host management interface user", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "the host management interface password", "type": "string", "length": 255, "required": true }, { "name": "hostid", "description": "the ID of the host", "type": "uuid", "length": 255, "required": true, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" } ], "response": [ { }, { }, { "name": "address", "description": "the out-of-band management interface address", "type": "string" }, { "name": "password", "description": "the out-of-band management interface password", "type": "string" }, { "name": "port", "description": "the out-of-band management interface port", "type": "string" }, { "name": "enabled", "description": "true if out-of-band management is enabled for the host", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "powerstate", "description": "the out-of-band management interface powerState of the host", "type": "powerstate" }, { "name": "status", "description": "the operation result", "type": "boolean" }, { "name": "description", "description": "the operation result description", "type": "string" }, { "name": "action", "description": "the out-of-band management action (if issued)", "type": "string" }, { "name": "username", "description": "the out-of-band management interface username", "type": "string" }, { "name": "driver", "description": "the out-of-band management driver for the host", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hostid", "description": "the ID of the host", "type": "string" } ] }, { "name": "listStorageTags", "description": "Lists storage tags", "isasync": false, "related": "", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "id", "description": "the ID of the storage tag", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "name", "description": "the name of the storage tag", "type": "string" }, { "name": "poolid", "description": "the pool ID of the storage tag", "type": "long" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteServicePackageOffering", "description": "Delete Service Package", "isasync": false, "params": [ { "name": "id", "description": "the service offering ID", "type": "string", "length": 255, "required": true, "related": "registerNetscalerServicePackage,listRegisteredServicePackages" } ], "response": [ { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "listTemplatePermissions", "description": "List template visibility and all accounts that have permissions to view this template.", "isasync": false, "related": "listIsoPermissions,listTemplatePermissions,listIsoPermissions", "params": [ { "name": "id", "description": "the template ID", "type": "uuid", "length": 255, "required": true, "related": "listTemplatePermissions,listIsoPermissions,listTemplatePermissions,listIsoPermissions" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "account", "description": "the list of accounts the template is available for", "type": "list" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { "name": "projectids", "description": "the list of projects the template is available for", "type": "list" }, { }, { }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" } ] }, { "name": "destroySystemVm", "description": "Destroyes a system virtual machine.", "isasync": true, "related": "stopSystemVm,migrateSystemVm,changeServiceForSystemVm,startSystemVm,listSystemVms,scaleSystemVm", "params": [ { "name": "id", "description": "The ID of the system virtual machine", "type": "uuid", "length": 255, "required": true, "related": "stopSystemVm,migrateSystemVm,changeServiceForSystemVm,startSystemVm,destroySystemVm,listSystemVms,scaleSystemVm" } ], "response": [ { "name": "privatenetmask", "description": "the private netmask for the system VM", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the system VM", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the system vm", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "activeviewersessions", "description": "the number of active console sessions for the console proxy system vm", "type": "integer" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the system vm", "type": "string" }, { }, { "name": "state", "description": "the state of the system VM", "type": "string" }, { "name": "templateid", "description": "the template ID for the system VM", "type": "string" }, { "name": "podid", "description": "the Pod ID for the system VM", "type": "string" }, { "name": "created", "description": "the date and time the system VM was created", "type": "date" }, { "name": "networkdomain", "description": "the network domain for the system VM", "type": "string" }, { "name": "privatemacaddress", "description": "the private MAC address for the system VM", "type": "string" }, { "name": "dns2", "description": "the second DNS for the system VM", "type": "string" }, { "name": "dns1", "description": "the first DNS for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "integer" }, { "name": "jobid", "description": "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the system VM", "type": "string" }, { "name": "gateway", "description": "the gateway for the system VM", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the system vm", "type": "string" }, { "name": "publicip", "description": "the public IP address for the system VM", "type": "string" }, { "name": "hostid", "description": "the host ID for the system VM", "type": "string" }, { "name": "zonename", "description": "the Zone name for the system VM", "type": "string" }, { "name": "publicvlan", "description": "public vlan range", "type": "list" }, { }, { "name": "id", "description": "the ID of the system VM", "type": "string" }, { "name": "systemvmtype", "description": "the system VM type", "type": "string" }, { "name": "privateip", "description": "the private IP address for the system VM", "type": "string" }, { "name": "name", "description": "the name of the system VM", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "hostname", "description": "the hostname for the system VM", "type": "string" }, { "name": "guestvlan", "description": "guest vlan range", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the system VM", "type": "string" } ] }, { "name": "listAnnotations", "description": "Lists annotations.", "since": "4.11", "isasync": false, "related": "removeAnnotation,addAnnotation", "params": [ { "name": "entitytype", "description": "the entity type", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "the id of the annotation", "type": "string", "length": 255, "required": false }, { "name": "entityid", "description": "the id of the entity for which to show annotations", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "userid", "description": "The (uu)id of the user that entered the annotation", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "entityid", "description": "the (uu)id of the entitiy to which this annotation pertains", "type": "string" }, { "name": "created", "description": "the creation timestamp for this annotation", "type": "date" }, { "name": "removed", "description": "the removal timestamp for this annotation", "type": "date" }, { }, { "name": "annotation", "description": "the contents of the annotation", "type": "string" }, { "name": "id", "description": "the (uu)id of the annotation", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "entitytype", "description": "the type of the annotated entity", "type": "string" } ] }, { "name": "addSwift", "description": "Adds Swift.", "since": "3.0.0", "isasync": false, "related": "listImageStores,createSecondaryStagingStore,addSecondaryStorage,updateCloudToUseObjectStore,addImageStore,listSwifts,listSecondaryStagingStores,addImageStoreS3", "params": [ { "name": "url", "description": "the URL for swift", "type": "string", "length": 255, "required": true }, { "name": "account", "description": "the account for swift", "type": "string", "length": 255, "required": false }, { "name": "key", "description": " key for the user for swift", "type": "string", "length": 255, "required": false }, { "name": "username", "description": "the username for swift", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "url", "description": "the url of the image store", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the image store", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "zonename", "description": "the Zone name of the image store", "type": "string" }, { "name": "scope", "description": "the scope of the image store", "type": "scopetype" }, { "name": "id", "description": "the ID of the image store", "type": "string" }, { "name": "protocol", "description": "the protocol of the image store", "type": "string" }, { "name": "providername", "description": "the provider name of the image store", "type": "string" }, { }, { "name": "name", "description": "the name of the image store", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "archiveEvents", "description": "Archive one or more events.", "isasync": false, "params": [ { "name": "ids", "description": "the IDs of the events", "type": "list", "length": 255, "required": false, "related": "listEvents" }, { "name": "startdate", "description": "start date range to archive events (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")", "type": "date", "length": 255, "required": false }, { "name": "type", "description": "archive by event type", "type": "string", "length": 255, "required": false }, { "name": "enddate", "description": "end date range to archive events (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")", "type": "date", "length": 255, "required": false } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "deleteSecondaryStagingStore", "description": "Deletes a secondary staging store .", "since": "4.2.0", "isasync": false, "params": [ { "name": "id", "description": "the staging store ID", "type": "uuid", "length": 255, "required": true, "related": "listImageStores,createSecondaryStagingStore,addSecondaryStorage,updateCloudToUseObjectStore,addImageStore,listSwifts,listSecondaryStagingStores,addImageStoreS3" } ], "response": [ { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "updateLoadBalancer", "description": "Updates a load balancer", "since": "4.4.0", "isasync": true, "related": "createLoadBalancer,listLoadBalancers", "params": [ { "name": "id", "description": "the ID of the load balancer", "type": "uuid", "length": 255, "required": true, "related": "createIpForwardingRule,listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "projectid", "description": "the project id of the Load Balancer", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domain", "description": "the domain of the Load Balancer", "type": "string" }, { "name": "sourceipaddressnetworkid", "description": "Load Balancer source ip network id", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "tags", "description": "the list of resource tags associated with the Load Balancer", "type": "list", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "project", "description": "the project name of the Load Balancer", "type": "string" }, { "name": "domainid", "description": "the domain ID of the Load Balancer", "type": "string" }, { "name": "algorithm", "description": "the load balancer algorithm (source, roundrobin, leastconn)", "type": "string" }, { "name": "sourceipaddress", "description": "Load Balancer source ip", "type": "string" }, { "name": "loadbalancerrule", "description": "the list of rules associated with the Load Balancer", "type": "list", "response": [ { "name": "sourceport", "description": "source port of the load balancer rule", "type": "integer" }, { "name": "instanceport", "description": "instance port of the load balancer rule", "type": "integer" }, { "name": "state", "description": "the state of the load balancer rule", "type": "string" } ] }, { "name": "loadbalancerinstance", "description": "the list of instances associated with the Load Balancer", "type": "list", "response": [ { "name": "state", "description": "the state of the instance", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the instance", "type": "string" }, { "name": "id", "description": "the instance ID", "type": "string" }, { "name": "name", "description": "the name of the instance", "type": "string" } ] }, { "name": "account", "description": "the account of the Load Balancer", "type": "string" }, { "name": "name", "description": "the name of the Load Balancer", "type": "string" }, { "name": "networkid", "description": "Load Balancer network id", "type": "string" }, { "name": "id", "description": "the Load Balancer ID", "type": "string" }, { "name": "description", "description": "the description of the Load Balancer", "type": "string" } ] }, { "name": "scaleSystemVm", "description": "Scale the service offering for a system vm (console proxy or secondary storage). The system vm must be in a \"Stopped\" state for this command to take effect.", "isasync": true, "related": "stopSystemVm,migrateSystemVm,changeServiceForSystemVm,startSystemVm,listSystemVms", "params": [ { "name": "details", "description": "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value", "type": "map", "length": 255, "required": false }, { "name": "serviceofferingid", "description": "the service offering ID to apply to the system vm", "type": "uuid", "length": 255, "required": true, "related": "createServiceOffering,listServiceOfferings,updateServiceOffering" }, { "name": "id", "description": "The ID of the system vm", "type": "uuid", "length": 255, "required": true, "related": "stopSystemVm,migrateSystemVm,changeServiceForSystemVm,startSystemVm,listSystemVms,scaleSystemVm" } ], "response": [ { "name": "hostname", "description": "the hostname for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "integer" }, { "name": "publicip", "description": "the public IP address for the system VM", "type": "string" }, { "name": "privatenetmask", "description": "the private netmask for the system VM", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the system VM", "type": "string" }, { }, { "name": "linklocalnetmask", "description": "the link local netmask for the system vm", "type": "string" }, { }, { "name": "guestvlan", "description": "guest vlan range", "type": "string" }, { "name": "zonename", "description": "the Zone name for the system VM", "type": "string" }, { "name": "publicvlan", "description": "public vlan range", "type": "list" }, { "name": "state", "description": "the state of the system VM", "type": "string" }, { "name": "privateip", "description": "the private IP address for the system VM", "type": "string" }, { "name": "activeviewersessions", "description": "the number of active console sessions for the console proxy system vm", "type": "integer" }, { "name": "gateway", "description": "the gateway for the system VM", "type": "string" }, { "name": "privatemacaddress", "description": "the private MAC address for the system VM", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the system VM", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the system vm", "type": "string" }, { "name": "systemvmtype", "description": "the system VM type", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the system VM", "type": "string" }, { "name": "hostid", "description": "the host ID for the system VM", "type": "string" }, { "name": "dns1", "description": "the first DNS for the system VM", "type": "string" }, { "name": "jobid", "description": "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "id", "description": "the ID of the system VM", "type": "string" }, { "name": "templateid", "description": "the template ID for the system VM", "type": "string" }, { "name": "name", "description": "the name of the system VM", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the system VM", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the system vm", "type": "string" }, { "name": "dns2", "description": "the second DNS for the system VM", "type": "string" }, { "name": "created", "description": "the date and time the system VM was created", "type": "date" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "podid", "description": "the Pod ID for the system VM", "type": "string" } ] }, { "name": "listSnapshotPolicies", "description": "Lists snapshot policies.", "isasync": false, "related": "createSnapshotPolicy,updateSnapshotPolicy", "params": [ { "name": "volumeid", "description": "the ID of the disk volume", "type": "uuid", "length": 255, "required": false, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,detachVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "the ID of the snapshot policy", "type": "uuid", "length": 255, "required": false, "related": "listSnapshotPolicies,createSnapshotPolicy,updateSnapshotPolicy" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "schedule", "description": "time the snapshot is scheduled to be taken.", "type": "string" }, { "name": "fordisplay", "description": "is this policy for display to the regular user", "type": "boolean" }, { "name": "intervaltype", "description": "the interval type of the snapshot policy", "type": "short" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "timezone", "description": "the time zone of the snapshot policy", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "maxsnaps", "description": "maximum number of snapshots retained", "type": "int" }, { "name": "id", "description": "the ID of the snapshot policy", "type": "string" }, { "name": "volumeid", "description": "the ID of the disk volume", "type": "string" } ] }, { "name": "updateVpnCustomerGateway", "description": "Update site to site vpn customer gateway", "isasync": true, "related": "listVpnCustomerGateways,createVpnCustomerGateway", "params": [ { "name": "forceencap", "description": "Force encapsulation for Nat Traversal", "type": "boolean", "length": 255, "required": false }, { "name": "ikepolicy", "description": "IKE policy of the customer gateway", "type": "string", "length": 255, "required": true }, { "name": "esppolicy", "description": "ESP policy of the customer gateway", "type": "string", "length": 255, "required": true }, { "name": "domainid", "description": "the domain ID associated with the gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "account", "description": "the account associated with the gateway. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "id of customer gateway", "type": "uuid", "length": 255, "required": true, "related": "updateVpnCustomerGateway,listVpnCustomerGateways,createVpnCustomerGateway" }, { "name": "cidrlist", "description": "guest cidr of the customer gateway", "type": "string", "length": 255, "required": true }, { "name": "esplifetime", "description": "Lifetime of phase 2 VPN connection to the customer gateway, in seconds", "type": "long", "length": 255, "required": false }, { "name": "ikelifetime", "description": "Lifetime of phase 1 VPN connection to the customer gateway, in seconds", "type": "long", "length": 255, "required": false }, { "name": "dpd", "description": "If DPD is enabled for VPN connection", "type": "boolean", "length": 255, "required": false }, { "name": "gateway", "description": "public ip address id of the customer gateway", "type": "string", "length": 255, "required": true }, { "name": "name", "description": "name of this customer gateway", "type": "string", "length": 255, "required": false }, { "name": "ipsecpsk", "description": "IPsec Preshared-Key of the customer gateway. Cannot contain newline or double quotes.", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "esplifetime", "description": "Lifetime of ESP SA of customer gateway", "type": "long" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "name", "description": "name of the customer gateway", "type": "string" }, { "name": "ikepolicy", "description": "IKE policy of customer gateway", "type": "string" }, { "name": "ikelifetime", "description": "Lifetime of IKE SA of customer gateway", "type": "long" }, { "name": "gateway", "description": "public ip address id of the customer gateway", "type": "string" }, { "name": "dpd", "description": "if DPD is enabled for customer gateway", "type": "boolean" }, { "name": "domainid", "description": "the domain id of the owner", "type": "string" }, { "name": "ipsecpsk", "description": "IPsec preshared-key of customer gateway", "type": "string" }, { "name": "esppolicy", "description": "IPsec policy of customer gateway", "type": "string" }, { "name": "forceencap", "description": "if Force NAT Encapsulation is enabled for customer gateway", "type": "boolean" }, { "name": "project", "description": "the project name", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the vpn gateway ID", "type": "string" }, { "name": "account", "description": "the owner", "type": "string" }, { "name": "cidrlist", "description": "guest cidr list of the customer gateway", "type": "string" }, { "name": "ipaddress", "description": "guest ip of the customer gateway", "type": "string" }, { "name": "projectid", "description": "the project id", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { }, { } ] }, { "name": "stopRouter", "description": "Stops a router.", "isasync": true, "related": "listRouters,changeServiceForRouter,destroyRouter,stopNetScalerVpx,listInternalLoadBalancerVMs,startRouter,rebootRouter,stopInternalLoadBalancerVM,startInternalLoadBalancerVM", "params": [ { "name": "forced", "description": "Force stop the VM. The caller knows the VM is stopped.", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the ID of the router", "type": "uuid", "length": 255, "required": true, "related": "listRouters,stopRouter,changeServiceForRouter,destroyRouter,stopNetScalerVpx,listInternalLoadBalancerVMs,startRouter,rebootRouter,stopInternalLoadBalancerVM,startInternalLoadBalancerVM" } ], "response": [ { "name": "publicnetworkid", "description": "the ID of the corresponding public network", "type": "string" }, { "name": "hostid", "description": "the host ID for the router", "type": "string" }, { "name": "podid", "description": "the Pod ID for the router", "type": "string" }, { "name": "linklocalnetworkid", "description": "the ID of the corresponding link local network", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the router", "type": "string" }, { "name": "guestipaddress", "description": "the guest IP address for the router", "type": "string" }, { "name": "scriptsversion", "description": "the version of scripts", "type": "string" }, { "name": "created", "description": "the date and time the router was created", "type": "date" }, { "name": "nic", "description": "the list of nics associated with the router", "type": "set", "response": [ { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" } ] }, { "name": "publicmacaddress", "description": "the public MAC address for the router", "type": "string" }, { "name": "domain", "description": "the domain associated with the router", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the router", "type": "string" }, { "name": "guestmacaddress", "description": "the guest MAC address for the router", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the router", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the router", "type": "string" }, { "name": "version", "description": "the version of template", "type": "string" }, { "name": "gateway", "description": "the gateway for the router", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "guestnetmask", "description": "the guest netmask for the router", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "requiresupgrade", "description": "true if the router template requires upgrader", "type": "boolean" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "domainid", "description": "the domain ID associated with the router", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "vpcname", "description": "the name of VPC the router belongs to", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the router", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the router", "type": "string" }, { "name": "name", "description": "the name of the router", "type": "string" }, { "name": "templateid", "description": "the template ID for the router", "type": "string" }, { "name": "zonename", "description": "the Zone name for the router", "type": "string" }, { "name": "publicip", "description": "the public IP address for the router", "type": "string" }, { "name": "role", "description": "role of the domain router", "type": "string" }, { "name": "vpcid", "description": "VPC the router belongs to", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the router", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the router", "type": "string" }, { "name": "isredundantrouter", "description": "if this router is an redundant virtual router", "type": "boolean" }, { "name": "guestnetworkid", "description": "the ID of the corresponding guest network", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "redundantstate", "description": "the state of redundant virtual router", "type": "string" }, { "name": "dns2", "description": "the second DNS for the router", "type": "string" }, { "name": "dns1", "description": "the first DNS for the router", "type": "string" }, { "name": "hostname", "description": "the hostname for the router", "type": "string" }, { "name": "state", "description": "the state of the router", "type": "state" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "guestnetworkname", "description": "the name of the corresponding guest network", "type": "string" }, { "name": "account", "description": "the account associated with the router", "type": "string" }, { } ] }, { "name": "lockAccount", "description": "This deprecated function used to locks an account. Look for the API DisableAccount instead", "isasync": false, "related": "enableAccount,createAccount,markDefaultZoneForAccount,updateAccount,listAccounts,disableAccount,listAccounts", "params": [ { "name": "account", "description": "Locks the specified account.", "type": "string", "length": 255, "required": true }, { "name": "domainid", "description": "Locks the specified account on this domain.", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" } ], "response": [ { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by account", "type": "float" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this account", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this account", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the account can own", "type": "string" }, { "name": "id", "description": "the id of the account", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by account", "type": "long" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this account to acquire", "type": "string" }, { "name": "groups", "description": "the list of acl groups that account belongs to", "type": "list" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this account", "type": "long" }, { "name": "roletype", "description": "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this account", "type": "long" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this account", "type": "string" }, { "name": "vpclimit", "description": "the total number of vpcs the account can own", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this account", "type": "string" }, { "name": "memorylimit", "description": "the total memory (in MB) the account can own", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this account", "type": "string" }, { "name": "defaultzoneid", "description": "the default zone of the account", "type": "string" }, { "name": "iscleanuprequired", "description": "true if the account requires cleanup", "type": "boolean" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this account", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the account can own", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this account", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this account", "type": "string" }, { "name": "projecttotal", "description": "the total number of projects being administrated by this account", "type": "long" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this account", "type": "integer" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by account", "type": "long" }, { "name": "iplimit", "description": "the total number of public ip addresses this account can acquire", "type": "string" }, { "name": "user", "description": "the list of users associated with account", "type": "list", "response": [ { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "roleid", "description": "the ID of the role", "type": "string" } ] }, { "name": "sentbytes", "description": "the total number of network traffic bytes sent", "type": "long" }, { "name": "domainid", "description": "id of the Domain the account belongs too", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this account", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this account", "type": "integer" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "volumetotal", "description": "the total volume being used by this account", "type": "long" }, { "name": "receivedbytes", "description": "the total number of network traffic bytes received", "type": "long" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this account to acquire", "type": "string" }, { }, { "name": "domain", "description": "name of the Domain the account belongs too", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by account", "type": "long" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this account", "type": "string" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by account", "type": "long" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this account", "type": "string" }, { "name": "isdefault", "description": "true if account is default, false otherwise", "type": "boolean" }, { "name": "state", "description": "the state of the account", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by account", "type": "long" }, { "name": "volumelimit", "description": "the total volume which can be used by this account", "type": "string" }, { "name": "accountdetails", "description": "details for the account", "type": "map" }, { "name": "name", "description": "the name of the account", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the account can own", "type": "string" }, { "name": "projectlimit", "description": "the total number of projects the account can own", "type": "string" }, { }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the account can own", "type": "string" }, { "name": "accounttype", "description": "account type (admin, domain-admin, user)", "type": "short" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this account", "type": "long" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this account", "type": "long" } ] }, { "name": "listClusters", "description": "Lists clusters.", "isasync": false, "related": "addCluster,updateCluster", "params": [ { "name": "name", "description": "lists clusters by the cluster name", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "clustertype", "description": "lists clusters by cluster type", "type": "string", "length": 255, "required": false }, { "name": "allocationstate", "description": "lists clusters by allocation state", "type": "string", "length": 255, "required": false }, { "name": "showcapacities", "description": "flag to display the capacity of the clusters", "type": "boolean", "length": 255, "required": false }, { "name": "podid", "description": "lists clusters by Pod ID", "type": "uuid", "length": 255, "required": false, "related": "listPods,createManagementNetworkIpRange,updatePod" }, { "name": "zoneid", "description": "lists clusters by Zone ID", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "managedstate", "description": "whether this cluster is managed by cloudstack", "type": "string", "length": 255, "required": false }, { "name": "hypervisor", "description": "lists clusters by hypervisor type", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "lists clusters by the cluster ID", "type": "uuid", "length": 255, "required": false, "related": "addCluster,listClusters,updateCluster" } ], "response": [ { "name": "zoneid", "description": "the Zone ID of the cluster", "type": "string" }, { "name": "zonename", "description": "the Zone name of the cluster", "type": "string" }, { "name": "resourcedetails", "description": "Meta data associated with the zone (key/value pairs)", "type": "map" }, { "name": "hypervisortype", "description": "the hypervisor type of the cluster", "type": "string" }, { "name": "capacity", "description": "the capacity of the Cluster", "type": "list", "response": [ { "name": "name", "description": "the capacity name", "type": "string" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "zonename", "description": "the Zone name", "type": "string" } ] }, { "name": "ovm3vip", "description": "Ovm3 VIP to use for pooling and/or clustering", "type": "string" }, { "name": "clustertype", "description": "the type of the cluster", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "managedstate", "description": "whether this cluster is managed by cloudstack", "type": "string" }, { "name": "id", "description": "the cluster ID", "type": "string" }, { "name": "podname", "description": "the Pod name of the cluster", "type": "string" }, { "name": "allocationstate", "description": "the allocation state of the cluster", "type": "string" }, { "name": "cpuovercommitratio", "description": "The cpu overcommit ratio of the cluster", "type": "string" }, { "name": "memoryovercommitratio", "description": "The memory overcommit ratio of the cluster", "type": "string" }, { }, { "name": "podid", "description": "the Pod ID of the cluster", "type": "string" }, { }, { "name": "name", "description": "the cluster name", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listProjectInvitations", "description": "Lists project invitations and provides detailed information for listed invitations", "since": "3.0.0", "isasync": false, "related": "", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "list invitations by id", "type": "uuid", "length": 255, "required": false, "related": "listProjectInvitations" }, { "name": "state", "description": "list invitations by state", "type": "string", "length": 255, "required": false }, { "name": "activeonly", "description": "if true, list only active invitations - having Pending state and ones that are not timed out yet", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list by project id", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "projectid", "description": "the id of the project", "type": "string" }, { "name": "project", "description": "the name of the project", "type": "string" }, { "name": "account", "description": "the account name of the project's owner", "type": "string" }, { "name": "domain", "description": "the domain name where the project belongs to", "type": "string" }, { }, { "name": "id", "description": "the id of the invitation", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "state", "description": "the invitation state", "type": "string" }, { "name": "domainid", "description": "the domain id the project belongs to", "type": "string" }, { "name": "email", "description": "the email the invitation was sent to", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteProjectInvitation", "description": "Deletes project invitation", "since": "3.0.0", "isasync": true, "params": [ { "name": "id", "description": "id of the invitation", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listEgressFirewallRules", "description": "Lists all egress firewall rules for network ID.", "isasync": false, "related": "updateEgressFirewallRule,listFirewallRules,createFirewallRule", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "networkid", "description": "the network ID for the egress firewall services", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "Lists rule with the specified ID.", "type": "uuid", "length": 255, "required": false, "related": "createIpForwardingRule,listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" }, { "name": "ipaddressid", "description": "the ID of IP address of the firewall services", "type": "uuid", "length": 255, "required": false, "related": "restartNetwork,updateIpAddress,listPublicIpAddresses,associateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false } ], "response": [ { }, { "name": "networkid", "description": "the network id of the firewall rule", "type": "string" }, { "name": "id", "description": "the ID of the firewall rule", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "startport", "description": "the starting port of firewall rule's port range", "type": "integer" }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer" }, { }, { "name": "endport", "description": "the ending port of firewall rule's port range", "type": "integer" }, { "name": "destcidrlist", "description": "the cidr list to forward traffic to", "type": "string" }, { "name": "ipaddress", "description": "the public ip address for the firewall rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "ipaddressid", "description": "the public ip address id for the firewall rule", "type": "string" }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "protocol", "description": "the protocol of the firewall rule", "type": "string" } ] }, { "name": "deleteTrafficType", "description": "Deletes traffic type of a physical network", "since": "3.0.0", "isasync": true, "params": [ { "name": "id", "description": "traffic type id", "type": "uuid", "length": 255, "required": true, "related": "updateTrafficType,addTrafficType" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "updateRegion", "description": "Updates a region", "isasync": false, "related": "addRegion,listRegions", "params": [ { "name": "id", "description": "Id of region to update", "type": "integer", "length": 255, "required": true }, { "name": "endpoint", "description": "updates region with this end point", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "updates region with this name", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "id", "description": "the ID of the region", "type": "integer" }, { }, { "name": "gslbserviceenabled", "description": "true if GSLB service is enabled in the region, false otherwise", "type": "boolean" }, { "name": "endpoint", "description": "the end point of the region", "type": "string" }, { "name": "name", "description": "the name of the region", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "portableipserviceenabled", "description": "true if security groups support is enabled, false otherwise", "type": "boolean" }, { } ] }, { "name": "listClustersMetrics", "description": "Lists clusters metrics", "since": "4.9.3", "isasync": false, "related": "", "params": [ { "name": "id", "description": "lists clusters by the cluster ID", "type": "uuid", "length": 255, "required": false, "related": "addCluster,updateCluster" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "lists clusters by the cluster name", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "allocationstate", "description": "lists clusters by allocation state", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "clustertype", "description": "lists clusters by cluster type", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "lists clusters by Zone ID", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "hypervisor", "description": "lists clusters by hypervisor type", "type": "string", "length": 255, "required": false }, { "name": "showcapacities", "description": "flag to display the capacity of the clusters", "type": "boolean", "length": 255, "required": false }, { "name": "podid", "description": "lists clusters by Pod ID", "type": "uuid", "length": 255, "required": false, "related": "listPods,createManagementNetworkIpRange,updatePod" }, { "name": "managedstate", "description": "whether this cluster is managed by cloudstack", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "zonename", "description": "the Zone name of the cluster", "type": "string" }, { "name": "cpuallocateddisablethreshold", "description": "cpu allocated disable threshold exceeded", "type": "boolean" }, { "name": "name", "description": "the cluster name", "type": "string" }, { "name": "cpuused", "description": "the total cpu used in Ghz", "type": "string" }, { "name": "id", "description": "the cluster ID", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "ovm3vip", "description": "Ovm3 VIP to use for pooling and/or clustering", "type": "string" }, { "name": "memoryovercommitratio", "description": "The memory overcommit ratio of the cluster", "type": "string" }, { "name": "cpuallocatedthreshold", "description": "cpu allocated notification threshold exceeded", "type": "boolean" }, { "name": "cpuovercommitratio", "description": "The cpu overcommit ratio of the cluster", "type": "string" }, { "name": "memoryallocatedthreshold", "description": "memory allocated notification threshold exceeded", "type": "boolean" }, { "name": "memorymaxdeviation", "description": "the maximum memory deviation", "type": "string" }, { "name": "hypervisortype", "description": "the hypervisor type of the cluster", "type": "string" }, { "name": "podname", "description": "the Pod name of the cluster", "type": "string" }, { "name": "memoryallocateddisablethreshold", "description": "memory allocated disable threshold exceeded", "type": "boolean" }, { "name": "cputotal", "description": "the total cpu capacity in Ghz", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the cluster", "type": "string" }, { "name": "capacity", "description": "the capacity of the Cluster", "type": "list", "response": [ { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "name", "description": "the capacity name", "type": "string" }, { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" } ] }, { "name": "hosts", "description": "running / total hosts in the cluster", "type": "string" }, { "name": "memoryallocated", "description": "the total cpu allocated in GiB", "type": "string" }, { "name": "podid", "description": "the Pod ID of the cluster", "type": "string" }, { "name": "managedstate", "description": "whether this cluster is managed by cloudstack", "type": "string" }, { "name": "state", "description": "state of the cluster", "type": "string" }, { "name": "resourcedetails", "description": "Meta data associated with the zone (key/value pairs)", "type": "map" }, { "name": "allocationstate", "description": "the allocation state of the cluster", "type": "string" }, { "name": "cpuallocated", "description": "the total cpu allocated in Ghz", "type": "string" }, { "name": "cpudisablethreshold", "description": "cpu usage disable threshold exceeded", "type": "boolean" }, { "name": "cpumaxdeviation", "description": "the maximum cpu deviation", "type": "string" }, { }, { "name": "memoryused", "description": "the total cpu used in GiB", "type": "string" }, { "name": "cputhreshold", "description": "cpu usage notification threshold exceeded", "type": "boolean" }, { "name": "clustertype", "description": "the type of the cluster", "type": "string" }, { "name": "memorydisablethreshold", "description": "memory usage disable threshold exceeded", "type": "boolean" }, { "name": "memorytotal", "description": "the total cpu capacity in GiB", "type": "string" }, { "name": "memorythreshold", "description": "memory usage notification threshold exceeded", "type": "boolean" } ] }, { "name": "listLdapConfigurations", "description": "Lists all LDAP configurations", "since": "4.2.0", "isasync": false, "related": "addLdapConfiguration,deleteLdapConfiguration", "params": [ { "name": "domainid", "description": "linked domain", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "hostname", "description": "Hostname", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "port", "description": "Port", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "port", "description": "port teh ldap server is running on", "type": "int" }, { "name": "hostname", "description": "name of the host running the ldap server", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "linked domain", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { } ] }, { "name": "listSecondaryStagingStores", "description": "Lists secondary staging stores.", "since": "4.2.0", "isasync": false, "related": "listImageStores,createSecondaryStagingStore,addSecondaryStorage,updateCloudToUseObjectStore,addImageStore,listSwifts,addImageStoreS3", "params": [ { "name": "name", "description": "the name of the staging store", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "provider", "description": "the staging store provider", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID for the staging store", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "id", "description": "the ID of the staging store", "type": "uuid", "length": 255, "required": false, "related": "listImageStores,createSecondaryStagingStore,addSecondaryStorage,updateCloudToUseObjectStore,addImageStore,listSwifts,listSecondaryStagingStores,addImageStoreS3" }, { "name": "protocol", "description": "the staging store protocol", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "zonename", "description": "the Zone name of the image store", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "name", "description": "the name of the image store", "type": "string" }, { "name": "protocol", "description": "the protocol of the image store", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the image store", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "id", "description": "the ID of the image store", "type": "string" }, { "name": "url", "description": "the url of the image store", "type": "string" }, { "name": "providername", "description": "the provider name of the image store", "type": "string" }, { "name": "scope", "description": "the scope of the image store", "type": "scopetype" }, { } ] }, { "name": "createRemoteAccessVpn", "description": "Creates a l2tp/ipsec remote access vpn", "isasync": true, "related": "updateRemoteAccessVpn,listRemoteAccessVpns", "params": [ { "name": "publicipid", "description": "public ip address id of the vpn server", "type": "uuid", "length": 255, "required": true, "related": "restartNetwork,updateIpAddress,listPublicIpAddresses,associateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "fordisplay", "description": "an optional field, whether to the display the vpn to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "iprange", "description": "the range of ip addresses to allocate to vpn clients. The first ip in the range will be taken by the vpn server", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "an optional domainId for the VPN. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "openfirewall", "description": "if true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "an optional account for the VPN. Must be used with domainId.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "publicipid", "description": "the public ip address of the vpn server", "type": "string" }, { "name": "domainid", "description": "the domain id of the account of the remote access vpn", "type": "string" }, { "name": "id", "description": "the id of the remote access vpn", "type": "string" }, { "name": "domain", "description": "the domain name of the account of the remote access vpn", "type": "string" }, { "name": "publicip", "description": "the public ip address of the vpn server", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "iprange", "description": "the range of ips to allocate to the clients", "type": "string" }, { "name": "account", "description": "the account of the remote access vpn", "type": "string" }, { }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "presharedkey", "description": "the ipsec preshared key", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "fordisplay", "description": "is vpn for display to the regular user", "type": "boolean" }, { } ] }, { "name": "changeServiceForVirtualMachine", "description": "Changes the service offering for a virtual machine. The virtual machine must be in a \"Stopped\" state for this command to take effect.", "isasync": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,changeServiceForVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "serviceofferingid", "description": "the service offering ID to apply to the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "createServiceOffering,listServiceOfferings,updateServiceOffering" }, { "name": "details", "description": "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value", "type": "map", "length": 255, "required": false } ], "response": [ { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" } ] }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" } ] }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" } ] }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" } ] }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" } ] }, { "name": "startRouter", "description": "Starts a router.", "isasync": true, "related": "listRouters,changeServiceForRouter,destroyRouter,stopNetScalerVpx,listInternalLoadBalancerVMs,rebootRouter,stopInternalLoadBalancerVM,startInternalLoadBalancerVM", "params": [ { "name": "id", "description": "the ID of the router", "type": "uuid", "length": 255, "required": true, "related": "listRouters,changeServiceForRouter,destroyRouter,stopNetScalerVpx,listInternalLoadBalancerVMs,startRouter,rebootRouter,stopInternalLoadBalancerVM,startInternalLoadBalancerVM" } ], "response": [ { }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "requiresupgrade", "description": "true if the router template requires upgrader", "type": "boolean" }, { "name": "linklocalnetmask", "description": "the link local netmask for the router", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "publicip", "description": "the public IP address for the router", "type": "string" }, { "name": "guestmacaddress", "description": "the guest MAC address for the router", "type": "string" }, { "name": "podid", "description": "the Pod ID for the router", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "guestnetmask", "description": "the guest netmask for the router", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "scriptsversion", "description": "the version of scripts", "type": "string" }, { "name": "guestnetworkname", "description": "the name of the corresponding guest network", "type": "string" }, { "name": "templateid", "description": "the template ID for the router", "type": "string" }, { "name": "vpcname", "description": "the name of VPC the router belongs to", "type": "string" }, { "name": "role", "description": "role of the domain router", "type": "string" }, { "name": "zonename", "description": "the Zone name for the router", "type": "string" }, { "name": "domainid", "description": "the domain ID associated with the router", "type": "string" }, { "name": "linklocalnetworkid", "description": "the ID of the corresponding link local network", "type": "string" }, { "name": "redundantstate", "description": "the state of redundant virtual router", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the router", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the router", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the router", "type": "string" }, { }, { "name": "zoneid", "description": "the Zone ID for the router", "type": "string" }, { "name": "account", "description": "the account associated with the router", "type": "string" }, { "name": "dns2", "description": "the second DNS for the router", "type": "string" }, { "name": "gateway", "description": "the gateway for the router", "type": "string" }, { "name": "guestipaddress", "description": "the guest IP address for the router", "type": "string" }, { "name": "created", "description": "the date and time the router was created", "type": "date" }, { "name": "linklocalip", "description": "the link local IP address for the router", "type": "string" }, { "name": "guestnetworkid", "description": "the ID of the corresponding guest network", "type": "string" }, { "name": "nic", "description": "the list of nics associated with the router", "type": "set", "response": [ { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" } ] }, { "name": "hostname", "description": "the hostname for the router", "type": "string" }, { "name": "vpcid", "description": "VPC the router belongs to", "type": "string" }, { "name": "dns1", "description": "the first DNS for the router", "type": "string" }, { "name": "isredundantrouter", "description": "if this router is an redundant virtual router", "type": "boolean" }, { "name": "networkdomain", "description": "the network domain for the router", "type": "string" }, { "name": "hostid", "description": "the host ID for the router", "type": "string" }, { "name": "domain", "description": "the domain associated with the router", "type": "string" }, { "name": "name", "description": "the name of the router", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "version", "description": "the version of template", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the router", "type": "state" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "publicnetworkid", "description": "the ID of the corresponding public network", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the router", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the router", "type": "string" } ] }, { "name": "listTemplates", "description": "List all public, private, and privileged templates.", "isasync": false, "related": "updateTemplate,listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "the template name", "type": "string", "length": 255, "required": false }, { "name": "templatefilter", "description": "possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins).", "type": "string", "length": 255, "required": true }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "zoneid", "description": "list templates by zoneId", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "id", "description": "the template ID", "type": "uuid", "length": 255, "required": false, "related": "updateTemplate,listIsos,createTemplate,listTemplates,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "parenttemplateid", "description": "list datadisk templates by parent template id", "type": "uuid", "length": 255, "required": false, "since": "4.4", "related": "updateTemplate,listIsos,createTemplate,listTemplates,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "hypervisor", "description": "the hypervisor for which to restrict the search", "type": "string", "length": 255, "required": false }, { "name": "ids", "description": "the IDs of the templates, mutually exclusive with id", "type": "list", "length": 255, "required": false, "since": "4.9", "related": "updateTemplate,listIsos,createTemplate,listTemplates,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "showremoved", "description": "show removed templates as well", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "hostname", "description": "the name of the secondary storage host for the template", "type": "string" }, { "name": "displaytext", "description": "the template display text", "type": "string" }, { "name": "isready", "description": "true if the template is ready to be deployed from, false otherwise.", "type": "boolean" }, { "name": "hostid", "description": "the ID of the secondary storage host for the template", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "passwordenabled", "description": "true if the reset password feature is enabled, false otherwise", "type": "boolean" }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean" }, { }, { }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "templatetype", "description": "the type of the template", "type": "string" }, { "name": "format", "description": "the format of the template.", "type": "imageformat" }, { "name": "physicalsize", "description": "the physical size of the template", "type": "long" }, { "name": "checksum", "description": "checksum of the template", "type": "string" }, { "name": "templatetag", "description": "the tag of this template", "type": "string" }, { "name": "zonename", "description": "the name of the zone for this template", "type": "string" }, { "name": "zoneid", "description": "the ID of the zone for this template", "type": "string" }, { "name": "sshkeyenabled", "description": "true if template is sshkey enabled, false otherwise", "type": "boolean" }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "details", "description": "additional key/value details tied with template", "type": "map" }, { "name": "status", "description": "the status of the template", "type": "string" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean" }, { "name": "accountid", "description": "the account id to which the template belongs", "type": "string" }, { "name": "size", "description": "the size of the template", "type": "long" }, { "name": "account", "description": "the account name to which the template belongs", "type": "string" }, { "name": "domain", "description": "the name of the domain to which the template belongs", "type": "string" }, { "name": "ostypeid", "description": "the ID of the OS type for this template.", "type": "string" }, { "name": "projectid", "description": "the project id of the template", "type": "string" }, { "name": "created", "description": "the date this template was created", "type": "date" }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "name", "description": "the template name", "type": "string" }, { "name": "isextractable", "description": "true if the template is extractable, false otherwise", "type": "boolean" }, { "name": "project", "description": "the project name of the template", "type": "string" }, { "name": "bits", "description": "the processor bit size", "type": "int" }, { "name": "parenttemplateid", "description": "if Datadisk template, then id of the root disk template this template belongs to", "type": "string" }, { "name": "sourcetemplateid", "description": "the template ID of the parent template if present", "type": "string" }, { "name": "removed", "description": "the date this template was removed", "type": "date" }, { "name": "ostypename", "description": "the name of the OS type for this template.", "type": "string" }, { "name": "requireshvm", "description": "true if template requires HVM enabled, false otherwise", "type": "boolean" }, { "name": "childtemplates", "description": "if root disk template, then ids of the datas disk templates this template owns", "type": "set" }, { "name": "directdownload", "description": "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage", "type": "boolean" }, { "name": "crossZones", "description": "true if the template is managed across all Zones, false otherwise", "type": "boolean" } ] }, { "name": "listGuestOsMapping", "description": "Lists all available OS mappings for given hypervisor", "since": "4.4.0", "isasync": false, "related": "updateGuestOsMapping,addGuestOsMapping", "params": [ { "name": "hypervisorversion", "description": "list Guest OS mapping by hypervisor version. Must be used with hypervisor parameter", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "hypervisor", "description": "list Guest OS mapping by hypervisor", "type": "string", "length": 255, "required": false }, { "name": "ostypeid", "description": "list mapping by Guest OS Type UUID", "type": "uuid", "length": 255, "required": false, "related": "addGuestOs,listOsTypes" }, { "name": "id", "description": "list mapping by its UUID", "type": "uuid", "length": 255, "required": false, "related": "updateGuestOsMapping,listGuestOsMapping,addGuestOsMapping" } ], "response": [ { "name": "osnameforhypervisor", "description": "hypervisor specific name for the Guest OS", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hypervisorversion", "description": "version of the hypervisor for mapping", "type": "string" }, { "name": "isuserdefined", "description": "is the mapping user defined", "type": "string" }, { "name": "osdisplayname", "description": "standard display name for the Guest OS", "type": "string" }, { }, { "name": "id", "description": "the ID of the Guest OS mapping", "type": "string" }, { "name": "ostypeid", "description": "the ID of the Guest OS type", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteStratosphereSsp", "description": "Removes stratosphere ssp server", "isasync": false, "params": [ { "name": "hostid", "description": "the host ID of ssp server", "type": "uuid", "length": 255, "required": true, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "createAutoScalePolicy", "description": "Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale vm group.", "isasync": true, "related": "updateAutoScalePolicy,listAutoScalePolicies", "params": [ { "name": "conditionids", "description": "the list of IDs of the conditions that are being evaluated on every interval", "type": "list", "length": 255, "required": true, "related": "createCondition,listConditions" }, { "name": "action", "description": "the action to be executed if all the conditions evaluate to true for the specified duration.", "type": "string", "length": 255, "required": true }, { "name": "duration", "description": "the duration for which the conditions have to be true before action is taken", "type": "integer", "length": 255, "required": true }, { "name": "quiettime", "description": "the cool down period for which the policy should not be evaluated after the action has been taken", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "project", "description": "the project name of the autoscale policy", "type": "string" }, { "name": "account", "description": "the account owning the autoscale policy", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "conditions", "description": "the list of IDs of the conditions that are being evaluated on every interval", "type": "list" }, { "name": "quiettime", "description": "the cool down period for which the policy should not be evaluated after the action has been taken", "type": "integer" }, { }, { "name": "projectid", "description": "the project id autoscale policy", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the domain ID of the autoscale policy", "type": "string" }, { "name": "id", "description": "the autoscale policy ID", "type": "string" }, { "name": "action", "description": "the action to be executed if all the conditions evaluate to true for the specified duration.", "type": "string" }, { }, { "name": "domain", "description": "the domain name of the autoscale policy", "type": "string" }, { "name": "duration", "description": "the duration for which the conditions have to be true before action is taken", "type": "integer" } ] }, { "name": "configureSimulator", "description": "configure simulator", "isasync": false, "related": "querySimulatorMock", "params": [ { "name": "zoneid", "description": "configure range: in a zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "podid", "description": "configure range: in a pod", "type": "uuid", "length": 255, "required": false, "related": "listPods,createManagementNetworkIpRange,updatePod" }, { "name": "value", "description": "configuration options for this command, which is seperated by ;", "type": "string", "length": 255, "required": true }, { "name": "hostid", "description": "configure range: in a host", "type": "uuid", "length": 255, "required": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" }, { "name": "clusterid", "description": "configure range: in a cluster", "type": "uuid", "length": 255, "required": false, "related": "addCluster,updateCluster" }, { "name": "name", "description": "which command needs to be configured", "type": "string", "length": 255, "required": true }, { "name": "count", "description": "number of times the mock is active", "type": "integer", "length": 255, "required": false }, { "name": "jsonresponse", "description": "agent command response to be returned", "type": "string", "length": 4096, "required": false } ], "response": [ { "name": "zoneid", "description": "the Zone ID scope of the mock", "type": "long" }, { "name": "hostid", "description": "the Host ID scope of the mock", "type": "long" }, { "name": "clusterid", "description": "the Cluster ID scope of the mock", "type": "long" }, { "name": "count", "description": "number of times mock is executed, if not specified then mock remains active till cleaned up", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the mock ID", "type": "long" }, { }, { "name": "name", "description": "the agent command to be mocked", "type": "string" }, { "name": "podid", "description": "the Pod ID scope of the mock", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "enableHAForZone", "description": "Enables HA for a zone", "since": "4.11", "isasync": true, "params": [ { "name": "zoneid", "description": "ID of the zone", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "listPhysicalNetworks", "description": "Lists physical networks", "since": "3.0.0", "isasync": false, "related": "updatePhysicalNetwork,createPhysicalNetwork", "params": [ { "name": "zoneid", "description": "the Zone ID for the physical network", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "search by name", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "list physical network by id", "type": "uuid", "length": 255, "required": false, "related": "updatePhysicalNetwork,createPhysicalNetwork,listPhysicalNetworks" } ], "response": [ { "name": "networkspeed", "description": "the speed of the physical network", "type": "string" }, { "name": "tags", "description": "comma separated tag", "type": "string" }, { "name": "vlan", "description": "the vlan of the physical network", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "broadcastdomainrange", "description": "Broadcast domain range of the physical network", "type": "string" }, { "name": "zoneid", "description": "zone id of the physical network", "type": "string" }, { "name": "isolationmethods", "description": "isolation methods", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the uuid of the physical network", "type": "string" }, { "name": "name", "description": "name of the physical network", "type": "string" }, { "name": "state", "description": "state of the physical network", "type": "string" }, { "name": "domainid", "description": "the domain id of the physical network owner", "type": "string" }, { } ] }, { "name": "listFirewallRules", "description": "Lists all firewall rules for an IP address.", "isasync": false, "related": "updateEgressFirewallRule,createFirewallRule", "params": [ { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "id", "description": "Lists rule with the specified ID.", "type": "uuid", "length": 255, "required": false, "related": "createIpForwardingRule,listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" }, { "name": "ipaddressid", "description": "the ID of IP address of the firewall services", "type": "uuid", "length": 255, "required": false, "related": "restartNetwork,updateIpAddress,listPublicIpAddresses,associateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "networkid", "description": "list firewall rules for certain network", "type": "uuid", "length": 255, "required": false, "since": "4.3", "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "endport", "description": "the ending port of firewall rule's port range", "type": "integer" }, { "name": "destcidrlist", "description": "the cidr list to forward traffic to", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "networkid", "description": "the network id of the firewall rule", "type": "string" }, { }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "id", "description": "the ID of the firewall rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the firewall rule", "type": "string" }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "ipaddress", "description": "the public ip address for the firewall rule", "type": "string" }, { "name": "startport", "description": "the starting port of firewall rule's port range", "type": "integer" }, { "name": "ipaddressid", "description": "the public ip address id for the firewall rule", "type": "string" } ] }, { "name": "deleteBrocadeVcsDevice", "description": " delete a Brocade VCS Switch", "isasync": true, "params": [ { "name": "vcsdeviceid", "description": "Brocade Switch ID", "type": "uuid", "length": 255, "required": true, "related": "addBrocadeVcsDevice,listBrocadeVcsDevices" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "cleanVMReservations", "description": "Cleanups VM reservations in the database.", "isasync": true, "params": [ ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "extractIso", "description": "Extracts an ISO", "isasync": true, "related": "extractTemplate,extractVolume", "params": [ { "name": "zoneid", "description": "the ID of the zone where the ISO is originally located", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "mode", "description": "the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD", "type": "string", "length": 255, "required": true }, { "name": "id", "description": "the ID of the ISO file", "type": "uuid", "length": 255, "required": true, "related": "updateTemplate,listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "url", "description": "the URL to which the ISO would be extracted", "type": "string", "length": 2048, "required": false } ], "response": [ { "name": "zoneid", "description": "zone ID the object was extracted from", "type": "string" }, { "name": "id", "description": "the id of extracted object", "type": "string" }, { "name": "url", "description": "if mode = upload then url of the uploaded entity. if mode = download the url from which the entity can be downloaded", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "extractMode", "description": "the mode of extraction - upload or download", "type": "string" }, { }, { "name": "uploadpercentage", "description": "the percentage of the entity uploaded to the specified location", "type": "integer" }, { "name": "zonename", "description": "zone name the object was extracted from", "type": "string" }, { "name": "extractId", "description": "the upload id of extracted object", "type": "string" }, { "name": "state", "description": "the state of the extracted object", "type": "string" }, { "name": "created", "description": "the time and date the object was created", "type": "date" }, { }, { "name": "resultstring", "description": "", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "status", "description": "the status of the extraction", "type": "string" }, { "name": "name", "description": "the name of the extracted object", "type": "string" }, { "name": "storagetype", "description": "type of the storage", "type": "string" }, { "name": "accountid", "description": "the account id to which the extracted object belongs", "type": "string" } ] }, { "name": "createSecondaryStagingStore", "description": "create secondary staging store.", "isasync": false, "related": "listImageStores,addSecondaryStorage,updateCloudToUseObjectStore,addImageStore,listSwifts,addImageStoreS3", "params": [ { "name": "details", "description": "the details for the staging store", "type": "map", "length": 255, "required": false }, { "name": "scope", "description": "the scope of the staging store: zone only for now", "type": "string", "length": 255, "required": false }, { "name": "provider", "description": "the staging store provider name", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID for the staging store", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "url", "description": "the URL for the staging store", "type": "string", "length": 2048, "required": true } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "providername", "description": "the provider name of the image store", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "url", "description": "the url of the image store", "type": "string" }, { "name": "id", "description": "the ID of the image store", "type": "string" }, { "name": "zonename", "description": "the Zone name of the image store", "type": "string" }, { "name": "name", "description": "the name of the image store", "type": "string" }, { "name": "scope", "description": "the scope of the image store", "type": "scopetype" }, { }, { "name": "protocol", "description": "the protocol of the image store", "type": "string" }, { }, { "name": "zoneid", "description": "the Zone ID of the image store", "type": "string" } ] }, { "name": "createAffinityGroup", "description": "Creates an affinity/anti-affinity group", "isasync": true, "related": "", "params": [ { "name": "projectid", "description": "create affinity group for project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "account", "description": "an account for the affinity group. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "description", "description": "optional description of the affinity group", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "domainId of the account owning the affinity group", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "type", "description": "Type of the affinity group from the available affinity/anti-affinity group types", "type": "string", "length": 255, "required": true }, { "name": "name", "description": "name of the affinity group", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" } ] }, { "name": "listInternalLoadBalancerElements", "description": "Lists all available Internal Load Balancer elements.", "since": "4.2.0", "isasync": false, "related": "configureInternalLoadBalancerElement,createInternalLoadBalancerElement", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "nspid", "description": "list internal load balancer elements by network service provider id", "type": "uuid", "length": 255, "required": false, "related": "listNetworkServiceProviders,addNetworkServiceProvider,listTrafficTypes,updateNetworkServiceProvider" }, { "name": "enabled", "description": "list internal load balancer elements by enabled state", "type": "boolean", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "list internal load balancer elements by id", "type": "uuid", "length": 255, "required": false, "related": "configureInternalLoadBalancerElement,createInternalLoadBalancerElement,listInternalLoadBalancerElements" } ], "response": [ { }, { "name": "enabled", "description": "Enabled/Disabled the element", "type": "boolean" }, { "name": "id", "description": "the id of the internal load balancer element", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "nspid", "description": "the physical network service provider id of the element", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "updateLBHealthCheckPolicy", "description": "Updates load balancer health check policy", "since": "4.4", "isasync": true, "related": "listLBHealthCheckPolicies,createLBHealthCheckPolicy", "params": [ { "name": "id", "description": "ID of load balancer health check policy", "type": "uuid", "length": 255, "required": true, "related": "updateLBHealthCheckPolicy,listLBHealthCheckPolicies,createLBHealthCheckPolicy" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "fordisplay", "description": "an optional field, whether to the display the policy to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "account", "description": "the account of the HealthCheck policy", "type": "string" }, { "name": "domainid", "description": "the domain ID of the HealthCheck policy", "type": "string" }, { "name": "lbruleid", "description": "the LB rule ID", "type": "string" }, { "name": "zoneid", "description": "the id of the zone the HealthCheck policy belongs to", "type": "string" }, { }, { "name": "domain", "description": "the domain of the HealthCheck policy", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "healthcheckpolicy", "description": "the list of healthcheckpolicies", "type": "list", "response": [ { "name": "pingpath", "description": "the pingpath of the healthcheck policy", "type": "string" }, { "name": "id", "description": "the LB HealthCheck policy ID", "type": "string" }, { "name": "description", "description": "the description of the healthcheck policy", "type": "string" }, { "name": "responsetime", "description": "Time to wait when receiving a response from the health check", "type": "int" }, { "name": "healthcheckthresshold", "description": "Number of consecutive health check success before declaring an instance healthy", "type": "int" }, { "name": "fordisplay", "description": "is policy for display to the regular user", "type": "boolean" }, { "name": "state", "description": "the state of the policy", "type": "string" }, { "name": "unhealthcheckthresshold", "description": "Number of consecutive health check failures before declaring an instance unhealthy.", "type": "int" }, { "name": "healthcheckinterval", "description": "Amount of time between health checks", "type": "int" } ] }, { } ] }, { "name": "rebootVirtualMachine", "description": "Reboots a virtual machine.", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,rebootVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" } ] }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" } ] }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "projectid", "description": "the project id of the group", "type": "string" } ] }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" } ] } ] }, { "name": "enableHAForCluster", "description": "Enables HA cluster-wide", "since": "4.11", "isasync": true, "params": [ { "name": "clusterid", "description": "ID of the cluster", "type": "uuid", "length": 255, "required": true, "related": "addCluster,updateCluster" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "createLoadBalancerRule", "description": "Creates a load balancer rule", "isasync": true, "related": "listLoadBalancerRules,updateLoadBalancerRule", "params": [ { "name": "zoneid", "description": "zone where the load balancer is going to be created. This parameter is required when LB service provider is ElasticLoadBalancerVm", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "account", "description": "the account associated with the load balancer. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "description", "description": "the description of the load balancer rule", "type": "string", "length": 4096, "required": false }, { "name": "openfirewall", "description": "if true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when LB rule is being created for VPC guest network 2) in all other cases defaulted to true", "type": "boolean", "length": 255, "required": false }, { "name": "publicipid", "description": "public IP address ID from where the network traffic will be load balanced from", "type": "uuid", "length": 255, "required": false, "related": "restartNetwork,updateIpAddress,listPublicIpAddresses,associateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "protocol", "description": "The protocol for the LB", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the domain ID associated with the load balancer", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "networkid", "description": "The guest network this rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "name", "description": "name of the load balancer rule", "type": "string", "length": 255, "required": true }, { "name": "privateport", "description": "the private port of the private IP address/virtual machine where the network traffic will be load balanced to", "type": "integer", "length": 255, "required": true }, { "name": "algorithm", "description": "load balancer algorithm (source, roundrobin, leastconn)", "type": "string", "length": 255, "required": true }, { "name": "publicport", "description": "the public port from where the network traffic will be load balanced from", "type": "integer", "length": 255, "required": true }, { "name": "cidrlist", "description": "the CIDR list to forward traffic from", "type": "list", "length": 255, "required": false } ], "response": [ { }, { }, { "name": "id", "description": "the load balancer rule ID", "type": "string" }, { "name": "networkid", "description": "the id of the guest network the lb rule belongs to", "type": "string" }, { "name": "publicipid", "description": "the public ip address id", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "privateport", "description": "the private port", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "algorithm", "description": "the load balancer algorithm (source, roundrobin, leastconn)", "type": "string" }, { "name": "domain", "description": "the domain of the load balancer rule", "type": "string" }, { "name": "name", "description": "the name of the load balancer", "type": "string" }, { "name": "protocol", "description": "the protocol of the loadbalanacer rule", "type": "string" }, { "name": "zoneid", "description": "the id of the zone the rule belongs to", "type": "string" }, { "name": "domainid", "description": "the domain ID of the load balancer rule", "type": "string" }, { "name": "zonename", "description": "the name of the zone the load balancer rule belongs to", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "project", "description": "the project name of the load balancer", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with load balancer", "type": "list", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "account", "description": "the account of the load balancer rule", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "projectid", "description": "the project id of the load balancer", "type": "string" }, { "name": "publicip", "description": "the public ip address", "type": "string" }, { "name": "publicport", "description": "the public port", "type": "string" }, { "name": "description", "description": "the description of the load balancer", "type": "string" } ] }, { "name": "listNuageVspDomainTemplates", "description": "Lists Nuage VSP domain templates", "since": "4.11.0", "isasync": false, "related": "listNuageVspGlobalDomainTemplate,upgradeRouterTemplate", "params": [ { "name": "keyword", "description": "filters the domain templates which contain the keyword", "type": "string", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "the physical network ID", "type": "uuid", "length": 255, "required": false, "related": "updatePhysicalNetwork,createPhysicalNetwork" }, { "name": "domainid", "description": "the domain ID", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "zoneid", "description": "the zone ID", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "addGuestOsMapping", "description": "Adds a guest OS name to hypervisor OS name mapping", "since": "4.4.0", "isasync": true, "related": "updateGuestOsMapping", "params": [ { "name": "osnameforhypervisor", "description": "OS name specific to the hypervisor", "type": "string", "length": 255, "required": true }, { "name": "hypervisor", "description": "Hypervisor type. One of : XenServer, KVM, VMWare", "type": "string", "length": 255, "required": true }, { "name": "osdisplayname", "description": "Display Name of Guest OS standard type. Either Display Name or UUID must be passed", "type": "string", "length": 255, "required": false }, { "name": "ostypeid", "description": "UUID of Guest OS type. Either the UUID or Display Name must be passed", "type": "uuid", "length": 255, "required": false, "related": "addGuestOs,listOsTypes" }, { "name": "hypervisorversion", "description": "Hypervisor version to create the mapping for. Use 'default' for default versions", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the Guest OS mapping", "type": "string" }, { "name": "isuserdefined", "description": "is the mapping user defined", "type": "string" }, { "name": "osdisplayname", "description": "standard display name for the Guest OS", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "ostypeid", "description": "the ID of the Guest OS type", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor", "type": "string" }, { "name": "osnameforhypervisor", "description": "hypervisor specific name for the Guest OS", "type": "string" }, { "name": "hypervisorversion", "description": "version of the hypervisor for mapping", "type": "string" }, { }, { } ] }, { "name": "disableOutOfBandManagementForZone", "description": "Disables out-of-band management for a zone", "since": "4.9.0", "isasync": true, "related": "disableOutOfBandManagementForHost,enableOutOfBandManagementForHost,disableOutOfBandManagementForCluster,enableOutOfBandManagementForZone,enableOutOfBandManagementForCluster,issueOutOfBandManagementPowerAction,changeOutOfBandManagementPassword", "params": [ { "name": "zoneid", "description": "the ID of the zone", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { }, { "name": "description", "description": "the operation result description", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { }, { "name": "password", "description": "the out-of-band management interface password", "type": "string" }, { "name": "enabled", "description": "true if out-of-band management is enabled for the host", "type": "boolean" }, { "name": "action", "description": "the out-of-band management action (if issued)", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "driver", "description": "the out-of-band management driver for the host", "type": "string" }, { "name": "address", "description": "the out-of-band management interface address", "type": "string" }, { "name": "username", "description": "the out-of-band management interface username", "type": "string" }, { "name": "port", "description": "the out-of-band management interface port", "type": "string" }, { "name": "powerstate", "description": "the out-of-band management interface powerState of the host", "type": "powerstate" }, { "name": "status", "description": "the operation result", "type": "boolean" } ] }, { "name": "updateNetworkOffering", "description": "Updates a network offering.", "isasync": false, "related": "listNetworkOfferings,createNetworkOffering", "params": [ { "name": "id", "description": "the id of the network offering", "type": "uuid", "length": 255, "required": false, "related": "listNetworkOfferings,createNetworkOffering,updateNetworkOffering" }, { "name": "displaytext", "description": "the display text of the network offering", "type": "string", "length": 255, "required": false }, { "name": "maxconnections", "description": "maximum number of concurrent connections supported by the network offering", "type": "integer", "length": 255, "required": false }, { "name": "keepaliveenabled", "description": "if true keepalive will be turned on in the loadbalancer. At the time of writing this has only an effect on haproxy; the mode http and httpclose options are unset in the haproxy conf file.", "type": "boolean", "length": 255, "required": false }, { "name": "tags", "description": "the tags for the network offering.", "type": "string", "length": 4096, "required": false }, { "name": "availability", "description": "the availability of network offering. Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering", "type": "string", "length": 255, "required": false }, { "name": "state", "description": "update state for the network offering", "type": "string", "length": 255, "required": false }, { "name": "sortkey", "description": "sort key of the network offering, integer", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "the name of the network offering", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "supportsstrechedl2subnet", "description": "true if network offering supports network that span multiple zones", "type": "boolean" }, { "name": "specifyvlan", "description": "true if network offering supports vlans, false otherwise", "type": "boolean" }, { "name": "availability", "description": "availability of the network offering", "type": "string" }, { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" } ] } ] }, { "name": "tags", "description": "the tags for the network offering", "type": "string" }, { }, { "name": "networkrate", "description": "data transfer rate in megabits per second allowed.", "type": "integer" }, { "name": "details", "description": "additional key/value details tied with network offering", "type": "map" }, { "name": "maxconnections", "description": "maximum number of concurrents connections to be handled by lb", "type": "integer" }, { "name": "supportspublicaccess", "description": "true if network offering supports public access for guest networks", "type": "boolean" }, { "name": "ispersistent", "description": "true if network offering supports persistent networks, false otherwise", "type": "boolean" }, { "name": "guestiptype", "description": "guest type of the network offering, can be Shared or Isolated", "type": "string" }, { "name": "egressdefaultpolicy", "description": "true if guest network default egress policy is allow; false if default egress policy is deny", "type": "boolean" }, { "name": "displaytext", "description": "an alternate display text of the network offering.", "type": "string" }, { "name": "forvpc", "description": "true if network offering can be used by VPC networks only", "type": "boolean" }, { "name": "serviceofferingid", "description": "the ID of the service offering used by virtual router provider", "type": "string" }, { "name": "state", "description": "state of the network offering. Can be Disabled/Enabled/Inactive", "type": "string" }, { "name": "isdefault", "description": "true if network offering is default, false otherwise", "type": "boolean" }, { }, { "name": "id", "description": "the id of the network offering", "type": "string" }, { "name": "traffictype", "description": "the traffic type for the network offering, supported types are Public, Management, Control, Guest, Vlan or Storage.", "type": "string" }, { "name": "conservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "name", "description": "the name of the network offering", "type": "string" }, { "name": "specifyipranges", "description": "true if network offering supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "created", "description": "the date this network offering was created", "type": "date" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteEgressFirewallRule", "description": "Deletes an egress firewall rule", "isasync": true, "params": [ { "name": "id", "description": "the ID of the firewall rule", "type": "uuid", "length": 255, "required": true, "related": "createIpForwardingRule,listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "stopSystemVm", "description": "Stops a system VM.", "isasync": true, "related": "migrateSystemVm,changeServiceForSystemVm,startSystemVm,listSystemVms", "params": [ { "name": "id", "description": "The ID of the system virtual machine", "type": "uuid", "length": 255, "required": true, "related": "stopSystemVm,migrateSystemVm,changeServiceForSystemVm,startSystemVm,listSystemVms" }, { "name": "forced", "description": "Force stop the VM. The caller knows the VM is stopped.", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "systemvmtype", "description": "the system VM type", "type": "string" }, { "name": "privateip", "description": "the private IP address for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "id", "description": "the ID of the system VM", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the system vm", "type": "string" }, { }, { "name": "hostname", "description": "the hostname for the system VM", "type": "string" }, { "name": "created", "description": "the date and time the system VM was created", "type": "date" }, { "name": "state", "description": "the state of the system VM", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the system vm", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the system VM", "type": "string" }, { }, { "name": "publicip", "description": "the public IP address for the system VM", "type": "string" }, { "name": "templateid", "description": "the template ID for the system VM", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the system VM", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the system VM", "type": "string" }, { "name": "hostid", "description": "the host ID for the system VM", "type": "string" }, { "name": "privatemacaddress", "description": "the private MAC address for the system VM", "type": "string" }, { "name": "activeviewersessions", "description": "the number of active console sessions for the console proxy system vm", "type": "integer" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the system vm", "type": "string" }, { "name": "guestvlan", "description": "guest vlan range", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "name", "description": "the name of the system VM", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the system VM", "type": "string" }, { "name": "zonename", "description": "the Zone name for the system VM", "type": "string" }, { "name": "jobid", "description": "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "string" }, { "name": "gateway", "description": "the gateway for the system VM", "type": "string" }, { "name": "dns2", "description": "the second DNS for the system VM", "type": "string" }, { "name": "publicvlan", "description": "public vlan range", "type": "list" }, { "name": "privatenetmask", "description": "the private netmask for the system VM", "type": "string" }, { "name": "dns1", "description": "the first DNS for the system VM", "type": "string" }, { "name": "podid", "description": "the Pod ID for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "integer" } ] }, { "name": "updateVPC", "description": "Updates a VPC", "isasync": true, "related": "migrateVPC,listVPCs,listVPCs,createVPC,restartVPC,createVPC,updateVPC", "params": [ { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "fordisplay", "description": "an optional field, whether to the display the vpc to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "the id of the VPC", "type": "uuid", "length": 255, "required": true, "related": "migrateVPC,listVPCs,updateVPC,listVPCs,createVPC,restartVPC,createVPC,updateVPC" }, { "name": "name", "description": "the name of the VPC", "type": "string", "length": 255, "required": false }, { "name": "displaytext", "description": "the display text of the VPC", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" } ] }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "name", "description": "the capability name", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "value", "description": "the capability value", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" } ] }, { "name": "vpcofferingid", "description": "vpc offering id the VPC is created from", "type": "string" }, { "name": "id", "description": "the id of the VPC", "type": "string" }, { }, { "name": "tags", "description": "the list of resource tags associated with the project", "type": "list", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "created", "description": "the date this VPC was created", "type": "date" }, { "name": "redundantvpcrouter", "description": "if this VPC has redundant router", "type": "boolean" }, { "name": "fordisplay", "description": "is vpc for display to the regular user", "type": "boolean" }, { "name": "restartrequired", "description": "true VPC requires restart", "type": "boolean" }, { "name": "state", "description": "state of the VPC. Can be Inactive/Enabled", "type": "string" }, { "name": "networkdomain", "description": "the network domain of the VPC", "type": "string" }, { }, { "name": "regionlevelvpc", "description": "true if VPC is region level", "type": "boolean" }, { "name": "zonename", "description": "the name of the zone the VPC belongs to", "type": "string" }, { "name": "cidr", "description": "the cidr the VPC", "type": "string" }, { "name": "domainid", "description": "the domain id of the VPC owner", "type": "string" }, { "name": "distributedvpcrouter", "description": "is VPC uses distributed router for one hop forwarding and host based network ACL's", "type": "boolean" }, { "name": "account", "description": "the owner of the VPC", "type": "string" }, { "name": "zoneid", "description": "zone id of the vpc", "type": "string" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "displaytext", "description": "an alternate display text of the VPC.", "type": "string" }, { "name": "project", "description": "the project name of the VPC", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "projectid", "description": "the project id of the VPC", "type": "string" }, { "name": "name", "description": "the name of the VPC", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "network", "description": "the list of networks belongign to the VPC", "type": "list", "response": [ { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "name", "description": "the provider name", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "state", "description": "state of the network provider", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" } ] } ] }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "account", "description": "the owner of the network", "type": "string" } ] } ] }, { "name": "changeOutOfBandManagementPassword", "description": "Changes out-of-band management interface password on the host and updates the interface configuration in CloudStack if the operation succeeds, else reverts the old password", "since": "4.9.0", "isasync": true, "related": "disableOutOfBandManagementForHost,enableOutOfBandManagementForHost,disableOutOfBandManagementForCluster,enableOutOfBandManagementForZone,enableOutOfBandManagementForCluster,issueOutOfBandManagementPowerAction", "params": [ { "name": "password", "description": "the new host management interface password of maximum length 16, if none is provided a random password would be used", "type": "string", "length": 255, "required": false }, { "name": "hostid", "description": "the ID of the host", "type": "uuid", "length": 255, "required": true, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" } ], "response": [ { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "address", "description": "the out-of-band management interface address", "type": "string" }, { "name": "port", "description": "the out-of-band management interface port", "type": "string" }, { "name": "action", "description": "the out-of-band management action (if issued)", "type": "string" }, { "name": "status", "description": "the operation result", "type": "boolean" }, { "name": "powerstate", "description": "the out-of-band management interface powerState of the host", "type": "powerstate" }, { "name": "username", "description": "the out-of-band management interface username", "type": "string" }, { }, { "name": "enabled", "description": "true if out-of-band management is enabled for the host", "type": "boolean" }, { "name": "password", "description": "the out-of-band management interface password", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "description", "description": "the operation result description", "type": "string" }, { }, { "name": "driver", "description": "the out-of-band management driver for the host", "type": "string" } ] }, { "name": "listResourceDetails", "description": "List resource detail(s)", "since": "4.2", "isasync": false, "related": "listTags", "params": [ { "name": "fordisplay", "description": "if set to true, only details marked with display=true, are returned. False by default", "type": "boolean", "length": 255, "required": false, "since": "4.3" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "resourcetype", "description": "list by resource type", "type": "string", "length": 255, "required": true }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "key", "description": "list by key", "type": "string", "length": 255, "required": false }, { "name": "resourceid", "description": "list by resource id", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "value", "description": "list by key, value. Needs to be passed only along with key", "type": "string", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { }, { }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { "name": "listNuageUnderlayVlanIpRanges", "description": "enable Nuage underlay on vlan ip range", "since": "4.10", "isasync": false, "related": "", "params": [ { "name": "zoneid", "description": "the Zone ID of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "forvirtualnetwork", "description": "true if VLAN is of Virtual type, false if Direct", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "the account with which the VLAN IP range is associated. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the ID of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "listVlanIpRanges,dedicatePublicIpRange,createVlanIpRange" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the domain ID with which the VLAN IP range is associated. If used with the account parameter, returns all VLAN IP ranges for that account in the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "networkid", "description": "network id of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "vlan", "description": "the ID or VID of the VLAN. Default is an \"untagged\" VLAN.", "type": "string", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "physical network id of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "updatePhysicalNetwork,createPhysicalNetwork" }, { "name": "projectid", "description": "project who will own the VLAN", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "underlay", "description": "true to list only underlay enabled, false if not, empty for all", "type": "boolean", "length": 255, "required": false }, { "name": "podid", "description": "the Pod ID of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "listPods,createManagementNetworkIpRange,updatePod" } ], "response": [ { "name": "startip", "description": "the start ip of the VLAN IP range", "type": "string" }, { "name": "startipv6", "description": "the start ipv6 of the VLAN IP range", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "project", "description": "the project name of the vlan range", "type": "string" }, { }, { "name": "account", "description": "the account of the VLAN IP range", "type": "string" }, { "name": "podname", "description": "the Pod name for the VLAN IP range", "type": "string" }, { "name": "netmask", "description": "the netmask of the VLAN IP range", "type": "string" }, { }, { "name": "zoneid", "description": "the Zone ID of the VLAN IP range", "type": "string" }, { "name": "underlay", "description": "true if Nuage underlay enabled, false if not", "type": "boolean" }, { "name": "vlan", "description": "the ID or VID of the VLAN.", "type": "string" }, { "name": "projectid", "description": "the project id of the vlan range", "type": "string" }, { "name": "gateway", "description": "the gateway of the VLAN IP range", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domain", "description": "the domain name of the VLAN IP range", "type": "string" }, { "name": "id", "description": "the ID of the VLAN IP range", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "podid", "description": "the Pod ID for the VLAN IP range", "type": "string" }, { "name": "networkid", "description": "the network id of vlan range", "type": "string" }, { "name": "description", "description": "the description of the VLAN IP range", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "endip", "description": "the end ip of the VLAN IP range", "type": "string" }, { "name": "forsystemvms", "description": "indicates whether VLAN IP range is dedicated to system vms or not", "type": "boolean" }, { "name": "domainid", "description": "the domain ID of the VLAN IP range", "type": "string" }, { "name": "endipv6", "description": "the end ipv6 of the VLAN IP range", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the VLAN IP range", "type": "boolean" } ] }, { "name": "dedicateCluster", "description": "Dedicate an existing cluster", "isasync": true, "related": "listDedicatedClusters", "params": [ { "name": "clusterid", "description": "the ID of the Cluster", "type": "uuid", "length": 255, "required": true, "related": "addCluster,updateCluster" }, { "name": "domainid", "description": "the ID of the containing domain", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "account", "description": "the name of the account which needs dedication. Must be used with domainId.", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "domainid", "description": "the domain ID of the cluster", "type": "string" }, { "name": "accountid", "description": "the Account ID of the cluster", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "id", "description": "the ID of the dedicated resource", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "affinitygroupid", "description": "the Dedication Affinity Group ID of the cluster", "type": "string" }, { "name": "clusterid", "description": "the ID of the cluster", "type": "string" }, { "name": "clustername", "description": "the name of the cluster", "type": "string" } ] }, { "name": "createNetworkOffering", "description": "Creates a network offering.", "since": "3.0.0", "isasync": false, "related": "listNetworkOfferings", "params": [ { "name": "specifyipranges", "description": "true if network offering supports specifying ip ranges; defaulted to false if not specified", "type": "boolean", "length": 255, "required": false }, { "name": "egressdefaultpolicy", "description": "true if guest network default egress policy is allow; false if default egress policy is deny", "type": "boolean", "length": 255, "required": false }, { "name": "maxconnections", "description": "maximum number of concurrent connections supported by the network offering", "type": "integer", "length": 255, "required": false }, { "name": "details", "description": "Network offering details in key/value pairs. Supported keys are internallbprovider/publiclbprovider with service provider as a value, and promiscuousmode/macaddresschanges/forgedtransmits with true/false as value to accept/reject the security settings if available for a nic/portgroup", "type": "map", "length": 255, "required": false, "since": "4.2.0" }, { "name": "guestiptype", "description": "guest type of the network offering: Shared or Isolated", "type": "string", "length": 255, "required": true }, { "name": "serviceproviderlist", "description": "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network", "type": "map", "length": 255, "required": false }, { "name": "name", "description": "the name of the network offering", "type": "string", "length": 255, "required": true }, { "name": "ispersistent", "description": "true if network offering supports persistent networks; defaulted to false if not specified", "type": "boolean", "length": 255, "required": false }, { "name": "keepaliveenabled", "description": "if true keepalive will be turned on in the loadbalancer. At the time of writing this has only an effect on haproxy; the mode http and httpclose options are unset in the haproxy conf file.", "type": "boolean", "length": 255, "required": false }, { "name": "forvpc", "description": "true if network offering is meant to be used for VPC, false otherwise.", "type": "boolean", "length": 255, "required": false }, { "name": "supportedservices", "description": "services supported by the network offering", "type": "list", "length": 255, "required": true }, { "name": "servicecapabilitylist", "description": "desired service capabilities as part of network offering", "type": "map", "length": 255, "required": false }, { "name": "specifyvlan", "description": "true if network offering supports vlans", "type": "boolean", "length": 255, "required": false }, { "name": "traffictype", "description": "the traffic type for the network offering. Supported type in current release is GUEST only", "type": "string", "length": 255, "required": true }, { "name": "tags", "description": "the tags for the network offering.", "type": "string", "length": 4096, "required": false }, { "name": "conservemode", "description": "true if the network offering is IP conserve mode enabled", "type": "boolean", "length": 255, "required": false }, { "name": "networkrate", "description": "data transfer rate in megabits per second allowed", "type": "integer", "length": 255, "required": false }, { "name": "availability", "description": "the availability of network offering. Default value is Optional", "type": "string", "length": 255, "required": false }, { "name": "serviceofferingid", "description": "the service offering ID used by virtual router provider", "type": "uuid", "length": 255, "required": false, "related": "createServiceOffering,listServiceOfferings,updateServiceOffering" }, { "name": "displaytext", "description": "the display text of the network offering", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "supportsstrechedl2subnet", "description": "true if network offering supports network that span multiple zones", "type": "boolean" }, { "name": "guestiptype", "description": "guest type of the network offering, can be Shared or Isolated", "type": "string" }, { "name": "supportspublicaccess", "description": "true if network offering supports public access for guest networks", "type": "boolean" }, { "name": "traffictype", "description": "the traffic type for the network offering, supported types are Public, Management, Control, Guest, Vlan or Storage.", "type": "string" }, { "name": "networkrate", "description": "data transfer rate in megabits per second allowed.", "type": "integer" }, { "name": "ispersistent", "description": "true if network offering supports persistent networks, false otherwise", "type": "boolean" }, { "name": "displaytext", "description": "an alternate display text of the network offering.", "type": "string" }, { "name": "forvpc", "description": "true if network offering can be used by VPC networks only", "type": "boolean" }, { }, { "name": "tags", "description": "the tags for the network offering", "type": "string" }, { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" } ] } ] }, { "name": "availability", "description": "availability of the network offering", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "isdefault", "description": "true if network offering is default, false otherwise", "type": "boolean" }, { "name": "specifyvlan", "description": "true if network offering supports vlans, false otherwise", "type": "boolean" }, { "name": "id", "description": "the id of the network offering", "type": "string" }, { "name": "name", "description": "the name of the network offering", "type": "string" }, { "name": "state", "description": "state of the network offering. Can be Disabled/Enabled/Inactive", "type": "string" }, { "name": "specifyipranges", "description": "true if network offering supports specifying ip ranges, false otherwise", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "egressdefaultpolicy", "description": "true if guest network default egress policy is allow; false if default egress policy is deny", "type": "boolean" }, { "name": "conservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "maxconnections", "description": "maximum number of concurrents connections to be handled by lb", "type": "integer" }, { "name": "details", "description": "additional key/value details tied with network offering", "type": "map" }, { "name": "serviceofferingid", "description": "the ID of the service offering used by virtual router provider", "type": "string" }, { "name": "created", "description": "the date this network offering was created", "type": "date" } ] }, { "name": "createIpForwardingRule", "description": "Creates an IP forwarding rule", "isasync": true, "related": "listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules", "params": [ { "name": "endport", "description": "the end port for the rule", "type": "integer", "length": 255, "required": false }, { "name": "ipaddressid", "description": "the public IP address ID of the forwarding rule, already associated via associateIp", "type": "uuid", "length": 255, "required": true, "related": "restartNetwork,updateIpAddress,listPublicIpAddresses,associateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "openfirewall", "description": "if true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitly. Has value true by default", "type": "boolean", "length": 255, "required": false }, { "name": "startport", "description": "the start port for the rule", "type": "integer", "length": 255, "required": true }, { "name": "cidrlist", "description": "the CIDR list to forward traffic from", "type": "list", "length": 255, "required": false }, { "name": "protocol", "description": "the protocol for the rule. Valid values are TCP or UDP.", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "privateendport", "description": "the ending port of port forwarding rule's private port range", "type": "string" }, { }, { "name": "virtualmachinedisplayname", "description": "the VM display name for the port forwarding rule", "type": "string" }, { "name": "ipaddressid", "description": "the public ip address id for the port forwarding rule", "type": "string" }, { "name": "vmguestip", "description": "the vm ip address for the port forwarding rule", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "privateport", "description": "the starting port of port forwarding rule's private port range", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "networkid", "description": "the id of the guest network the port forwarding rule belongs to", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "id", "description": "the ID of the port forwarding rule", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "ipaddress", "description": "the public ip address for the port forwarding rule", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "publicport", "description": "the starting port of port forwarding rule's public port range", "type": "string" }, { "name": "virtualmachinename", "description": "the VM name for the port forwarding rule", "type": "string" }, { "name": "virtualmachineid", "description": "the VM ID for the port forwarding rule", "type": "string" }, { "name": "fordisplay", "description": "is firewall for display to the regular user", "type": "boolean" }, { }, { "name": "protocol", "description": "the protocol of the port forwarding rule", "type": "string" }, { "name": "publicendport", "description": "the ending port of port forwarding rule's private port range", "type": "string" } ] }, { "name": "listElastistorInterface", "description": "Lists the network Interfaces of elastistor", "isasync": false, "related": "listElastistorVolume", "params": [ { "name": "controllerid", "description": "controller id", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "compression", "description": "compression", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "sync", "description": "syncronization", "type": "string" }, { "name": "deduplication", "description": "deduplication", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "name", "description": "the name of the volume", "type": "string" }, { "name": "graceallowed", "description": "graceallowed", "type": "string" }, { "name": "id", "description": "the id of the volume", "type": "string" } ] }, { "name": "listVolumesMetrics", "description": "Lists volume metrics", "since": "4.9.3", "isasync": false, "related": "", "params": [ { "name": "name", "description": "the name of the disk volume", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "displayvolume", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "the ID of the disk volume", "type": "uuid", "length": 255, "required": false, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,detachVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "type", "description": "the type of disk volume", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "ids", "description": "the IDs of the volumes, mutually exclusive with id", "type": "list", "length": 255, "required": false, "since": "4.9", "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,detachVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "diskofferingid", "description": "list volumes by disk offering", "type": "uuid", "length": 255, "required": false, "since": "4.4", "related": "createDiskOffering,listDiskOfferings,updateDiskOffering" }, { "name": "virtualmachineid", "description": "the ID of the virtual machine", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,updateVmNicIp,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "zoneid", "description": "the ID of the availability zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "hostid", "description": "list volumes on specified host", "type": "uuid", "length": 255, "required": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" }, { "name": "storageid", "description": "the ID of the storage pool, available to ROOT admin only", "type": "string", "length": 255, "required": false, "since": "4.3", "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "podid", "description": "the pod id the disk volume belongs to", "type": "uuid", "length": 255, "required": false, "related": "listPods,createManagementNetworkIpRange,updatePod" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "clusterid", "description": "the cluster id the disk volume belongs to", "type": "uuid", "length": 255, "required": false, "related": "addCluster,updateCluster" } ], "response": [ { "name": "virtualsize", "description": "the bytes actually consumed on disk", "type": "long" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "storage", "description": "name of the primary storage hosting the disk volume", "type": "string" }, { "name": "clusterid", "description": "cluster id of the volume", "type": "string" }, { "name": "snapshotid", "description": "ID of the snapshot from which this volume was created", "type": "string" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk volume", "type": "long" }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk volume", "type": "long" }, { "name": "created", "description": "the date the disk volume was created", "type": "date" }, { "name": "storageid", "description": "id of the primary storage hosting the disk volume; returned to admin user only", "type": "string" }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "clustername", "description": "cluster name where the volume is allocated", "type": "string" }, { "name": "zoneid", "description": "ID of the availability zone", "type": "string" }, { "name": "physicalsize", "description": "the bytes alloaated", "type": "long" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "displayvolume", "description": "an optional field whether to the display the volume to the end user or not.", "type": "boolean" }, { "name": "vmstate", "description": "state of the virtual machine", "type": "string" }, { "name": "quiescevm", "description": "need quiesce vm or not when taking snapshot", "type": "boolean" }, { "name": "size", "description": "size of the disk volume", "type": "long" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "vmname", "description": "name of the virtual machine", "type": "string" }, { "name": "miniops", "description": "min iops of the disk volume", "type": "long" }, { "name": "attached", "description": "the date the volume was attached to a VM instance", "type": "date" }, { "name": "diskofferingid", "description": "ID of the disk offering", "type": "string" }, { "name": "deviceid", "description": "the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached.", "type": "long" }, { "name": "chaininfo", "description": "the chain info of the volume", "type": "string" }, { "name": "status", "description": "the status of the volume", "type": "string" }, { "name": "serviceofferingid", "description": "ID of the service offering for root disk", "type": "string" }, { "name": "vmdisplayname", "description": "display name of the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "name of the disk offering", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "type", "description": "type of the disk volume (ROOT or DATADISK)", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hypervisor", "description": "Hypervisor the volume belongs to", "type": "string" }, { "name": "id", "description": "ID of the disk volume", "type": "string" }, { "name": "destroyed", "description": "the boolean state of whether the volume is destroyed or not", "type": "boolean" }, { "name": "name", "description": "name of the disk volume", "type": "string" }, { "name": "isextractable", "description": "true if the volume is extractable, false otherwise", "type": "boolean" }, { "name": "serviceofferingdisplaytext", "description": "the display text of the service offering for root disk", "type": "string" }, { }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "podid", "description": "pod id of the volume", "type": "string" }, { "name": "storagetype", "description": "shared or local storage", "type": "string" }, { "name": "virtualmachineid", "description": "id of the virtual machine", "type": "string" }, { "name": "utilization", "description": "the disk utilization", "type": "string" }, { "name": "diskofferingdisplaytext", "description": "the display text of the disk offering", "type": "string" }, { "name": "serviceofferingname", "description": "name of the service offering for root disk", "type": "string" }, { "name": "state", "description": "the state of the disk volume", "type": "string" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes.", "type": "string" }, { "name": "sizegb", "description": "disk size in GiB", "type": "string" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk volume", "type": "long" }, { "name": "zonename", "description": "name of the availability zone", "type": "string" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk volume", "type": "long" }, { "name": "path", "description": "the path of the volume", "type": "string" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { }, { "name": "maxiops", "description": "max iops of the disk volume", "type": "long" }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "podname", "description": "pod name of the volume", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" } ] }, { "name": "listSslCerts", "description": "Lists SSL certificates", "isasync": false, "related": "uploadSslCert", "params": [ { "name": "lbruleid", "description": "Load balancer rule ID", "type": "uuid", "length": 255, "required": false, "related": "listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" }, { "name": "accountid", "description": "Account ID", "type": "uuid", "length": 255, "required": false, "related": "enableAccount,createAccount,markDefaultZoneForAccount,updateAccount,listAccounts,disableAccount,listAccounts" }, { "name": "projectid", "description": "Project that owns the SSL certificate", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "certid", "description": "ID of SSL certificate", "type": "uuid", "length": 255, "required": false, "related": "uploadSslCert,listSslCerts" } ], "response": [ { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "certificate", "description": "certificate", "type": "string" }, { "name": "account", "description": "account for the certificate", "type": "string" }, { "name": "name", "description": "name", "type": "string" }, { }, { "name": "projectid", "description": "the project id of the certificate", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "project", "description": "the project name of the certificate", "type": "string" }, { "name": "fingerprint", "description": "certificate fingerprint", "type": "string" }, { "name": "id", "description": "SSL certificate ID", "type": "string" }, { "name": "certchain", "description": "certificate chain", "type": "string" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "loadbalancerrulelist", "description": "List of loabalancers this certificate is bound to", "type": "list" } ] }, { "name": "updateVmNicIp", "description": "Update the default Ip of a VM Nic", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "nicid", "description": "the ID of the nic to which you want to assign private IP", "type": "uuid", "length": 255, "required": true, "related": "listNics" }, { "name": "ipaddress", "description": "Secondary IP Address", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" } ] }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" } ] }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] } ] }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" } ] }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" } ] }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" } ] }, { "name": "updateLBStickinessPolicy", "description": "Updates load balancer stickiness policy", "since": "4.4", "isasync": true, "related": "createLBStickinessPolicy,listLBStickinessPolicies", "params": [ { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "id of lb stickiness policy", "type": "uuid", "length": 255, "required": true, "related": "createLBStickinessPolicy,listLBStickinessPolicies,updateLBStickinessPolicy" }, { "name": "fordisplay", "description": "an optional field, whether to the display the policy to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "description", "description": "the description of the Stickiness policy", "type": "string" }, { "name": "zoneid", "description": "the id of the zone the Stickiness policy belongs to", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "account", "description": "the account of the Stickiness policy", "type": "string" }, { "name": "state", "description": "the state of the policy", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the domain ID of the Stickiness policy", "type": "string" }, { "name": "domain", "description": "the domain of the Stickiness policy", "type": "string" }, { "name": "lbruleid", "description": "the LB rule ID", "type": "string" }, { }, { }, { "name": "name", "description": "the name of the Stickiness policy", "type": "string" }, { "name": "stickinesspolicy", "description": "the list of stickinesspolicies", "type": "list", "response": [ { "name": "id", "description": "the LB Stickiness policy ID", "type": "string" }, { "name": "state", "description": "the state of the policy", "type": "string" }, { "name": "params", "description": "the params of the policy", "type": "map" }, { "name": "name", "description": "the name of the Stickiness policy", "type": "string" }, { "name": "fordisplay", "description": "is policy for display to the regular user", "type": "boolean" }, { "name": "description", "description": "the description of the Stickiness policy", "type": "string" }, { "name": "methodname", "description": "the method name of the Stickiness policy", "type": "string" } ] } ] }, { "name": "listPrivateGateways", "description": "List private gateways", "isasync": false, "related": "createPrivateGateway", "params": [ { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "ipaddress", "description": "list gateways by ip address", "type": "string", "length": 255, "required": false }, { "name": "vpcid", "description": "list gateways by vpc", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,listVPCs,createVPC,restartVPC,createVPC,updateVPC" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "vlan", "description": "list gateways by vlan", "type": "string", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "list private gateway by id", "type": "uuid", "length": 255, "required": false, "related": "createPrivateGateway,listPrivateGateways" }, { "name": "state", "description": "list gateways by state", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "netmask", "description": "the private gateway's netmask", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "state", "description": "State of the gateway, can be Creating, Ready, Deleting", "type": "string" }, { "name": "project", "description": "the project name of the private gateway", "type": "string" }, { "name": "id", "description": "the id of the private gateway", "type": "string" }, { "name": "aclid", "description": "ACL Id set for private gateway", "type": "string" }, { "name": "zonename", "description": "the name of the zone the private gateway belongs to", "type": "string" }, { "name": "ipaddress", "description": "the private gateway's ip address", "type": "string" }, { "name": "zoneid", "description": "zone id of the private gateway", "type": "string" }, { "name": "domain", "description": "the domain associated with the private gateway", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "projectid", "description": "the project id of the private gateway", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { }, { "name": "vpcid", "description": "VPC the private gateaway belongs to", "type": "string" }, { "name": "gateway", "description": "the gateway", "type": "string" }, { "name": "sourcenatsupported", "description": "Souce Nat enable status", "type": "boolean" }, { "name": "vlan", "description": "the network implementation uri for the private gateway", "type": "string" }, { "name": "account", "description": "the account associated with the private gateway", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the private gateway", "type": "string" } ] }, { "name": "listPods", "description": "Lists all Pods.", "isasync": false, "related": "createManagementNetworkIpRange,updatePod", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "allocationstate", "description": "list pods by allocation state", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "list Pods by name", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "list Pods by ID", "type": "uuid", "length": 255, "required": false, "related": "listPods,createManagementNetworkIpRange,updatePod" }, { "name": "zoneid", "description": "list Pods by Zone ID", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "showcapacities", "description": "flag to display the capacity of the pods", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "capacity", "description": "the capacity of the Pod", "type": "list", "response": [ { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "name", "description": "the capacity name", "type": "string" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "zonename", "description": "the Zone name", "type": "string" } ] }, { "name": "startip", "description": "the starting IP for the Pod", "type": "list" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "name", "description": "the name of the Pod", "type": "string" }, { "name": "forsystemvms", "description": "indicates if range is dedicated for CPVM and SSVM", "type": "list" }, { }, { "name": "id", "description": "the ID of the Pod", "type": "string" }, { "name": "netmask", "description": "the netmask of the Pod", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "zoneid", "description": "the Zone ID of the Pod", "type": "string" }, { "name": "vlanid", "description": "indicates Vlan ID for the range", "type": "list" }, { "name": "gateway", "description": "the gateway of the Pod", "type": "string" }, { "name": "allocationstate", "description": "the allocation state of the Pod", "type": "string" }, { "name": "zonename", "description": "the Zone name of the Pod", "type": "string" }, { "name": "endip", "description": "the ending IP for the Pod", "type": "list" } ] }, { "name": "startInternalLoadBalancerVM", "description": "Starts an existing internal lb vm.", "isasync": true, "related": "listRouters,changeServiceForRouter,destroyRouter,stopNetScalerVpx,listInternalLoadBalancerVMs,rebootRouter,stopInternalLoadBalancerVM", "params": [ { "name": "id", "description": "the ID of the internal lb vm", "type": "uuid", "length": 255, "required": true, "related": "listRouters,changeServiceForRouter,destroyRouter,stopNetScalerVpx,listInternalLoadBalancerVMs,rebootRouter,stopInternalLoadBalancerVM,startInternalLoadBalancerVM" } ], "response": [ { }, { "name": "hostname", "description": "the hostname for the router", "type": "string" }, { "name": "scriptsversion", "description": "the version of scripts", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "guestmacaddress", "description": "the guest MAC address for the router", "type": "string" }, { "name": "version", "description": "the version of template", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the router", "type": "string" }, { "name": "created", "description": "the date and time the router was created", "type": "date" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "guestnetworkid", "description": "the ID of the corresponding guest network", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the router", "type": "string" }, { "name": "hostid", "description": "the host ID for the router", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "zonename", "description": "the Zone name for the router", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "vpcname", "description": "the name of VPC the router belongs to", "type": "string" }, { "name": "state", "description": "the state of the router", "type": "state" }, { "name": "vpcid", "description": "VPC the router belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the router", "type": "string" }, { "name": "name", "description": "the name of the router", "type": "string" }, { "name": "publicnetworkid", "description": "the ID of the corresponding public network", "type": "string" }, { "name": "publicip", "description": "the public IP address for the router", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the router", "type": "string" }, { "name": "guestipaddress", "description": "the guest IP address for the router", "type": "string" }, { "name": "gateway", "description": "the gateway for the router", "type": "string" }, { "name": "isredundantrouter", "description": "if this router is an redundant virtual router", "type": "boolean" }, { "name": "linklocalip", "description": "the link local IP address for the router", "type": "string" }, { "name": "guestnetworkname", "description": "the name of the corresponding guest network", "type": "string" }, { }, { "name": "requiresupgrade", "description": "true if the router template requires upgrader", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "nic", "description": "the list of nics associated with the router", "type": "set", "response": [ { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" } ] }, { "name": "account", "description": "the account associated with the router", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the router", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the router", "type": "string" }, { "name": "guestnetmask", "description": "the guest netmask for the router", "type": "string" }, { "name": "dns2", "description": "the second DNS for the router", "type": "string" }, { "name": "role", "description": "role of the domain router", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the router", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "redundantstate", "description": "the state of redundant virtual router", "type": "string" }, { "name": "linklocalnetworkid", "description": "the ID of the corresponding link local network", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the router", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "dns1", "description": "the first DNS for the router", "type": "string" }, { "name": "templateid", "description": "the template ID for the router", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the router", "type": "string" }, { "name": "domainid", "description": "the domain ID associated with the router", "type": "string" }, { "name": "podid", "description": "the Pod ID for the router", "type": "string" } ] }, { "name": "updateDiskOffering", "description": "Updates a disk offering.", "isasync": false, "related": "createDiskOffering,listDiskOfferings", "params": [ { "name": "sortkey", "description": "sort key of the disk offering, integer", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "ID of the disk offering", "type": "uuid", "length": 255, "required": true, "related": "createDiskOffering,listDiskOfferings,updateDiskOffering" }, { "name": "name", "description": "updates name of the disk offering with this value", "type": "string", "length": 255, "required": false }, { "name": "displayoffering", "description": "an optional field, whether to display the offering to the end user or not.", "type": "boolean", "length": 255, "required": false }, { "name": "displaytext", "description": "updates alternate display text of the disk offering with this value", "type": "string", "length": 4096, "required": false } ], "response": [ { "name": "diskIopsWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "storagetype", "description": "the storage type for this disk offering", "type": "string" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes. Valid values are thin, sparse, fat.", "type": "string" }, { "name": "displayoffering", "description": "whether to display the offering to the end user or not.", "type": "boolean" }, { "name": "domain", "description": "the domain name this disk offering belongs to. Ignore this information as it is not currently applicable.", "type": "string" }, { "name": "diskBytesWriteRateMax", "description": "burst bytes write rate of the disk offering", "type": "long" }, { "name": "disksize", "description": "the size of the disk offering in GB", "type": "long" }, { "name": "diskBytesReadRateMax", "description": "burst bytes read rate of the disk offering", "type": "long" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk offering", "type": "long" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk offering", "type": "long" }, { "name": "hypervisorsnapshotreserve", "description": "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "diskBytesReadRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "maxiops", "description": "the max iops of the disk offering", "type": "long" }, { "name": "domainid", "description": "the domain ID this disk offering belongs to. Ignore this information as it is not currently applicable.", "type": "string" }, { }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk offering", "type": "long" }, { }, { "name": "diskBytesWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "iscustomizediops", "description": "true if disk offering uses custom iops, false otherwise", "type": "boolean" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk offering", "type": "long" }, { "name": "id", "description": "unique ID of the disk offering", "type": "string" }, { "name": "diskIopsReadRateMaxLength", "description": "length (in second) of the burst", "type": "long" }, { "name": "iscustomized", "description": "true if disk offering uses custom size, false otherwise", "type": "boolean" }, { "name": "cacheMode", "description": "the cache mode to use for this disk offering. none, writeback or writethrough", "type": "string" }, { "name": "displaytext", "description": "an alternate display text of the disk offering.", "type": "string" }, { "name": "miniops", "description": "the min iops of the disk offering", "type": "long" }, { "name": "tags", "description": "the tags for the disk offering", "type": "string" }, { "name": "name", "description": "the name of the disk offering", "type": "string" }, { "name": "created", "description": "the date this disk offering was created", "type": "date" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "diskIopsReadRateMax", "description": "burst io requests read rate of the disk offering", "type": "long" }, { "name": "diskIopsWriteRateMax", "description": "burst io requests write rate of the disk offering", "type": "long" } ] }, { "name": "disableNuageUnderlayVlanIpRange", "description": "disable Nuage underlay on vlan ip range", "since": "4.10", "isasync": true, "params": [ { "name": "id", "description": "VLAN IP Range ID", "type": "uuid", "length": 255, "required": true, "related": "listVlanIpRanges,dedicatePublicIpRange,createVlanIpRange" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "listSnapshots", "description": "Lists all available snapshots for the account.", "isasync": false, "related": "archiveSnapshot,createSnapshot,createSnapshotFromVMSnapshot,revertSnapshot", "params": [ { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "zoneid", "description": "list snapshots by zone id", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "volumeid", "description": "the ID of the disk volume", "type": "uuid", "length": 255, "required": false, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,detachVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "lists snapshot by snapshot name", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "snapshottype", "description": "valid values are MANUAL or RECURRING.", "type": "string", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "ids", "description": "the IDs of the snapshots, mutually exclusive with id", "type": "list", "length": 255, "required": false, "since": "4.9", "related": "archiveSnapshot,createSnapshot,listSnapshots,createSnapshotFromVMSnapshot,revertSnapshot" }, { "name": "id", "description": "lists snapshot by snapshot ID", "type": "uuid", "length": 255, "required": false, "related": "archiveSnapshot,createSnapshot,listSnapshots,createSnapshotFromVMSnapshot,revertSnapshot" }, { "name": "intervaltype", "description": "valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "snapshottype", "description": "the type of the snapshot", "type": "string" }, { }, { "name": "intervaltype", "description": "valid types are hourly, daily, weekly, monthy, template, and none.", "type": "string" }, { "name": "created", "description": " the date the snapshot was created", "type": "date" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domain", "description": "the domain name of the snapshot's account", "type": "string" }, { "name": "volumeid", "description": "ID of the disk volume", "type": "string" }, { "name": "name", "description": "name of the snapshot", "type": "string" }, { "name": "zoneid", "description": "id of the availability zone", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with snapshot", "type": "list", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "account", "description": "the account associated with the snapshot", "type": "string" }, { "name": "project", "description": "the project name of the snapshot", "type": "string" }, { "name": "revertable", "description": "indicates whether the underlying storage supports reverting the volume to this snapshot", "type": "boolean" }, { "name": "volumetype", "description": "type of the disk volume", "type": "string" }, { "name": "volumename", "description": "name of the disk volume", "type": "string" }, { "name": "virtualsize", "description": "virtual size of backedup snapshot on image store", "type": "long" }, { "name": "osdisplayname", "description": "display name of the os on volume", "type": "string" }, { "name": "id", "description": "ID of the snapshot", "type": "string" }, { "name": "domainid", "description": "the domain ID of the snapshot's account", "type": "string" }, { "name": "state", "description": "the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage", "type": "state" }, { "name": "projectid", "description": "the project id of the snapshot", "type": "string" }, { "name": "ostypeid", "description": "id of the os on volume", "type": "string" }, { "name": "physicalsize", "description": "physical size of backedup snapshot on image store", "type": "long" }, { "name": "locationtype", "description": "valid location types are primary and secondary.", "type": "string" }, { } ] }, { "name": "addAccountToProject", "description": "Adds account to a project", "since": "3.0.0", "isasync": true, "params": [ { "name": "email", "description": "email to which invitation to the project is going to be sent", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "name of the account to be added to the project", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "ID of the project to add the account to", "type": "uuid", "length": 255, "required": true, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "resetVpnConnection", "description": "Reset site to site vpn connection", "isasync": true, "related": "createVpnConnection,listVpnConnections,updateVpnConnection", "params": [ { "name": "account", "description": "an optional account for connection. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "id of vpn connection", "type": "uuid", "length": 255, "required": true, "related": "createVpnConnection,resetVpnConnection,listVpnConnections,updateVpnConnection" }, { "name": "domainid", "description": "an optional domainId for connection. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" } ], "response": [ { "name": "account", "description": "the owner", "type": "string" }, { "name": "forceencap", "description": "if Force NAT Encapsulation is enabled for customer gateway", "type": "boolean" }, { "name": "ikepolicy", "description": "IKE policy of the customer gateway", "type": "string" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "project", "description": "the project name", "type": "string" }, { "name": "state", "description": "State of vpn connection", "type": "string" }, { "name": "passive", "description": "State of vpn connection", "type": "boolean" }, { "name": "ikelifetime", "description": "Lifetime of IKE SA of customer gateway", "type": "long" }, { "name": "gateway", "description": "public ip address id of the customer gateway", "type": "string" }, { "name": "dpd", "description": "if DPD is enabled for customer gateway", "type": "boolean" }, { "name": "s2svpngatewayid", "description": "the vpn gateway ID", "type": "string" }, { "name": "esppolicy", "description": "ESP policy of the customer gateway", "type": "string" }, { "name": "ipsecpsk", "description": "IPsec Preshared-Key of the customer gateway", "type": "string" }, { "name": "publicip", "description": "the public IP address", "type": "string" }, { "name": "esplifetime", "description": "Lifetime of ESP SA of customer gateway", "type": "long" }, { "name": "fordisplay", "description": "is connection for display to the regular user", "type": "boolean" }, { "name": "cidrlist", "description": "guest cidr list of the customer gateway", "type": "string" }, { "name": "projectid", "description": "the project id", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "id", "description": "the connection ID", "type": "string" }, { "name": "s2scustomergatewayid", "description": "the customer gateway ID", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the domain id of the owner", "type": "string" } ] }, { "name": "deleteSSHKeyPair", "description": "Deletes a keypair by name", "isasync": false, "params": [ { "name": "projectid", "description": "the project associated with keypair", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "account", "description": "the account associated with the keypair. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the domain ID associated with the keypair", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "name", "description": "Name of the keypair", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "createAutoScaleVmGroup", "description": "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", "isasync": true, "related": "enableAutoScaleVmGroup,disableAutoScaleVmGroup,listAutoScaleVmGroups,updateAutoScaleVmGroup", "params": [ { "name": "lbruleid", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" }, { "name": "scaleuppolicyids", "description": "list of scaleup autoscale policies", "type": "list", "length": 255, "required": true, "related": "updateAutoScalePolicy,listAutoScalePolicies" }, { "name": "fordisplay", "description": "an optional field, whether to the display the group to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "interval", "description": "the frequency at which the conditions have to be evaluated", "type": "integer", "length": 255, "required": false }, { "name": "scaledownpolicyids", "description": "list of scaledown autoscale policies", "type": "list", "length": 255, "required": true, "related": "updateAutoScalePolicy,listAutoScalePolicies" }, { "name": "maxmembers", "description": "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.", "type": "integer", "length": 255, "required": true }, { "name": "vmprofileid", "description": "the autoscale profile that contains information about the vms in the vm group.", "type": "uuid", "length": 255, "required": true, "related": "updateAutoScaleVmProfile,listAutoScaleVmProfiles,createAutoScaleVmProfile" }, { "name": "minmembers", "description": "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.", "type": "integer", "length": 255, "required": true } ], "response": [ { "name": "state", "description": "the current state of the AutoScale Vm Group", "type": "string" }, { "name": "domain", "description": "the domain name of the vm profile", "type": "string" }, { "name": "interval", "description": "the frequency at which the conditions have to be evaluated", "type": "int" }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { }, { "name": "vmprofileid", "description": "the autoscale profile that contains information about the vms in the vm group.", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "scaleuppolicies", "description": "list of scaleup autoscale policies", "type": "list" }, { "name": "scaledownpolicies", "description": "list of scaledown autoscale policies", "type": "list" }, { "name": "fordisplay", "description": "is group for display to the regular user", "type": "boolean" }, { "name": "maxmembers", "description": "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.", "type": "int" }, { "name": "lbruleid", "description": "the load balancer rule ID", "type": "string" }, { "name": "minmembers", "description": "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.", "type": "int" }, { "name": "project", "description": "the project name of the vm profile", "type": "string" }, { "name": "projectid", "description": "the project id vm profile", "type": "string" }, { "name": "id", "description": "the autoscale vm group ID", "type": "string" }, { "name": "domainid", "description": "the domain ID of the vm profile", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "searchLdap", "description": "Searches LDAP based on the username attribute", "since": "4.2.0", "isasync": false, "related": "listLdapUsers", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "query", "description": "query to search using", "type": "string", "length": 255, "required": true, "related": "searchLdap,listLdapUsers" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "lastname", "description": "The user's lastname", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domain", "description": "The user's domain", "type": "string" }, { "name": "username", "description": "The user's username", "type": "string" }, { "name": "email", "description": "The user's email", "type": "string" }, { }, { "name": "firstname", "description": "The user's firstname", "type": "string" }, { "name": "principal", "description": "The user's principle", "type": "string" } ] }, { "name": "deleteLoadBalancerRule", "description": "Deletes a load balancer rule.", "isasync": true, "params": [ { "name": "id", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "addBaremetalPxePingServer", "description": "add a baremetal ping pxe server", "isasync": true, "related": "", "params": [ { "name": "url", "description": "URL of the external pxe device", "type": "string", "length": 255, "required": true }, { "name": "pingcifspassword", "description": "Password of PING storage server", "type": "string", "length": 255, "required": false }, { "name": "tftpdir", "description": "Tftp root directory of PXE server", "type": "string", "length": 255, "required": true }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "updatePhysicalNetwork,createPhysicalNetwork" }, { "name": "password", "description": "Credentials to reach external pxe device", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "Credentials to reach external pxe device", "type": "string", "length": 255, "required": true }, { "name": "pingstorageserverip", "description": "PING storage server ip", "type": "string", "length": 255, "required": true }, { "name": "pingcifsusername", "description": "Username of PING storage server", "type": "string", "length": 255, "required": false }, { "name": "podid", "description": "Pod Id", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "pxeservertype", "description": "type of pxe device", "type": "string", "length": 255, "required": true }, { "name": "pingdir", "description": "Root directory on PING storage server", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "id", "description": "device id of ", "type": "string" }, { }, { "name": "tftpdir", "description": "Tftp root directory of PXE server", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "physicalnetworkid", "description": "the physical network to which this external dhcp device belongs to", "type": "string" }, { "name": "url", "description": "url", "type": "string" }, { "name": "pingstorageserverip", "description": "PING storage server ip", "type": "string" }, { "name": "pingdir", "description": "Root directory on PING storage server", "type": "string" } ] }, { "name": "listPortableIpRanges", "description": "list portable IP ranges", "isasync": false, "related": "createPortableIpRange", "params": [ { "name": "regionid", "description": "Id of a Region", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "Id of the portable ip range", "type": "uuid", "length": 255, "required": false, "related": "createPortableIpRange,listPortableIpRanges" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "netmask", "description": "the netmask of the VLAN IP range", "type": "string" }, { "name": "id", "description": "portable IP range ID", "type": "string" }, { "name": "vlan", "description": "the ID or VID of the VLAN.", "type": "string" }, { "name": "portableipaddress", "description": "List of portable IP and association with zone/network/vpc details that are part of GSLB rule", "type": "list", "response": [ { "name": "allocated", "description": "date the portal IP address was acquired", "type": "date" }, { "name": "domainid", "description": "the domain ID the portable IP address is associated with", "type": "string" }, { "name": "ipaddress", "description": "public IP address", "type": "string" }, { "name": "networkid", "description": "the ID of the Network where ip belongs to", "type": "string" }, { "name": "regionid", "description": "Region Id in which global load balancer is created", "type": "integer" }, { "name": "zoneid", "description": "the ID of the zone the public IP address belongs to", "type": "string" }, { "name": "accountid", "description": "the account ID the portable IP address is associated with", "type": "string" }, { "name": "state", "description": "State of the ip address. Can be: Allocatin, Allocated and Releasing", "type": "string" }, { "name": "vpcid", "description": "VPC the ip belongs to", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" } ] }, { "name": "endip", "description": "the end ip of the portable IP range", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "gateway", "description": "the gateway of the VLAN IP range", "type": "string" }, { "name": "regionid", "description": "Region Id in which portable ip range is provisioned", "type": "integer" }, { }, { }, { "name": "startip", "description": "the start ip of the portable IP range", "type": "string" } ] }, { "name": "getVirtualMachineUserData", "description": "Returns user data associated with the VM", "since": "4.4", "isasync": false, "related": "", "params": [ { "name": "virtualmachineid", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { }, { "name": "userdata", "description": "Base 64 encoded VM user data", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "virtualmachineid", "description": "the ID of the virtual machine", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listConfigurations", "description": "Lists all configurations.", "isasync": false, "related": "updateConfiguration", "params": [ { "name": "accountid", "description": "the ID of the Account to update the parameter value for corresponding account", "type": "uuid", "length": 255, "required": false, "related": "enableAccount,createAccount,markDefaultZoneForAccount,updateAccount,listAccounts,disableAccount,listAccounts" }, { "name": "storageid", "description": "the ID of the Storage pool to update the parameter value for corresponding storage pool", "type": "uuid", "length": 255, "required": false, "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "zoneid", "description": "the ID of the Zone to update the parameter value for corresponding zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "domainid", "description": "the ID of the Domain to update the parameter value for corresponding domain", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "name", "description": "lists configuration by name", "type": "string", "length": 255, "required": false }, { "name": "category", "description": "lists configurations by category", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "clusterid", "description": "the ID of the Cluster to update the parameter value for corresponding cluster", "type": "uuid", "length": 255, "required": false, "related": "addCluster,updateCluster" }, { "name": "imagestoreuuid", "description": "the ID of the Image Store to update the parameter value for corresponding image store", "type": "uuid", "length": 255, "required": false, "related": "listImageStores,addSecondaryStorage,updateCloudToUseObjectStore,addImageStore,listSwifts,addImageStoreS3" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "value", "description": "the value of the configuration", "type": "string" }, { "name": "scope", "description": "scope(zone/cluster/pool/account) of the parameter that needs to be updated", "type": "string" }, { "name": "name", "description": "the name of the configuration", "type": "string" }, { "name": "description", "description": "the description of the configuration", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "id", "description": "the value of the configuration", "type": "long" }, { "name": "category", "description": "the category of the configuration", "type": "string" } ] }, { "name": "disableStaticNat", "description": "Disables static rule for given IP address", "isasync": true, "params": [ { "name": "ipaddressid", "description": "the public IP address ID for which static NAT feature is being disabled", "type": "uuid", "length": 255, "required": true, "related": "restartNetwork,updateIpAddress,listPublicIpAddresses,associateIpAddress,associateIpAddress,listPublicIpAddresses" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "addIpToNic", "description": "Assigns secondary IP to NIC", "isasync": true, "related": "", "params": [ { "name": "ipaddress", "description": "Secondary IP Address", "type": "string", "length": 255, "required": false }, { "name": "nicid", "description": "the ID of the nic to which you want to assign private IP", "type": "uuid", "length": 255, "required": true, "related": "listNics" } ], "response": [ { "name": "virtualmachineid", "description": "the ID of the vm", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "secondaryip", "description": "the list of Secondary ipv4 addr of nic", "type": "list" }, { }, { "name": "nicid", "description": "the ID of the nic", "type": "string" }, { "name": "id", "description": "the ID of the secondary private IP addr", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "ipaddress", "description": "Secondary IP address", "type": "string" }, { "name": "networkid", "description": "the ID of the network", "type": "string" } ] }, { "name": "stopNetScalerVpx", "description": "Stops a NetScalervm.", "isasync": true, "related": "listRouters,changeServiceForRouter,destroyRouter,listInternalLoadBalancerVMs,rebootRouter,stopInternalLoadBalancerVM", "params": [ { "name": "id", "description": "the ID of the NetScaler vm", "type": "uuid", "length": 255, "required": true, "related": "listRouters,changeServiceForRouter,destroyRouter,stopNetScalerVpx,listInternalLoadBalancerVMs,rebootRouter,stopInternalLoadBalancerVM" }, { "name": "forced", "description": "Force stop the VM. The caller knows the VM is stopped.", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "dns1", "description": "the first DNS for the router", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the router", "type": "string" }, { }, { "name": "isredundantrouter", "description": "if this router is an redundant virtual router", "type": "boolean" }, { "name": "linklocalnetmask", "description": "the link local netmask for the router", "type": "string" }, { "name": "created", "description": "the date and time the router was created", "type": "date" }, { "name": "domain", "description": "the domain associated with the router", "type": "string" }, { "name": "requiresupgrade", "description": "true if the router template requires upgrader", "type": "boolean" }, { "name": "podid", "description": "the Pod ID for the router", "type": "string" }, { "name": "publicnetworkid", "description": "the ID of the corresponding public network", "type": "string" }, { "name": "account", "description": "the account associated with the router", "type": "string" }, { "name": "role", "description": "role of the domain router", "type": "string" }, { "name": "guestnetmask", "description": "the guest netmask for the router", "type": "string" }, { "name": "name", "description": "the name of the router", "type": "string" }, { "name": "domainid", "description": "the domain ID associated with the router", "type": "string" }, { "name": "publicip", "description": "the public IP address for the router", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the router", "type": "string" }, { "name": "nic", "description": "the list of nics associated with the router", "type": "set", "response": [ { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" } ] }, { "name": "dns2", "description": "the second DNS for the router", "type": "string" }, { "name": "vpcid", "description": "VPC the router belongs to", "type": "string" }, { "name": "gateway", "description": "the gateway for the router", "type": "string" }, { "name": "vpcname", "description": "the name of VPC the router belongs to", "type": "string" }, { "name": "version", "description": "the version of template", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "guestmacaddress", "description": "the guest MAC address for the router", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "redundantstate", "description": "the state of redundant virtual router", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the router", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the router", "type": "string" }, { "name": "hostid", "description": "the host ID for the router", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the router", "type": "string" }, { "name": "guestipaddress", "description": "the guest IP address for the router", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the router", "type": "string" }, { "name": "hostname", "description": "the hostname for the router", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "guestnetworkid", "description": "the ID of the corresponding guest network", "type": "string" }, { "name": "zonename", "description": "the Zone name for the router", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the router", "type": "string" }, { "name": "templateid", "description": "the template ID for the router", "type": "string" }, { "name": "state", "description": "the state of the router", "type": "state" }, { "name": "scriptsversion", "description": "the version of scripts", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the router", "type": "string" }, { "name": "linklocalnetworkid", "description": "the ID of the corresponding link local network", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "guestnetworkname", "description": "the name of the corresponding guest network", "type": "string" }, { } ] }, { "name": "deleteUcsManager", "description": "Delete a Ucs manager", "isasync": false, "params": [ { "name": "ucsmanagerid", "description": "ucs manager id", "type": "uuid", "length": 255, "required": true, "related": "listUcsManagers,addUcsManager" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "deleteInstanceGroup", "description": "Deletes a vm group", "isasync": false, "params": [ { "name": "id", "description": "the ID of the instance group", "type": "uuid", "length": 255, "required": true, "related": "createInstanceGroup,listInstanceGroups,updateInstanceGroup" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteHost", "description": "Deletes a host.", "isasync": false, "params": [ { "name": "forcedestroylocalstorage", "description": "Force destroy local storage on this host. All VMs created on this local storage will be destroyed", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the host ID", "type": "uuid", "length": 255, "required": true, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" }, { "name": "forced", "description": "Force delete the host. All HA enabled vms running on the host will be put to HA; HA disabled ones will be stopped", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "listCapabilities", "description": "Lists capabilities", "isasync": false, "related": "", "params": [ ], "response": [ { "name": "apilimitmax", "description": "Max allowed number of api requests within the specified interval", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "customdiskofferingmaxsize", "description": "maximum size that can be specified when create disk from disk offering with custom size", "type": "long" }, { "name": "regionsecondaryenabled", "description": "true if region wide secondary is enabled, false otherwise", "type": "boolean" }, { "name": "allowusercreateprojects", "description": "true if regular user is allowed to create projects", "type": "boolean" }, { "name": "kvmsnapshotenabled", "description": "true if snapshot is supported for KVM host, false otherwise", "type": "boolean" }, { "name": "allowuserviewdestroyedvm", "description": "true if the user is allowed to view destroyed virtualmachines, false otherwise", "type": "boolean" }, { }, { "name": "apilimitinterval", "description": "time interval (in seconds) to reset api count", "type": "integer" }, { "name": "dynamicrolesenabled", "description": "true if dynamic role-based api checker is enabled, false otherwise", "type": "boolean" }, { "name": "projectinviterequired", "description": "If invitation confirmation is required when add account to project", "type": "boolean" }, { "name": "userpublictemplateenabled", "description": "true if user and domain admins can set templates to be shared, false otherwise", "type": "boolean" }, { "name": "allowuserexpungerecovervm", "description": "true if the user can recover and expunge virtualmachines, false otherwise", "type": "boolean" }, { "name": "customdiskofferingminsize", "description": "minimum size that can be specified when create disk from disk offering with custom size", "type": "long" }, { "name": "securitygroupsenabled", "description": "true if security groups support is enabled, false otherwise", "type": "boolean" }, { "name": "cloudstackversion", "description": "version of the cloud stack", "type": "string" }, { "name": "supportELB", "description": "true if region supports elastic load balancer on basic zones", "type": "string" }, { } ] }, { "name": "updateTrafficType", "description": "Updates traffic type of a physical network", "since": "3.0.0", "isasync": true, "related": "addTrafficType", "params": [ { "name": "xennetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a XenServer host", "type": "string", "length": 255, "required": false }, { "name": "kvmnetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a KVM host", "type": "string", "length": 255, "required": false }, { "name": "vmwarenetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a VMware host", "type": "string", "length": 255, "required": false }, { "name": "hypervnetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a Hyperv host", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "traffic type id", "type": "uuid", "length": 255, "required": true, "related": "updateTrafficType,addTrafficType" }, { "name": "ovm3networklabel", "description": "The network name of the physical device dedicated to this traffic on an OVM3 host", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "kvmnetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a KVM host", "type": "string" }, { "name": "id", "description": "id of the network provider", "type": "string" }, { "name": "traffictype", "description": "the trafficType to be added to the physical network", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "xennetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a XenServer host", "type": "string" }, { "name": "vmwarenetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a VMware host", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "hypervnetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a HyperV host", "type": "string" }, { "name": "ovm3networklabel", "description": "The network name of the physical device dedicated to this traffic on an OVM3 host", "type": "string" } ] }, { "name": "releaseDedicatedZone", "description": "Release dedication of zone", "isasync": true, "params": [ { "name": "zoneid", "description": "the ID of the Zone", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "listConditions", "description": "List Conditions for the specific user", "isasync": false, "related": "createCondition", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "counterid", "description": "Counter-id of the condition.", "type": "uuid", "length": 255, "required": false, "related": "listCounters,createCounter" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "ID of the Condition.", "type": "uuid", "length": 255, "required": false, "related": "createCondition,listConditions" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "policyid", "description": "the ID of the policy", "type": "uuid", "length": 255, "required": false, "related": "updateAutoScalePolicy,listAutoScalePolicies" } ], "response": [ { "name": "threshold", "description": "Threshold Value for the counter.", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "zoneid", "description": "zone id of counter", "type": "string" }, { "name": "account", "description": "the owner of the Condition.", "type": "string" }, { "name": "counter", "description": "Details of the Counter.", "type": "list" }, { "name": "project", "description": "the project name of the Condition", "type": "string" }, { "name": "projectid", "description": "the project id of the Condition.", "type": "string" }, { "name": "relationaloperator", "description": "Relational Operator to be used with threshold.", "type": "string" }, { "name": "id", "description": "the id of the Condition", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domain", "description": "the domain name of the owner.", "type": "string" }, { }, { "name": "domainid", "description": "the domain id of the Condition owner", "type": "string" }, { } ] }, { "name": "updateNetworkServiceProvider", "description": "Updates a network serviceProvider of a physical network", "since": "3.0.0", "isasync": true, "related": "listNetworkServiceProviders,addNetworkServiceProvider,listTrafficTypes", "params": [ { "name": "state", "description": "Enabled/Disabled/Shutdown the physical network service provider", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "network service provider id", "type": "uuid", "length": 255, "required": true, "related": "listNetworkServiceProviders,addNetworkServiceProvider,listTrafficTypes,updateNetworkServiceProvider" }, { "name": "servicelist", "description": "the list of services to be enabled for this physical network service provider", "type": "list", "length": 255, "required": false } ], "response": [ { }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "removeFromLoadBalancerRule", "description": "Removes a virtual machine or a list of virtual machines from a load balancer rule.", "isasync": true, "params": [ { "name": "id", "description": "The ID of the load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" }, { "name": "vmidipmap", "description": "VM ID and IP map, vmidipmap[0].vmid=1 vmidipmap[0].ip=10.1.1.75", "type": "map", "length": 255, "required": false, "since": "4.4" }, { "name": "virtualmachineids", "description": "the list of IDs of the virtual machines that are being removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)", "type": "list", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "addNuageVspDevice", "description": "Adds a Nuage VSP device", "since": "4.5", "isasync": true, "related": "updateNuageVspDevice,listNuageVspDevices", "params": [ { "name": "hostname", "description": "the hostname of the Nuage VSD", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "the password of CMS user in Nuage VSD", "type": "string", "length": 255, "required": true }, { "name": "apiversion", "description": "the version of the API to use to communicate to Nuage VSD", "type": "string", "length": 255, "required": false }, { "name": "retrycount", "description": "the number of retries on failure to communicate to Nuage VSD", "type": "integer", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "the ID of the physical network in to which Nuage VSP is added", "type": "uuid", "length": 255, "required": true, "related": "updatePhysicalNetwork,createPhysicalNetwork" }, { "name": "port", "description": "the port to communicate to Nuage VSD", "type": "integer", "length": 255, "required": true }, { "name": "username", "description": "the user name of the CMS user in Nuage VSD", "type": "string", "length": 255, "required": true }, { "name": "retryinterval", "description": "the time to wait after failure before retrying to communicate to Nuage VSD", "type": "long", "length": 255, "required": false } ], "response": [ { "name": "provider", "description": "the service provider name corresponding to this Nuage VSP device", "type": "string" }, { "name": "physicalnetworkid", "description": "the ID of the physical network to which this Nuage VSP belongs to", "type": "string" }, { "name": "retrycount", "description": "the number of retries on failure to communicate to Nuage VSD", "type": "int" }, { "name": "nuagedevicename", "description": "the name of the Nuage VSP device", "type": "string" }, { "name": "apiversion", "description": "the version of the API to use to communicate to Nuage VSD", "type": "string" }, { "name": "cmsid", "description": "the CMS ID generated by the Nuage VSD", "type": "string" }, { }, { "name": "vspdeviceid", "description": "the device id of the Nuage VSD", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "retryinterval", "description": "the time to wait after failure before retrying to communicate to Nuage VSD", "type": "long" }, { "name": "port", "description": "the port to communicate to Nuage VSD", "type": "int" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hostname", "description": "the hostname of the Nuage VSD", "type": "string" } ] }, { "name": "listInstanceGroups", "description": "Lists vm groups", "isasync": false, "related": "createInstanceGroup,updateInstanceGroup", "params": [ { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,createProject,updateProject,suspendProject" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "list instance groups by name", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "list instance groups by ID", "type": "uuid", "length": 255, "required": false, "related": "createInstanceGroup,listInstanceGroups,updateInstanceGroup" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "projectid", "description": "the project ID of the instance group", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "the name of the instance group", "type": "string" }, { "name": "project", "description": "the project name of the instance group", "type": "string" }, { }, { "name": "created", "description": "time and date the instance group was created", "type": "date" }, { "name": "domainid", "description": "the domain ID of the instance group", "type": "string" }, { "name": "domain", "description": "the domain name of the instance group", "type": "string" }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the instance group", "type": "string" } ] }, { "name": "createStaticRoute", "description": "Creates a static route", "isasync": true, "related": "listStaticRoutes", "params": [ { "name": "cidr", "description": "static route cidr", "type": "string", "length": 255, "required": true }, { "name": "gatewayid", "description": "the gateway id we are creating static route for", "type": "uuid", "length": 255, "required": true, "related": "createPrivateGateway" } ], "response": [ { "name": "gatewayid", "description": "VPC gateway the route is created for", "type": "string" }, { "name": "state", "description": "the state of the static route", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the ID of the domain associated with the static route", "type": "string" }, { }, { "name": "cidr", "description": "static route CIDR", "type": "string" }, { "name": "projectid", "description": "the project id of the static route", "type": "string" }, { "name": "account", "description": "the account associated with the static route", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with static route", "type": "list", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "project", "description": "the project name of the static route", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "vpcid", "description": "VPC the static route belongs to", "type": "string" }, { "name": "id", "description": "the ID of static route", "type": "string" }, { "name": "domain", "description": "the domain associated with the static route", "type": "string" } ] }, { "name": "addTrafficType", "description": "Adds traffic type to a physical network", "since": "3.0.0", "isasync": true, "related": "", "params": [ { "name": "xennetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a XenServer host", "type": "string", "length": 255, "required": false }, { "name": "traffictype", "description": "the trafficType to be added to the physical network", "type": "string", "length": 255, "required": true }, { "name": "kvmnetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a KVM host", "type": "string", "length": 255, "required": false }, { "name": "vmwarenetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a VMware host", "type": "string", "length": 255, "required": false }, { "name": "ovm3networklabel", "description": "The network name of the physical device dedicated to this traffic on an OVM3 host", "type": "string", "length": 255, "required": false }, { "name": "isolationmethod", "description": "Used if physical network has multiple isolation types and traffic type is public. Choose which isolation method. Valid options currently 'vlan' or 'vxlan', defaults to 'vlan'.", "type": "string", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "updatePhysicalNetwork,createPhysicalNetwork" }, { "name": "vlan", "description": "The VLAN id to be used for Management traffic by VMware host", "type": "string", "length": 255, "required": false }, { "name": "hypervnetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a Hyperv host", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "xennetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a XenServer host", "type": "string" }, { "name": "hypervnetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a HyperV host", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "id of the network provider", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "traffictype", "description": "the trafficType to be added to the physical network", "type": "string" }, { }, { "name": "vmwarenetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a VMware host", "type": "string" }, { }, { "name": "kvmnetworklabel", "description": "The network name label of the physical device dedicated to this traffic on a KVM host", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "ovm3networklabel", "description": "The network name of the physical device dedicated to this traffic on an OVM3 host", "type": "string" } ] }, { "name": "deletePrivateGateway", "description": "Deletes a Private gateway", "isasync": true, "params": [ { "name": "id", "description": "the ID of the private gateway", "type": "uuid", "length": 255, "required": true, "related": "createPrivateGateway" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "listLoadBalancerRuleInstances", "description": "List all virtual machine instances that are assigned to a load balancer rule.", "isasync": false, "related": "listLoadBalancerRuleInstances", "params": [ { "name": "applied", "description": "true if listing all virtual machines currently applied to the load balancer rule; default is true", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "lbvmips", "description": "true if load balancer rule VM IP information to be included; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "lbvmipaddresses", "description": "IP addresses of the vm set of lb rule", "type": "list" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "loadbalancerruleinstance", "description": "the user vm set for lb rule", "type": "uservmresponse" } ] }, { "name": "deleteCondition", "description": "Removes a condition", "isasync": true, "params": [ { "name": "id", "description": "the ID of the condition.", "type": "uuid", "length": 255, "required": true, "related": "createCondition" } ], "response": [ { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "updateDomain", "description": "Updates a domain with a new name", "isasync": false, "related": "listDomains,listDomains,listDomainChildren,createDomain", "params": [ { "name": "name", "description": "updates domain with this name", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "ID of domain to update", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomains,listDomainChildren,updateDomain,createDomain" }, { "name": "networkdomain", "description": "Network domain for the domain's networks; empty string will update domainName with NULL value", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the domain can own", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by domain", "type": "long" }, { "name": "cputotal", "description": "the total number of cpu cores owned by domain", "type": "long" }, { }, { "name": "networkavailable", "description": "the total number of networks available to be created for this domain", "type": "string" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this domain", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this domain", "type": "string" }, { "name": "vpclimit", "description": "the total number of vpcs the domain can own", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the domain can own", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by domain", "type": "long" }, { "name": "haschild", "description": "whether the domain has one or more sub-domains", "type": "boolean" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this domain", "type": "long" }, { "name": "volumeavailable", "description": "the total volume available for this domain", "type": "string" }, { "name": "state", "description": "the state of the domain", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by domain", "type": "long" }, { "name": "parentdomainid", "description": "the domain ID of the parent domain", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this domain", "type": "string" }, { "name": "id", "description": "the ID of the domain", "type": "string" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this domain", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "path", "description": "the path of the domain", "type": "string" }, { "name": "projectlimit", "description": "the total number of projects the domain can own", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this domain", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by domain", "type": "float" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this domain", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this domain", "type": "string" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by domain", "type": "long" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this domain to acquire", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this domain", "type": "string" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this domain", "type": "long" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this domain", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "memorylimit", "description": "the total memory (in MB) the domain can own", "type": "string" }, { "name": "level", "description": "the level of the domain", "type": "integer" }, { "name": "volumelimit", "description": "the total volume which can be used by this domain", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the domain can own", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this domain to acquire", "type": "string" }, { "name": "name", "description": "the name of the domain", "type": "string" }, { }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this domain", "type": "long" }, { "name": "iplimit", "description": "the total number of public ip addresses this domain can acquire", "type": "string" }, { "name": "projecttotal", "description": "the total number of projects being administrated by this domain", "type": "long" }, { "name": "volumetotal", "description": "the total volume being used by this domain", "type": "long" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this domain", "type": "long" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this domain", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the domain can own", "type": "string" }, { "name": "parentdomainname", "description": "the domain name of the parent domain", "type": "string" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this domain", "type": "string" } ] }, { "name": "updatePhysicalNetwork", "description": "Updates a physical network", "since": "3.0.0", "isasync": true, "related": "createPhysicalNetwork", "params": [ { "name": "state", "description": "Enabled/Disabled", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "physical network id", "type": "uuid", "length": 255, "required": true, "related": "updatePhysicalNetwork,createPhysicalNetwork" }, { "name": "networkspeed", "description": "the speed for the physical network[1G/10G]", "type": "string", "length": 255, "required": false }, { "name": "vlan", "description": "the VLAN for the physical network", "type": "string", "length": 255, "required": false }, { "name": "tags", "description": "Tag the physical network", "type": "list", "length": 255, "required": false } ], "response": [ { "name": "zoneid", "description": "zone id of the physical network", "type": "string" }, { "name": "id", "description": "the uuid of the physical network", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "isolationmethods", "description": "isolation methods", "type": "string" }, { "name": "domainid", "description": "the domain id of the physical network owner", "type": "string" }, { "name": "vlan", "description": "the vlan of the physical network", "type": "string" }, { }, { "name": "state", "description": "state of the physical network", "type": "string" }, { "name": "name", "description": "name of the physical network", "type": "string" }, { "name": "broadcastdomainrange", "description": "Broadcast domain range of the physical network", "type": "string" }, { }, { "name": "networkspeed", "description": "the speed of the physical network", "type": "string" }, { "name": "tags", "description": "comma separated tag", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "disableAutoScaleVmGroup", "description": "Disables an AutoScale Vm Group", "isasync": true, "related": "enableAutoScaleVmGroup,listAutoScaleVmGroups,updateAutoScaleVmGroup", "params": [ { "name": "id", "description": "the ID of the autoscale group", "type": "uuid", "length": 255, "required": true, "related": "enableAutoScaleVmGroup,disableAutoScaleVmGroup,listAutoScaleVmGroups,updateAutoScaleVmGroup" } ], "response": [ { "name": "id", "description": "the autoscale vm group ID", "type": "string" }, { "name": "domainid", "description": "the domain ID of the vm profile", "type": "string" }, { "name": "domain", "description": "the domain name of the vm profile", "type": "string" }, { "name": "scaledownpolicies", "description": "list of scaledown autoscale policies", "type": "list" }, { "name": "minmembers", "description": "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.", "type": "int" }, { "name": "maxmembers", "description": "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.", "type": "int" }, { "name": "state", "description": "the current state of the AutoScale Vm Group", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "project", "description": "the project name of the vm profile", "type": "string" }, { "name": "interval", "description": "the frequency at which the conditions have to be evaluated", "type": "int" }, { "name": "vmprofileid", "description": "the autoscale profile that contains information about the vms in the vm group.", "type": "string" }, { "name": "scaleuppolicies", "description": "list of scaleup autoscale policies", "type": "list" }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { "name": "projectid", "description": "the project id vm profile", "type": "string" }, { "name": "fordisplay", "description": "is group for display to the regular user", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "lbruleid", "description": "the load balancer rule ID", "type": "string" } ] }, { "name": "createSnapshotPolicy", "description": "Creates a snapshot policy for the account.", "isasync": false, "related": "updateSnapshotPolicy", "params": [ { "name": "volumeid", "description": "the ID of the disk volume", "type": "uuid", "length": 255, "required": true, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,detachVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "schedule", "description": "time the snapshot is scheduled to be taken. Format is:* if HOURLY, MM* if DAILY, MM:HH* if WEEKLY, MM:HH:DD (1-7)* if MONTHLY, MM:HH:DD (1-28)", "type": "string", "length": 255, "required": true }, { "name": "maxsnaps", "description": "maximum number of snapshots to retain", "type": "integer", "length": 255, "required": true }, { "name": "fordisplay", "description": "an optional field, whether to the display the policy to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "timezone", "description": "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.", "type": "string", "length": 255, "required": true }, { "name": "intervaltype", "description": "valid values are HOURLY, DAILY, WEEKLY, and MONTHLY", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "timezone", "description": "the time zone of the snapshot policy", "type": "string" }, { "name": "id", "description": "the ID of the snapshot policy", "type": "string" }, { "name": "maxsnaps", "description": "maximum number of snapshots retained", "type": "int" }, { "name": "fordisplay", "description": "is this policy for display to the regular user", "type": "boolean" }, { "name": "volumeid", "description": "the ID of the disk volume", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "intervaltype", "description": "the interval type of the snapshot policy", "type": "short" }, { "name": "schedule", "description": "time the snapshot is scheduled to be taken.", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "disableHAForZone", "description": "Disables HA for a zone", "since": "4.11", "isasync": true, "params": [ { "name": "zoneid", "description": "ID of the zone", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "deleteNuageVspDevice", "description": "delete a nuage vsp device", "since": "4.5", "isasync": true, "params": [ { "name": "vspdeviceid", "description": "Nuage device ID", "type": "uuid", "length": 255, "required": true, "related": "updateNuageVspDevice,listNuageVspDevices" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "createRolePermission", "description": "Adds a API permission to a role", "since": "4.9.0", "isasync": false, "related": "listRolePermissions", "params": [ { "name": "rule", "description": "The API name or wildcard rule such as list*", "type": "string", "length": 255, "required": true }, { "name": "description", "description": "The description of the role permission", "type": "string", "length": 255, "required": false }, { "name": "roleid", "description": "ID of the role", "type": "uuid", "length": 255, "required": true, "related": "updateRole,createRole,listRoles" }, { "name": "permission", "description": "The rule permission, allow or deny. Default: deny.", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the role permission", "type": "string" }, { "name": "rule", "description": "the api name or wildcard rule", "type": "string" }, { "name": "rolename", "description": "the name of the role to which the role permission belongs", "type": "string" }, { "name": "roleid", "description": "the ID of the role to which the role permission belongs", "type": "string" }, { }, { "name": "description", "description": "the description of the role permission", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "permission", "description": "the permission type of the api name or wildcard rule, allow/deny", "type": "string" } ] }, { "name": "listSystemVms", "description": "List system virtual machines.", "isasync": false, "related": "migrateSystemVm,changeServiceForSystemVm,startSystemVm", "params": [ { "name": "systemvmtype", "description": "the system VM type. Possible types are \"consoleproxy\" and \"secondarystoragevm\".", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the ID of the system VM", "type": "uuid", "length": 255, "required": false, "related": "migrateSystemVm,changeServiceForSystemVm,startSystemVm,listSystemVms" }, { "name": "hostid", "description": "the host ID of the system VM", "type": "uuid", "length": 255, "required": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" }, { "name": "state", "description": "the state of the system VM", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "storageid", "description": "the storage ID where vm's volumes belong to", "type": "uuid", "length": 255, "required": false, "since": "3.0.1", "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "zoneid", "description": "the Zone ID of the system VM", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "podid", "description": "the Pod ID of the system VM", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "name", "description": "the name of the system VM", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "linklocalmacaddress", "description": "the link local MAC address for the system vm", "type": "string" }, { "name": "privatemacaddress", "description": "the private MAC address for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "integer" }, { "name": "created", "description": "the date and time the system VM was created", "type": "date" }, { "name": "privateip", "description": "the private IP address for the system VM", "type": "string" }, { "name": "state", "description": "the state of the system VM", "type": "string" }, { "name": "systemvmtype", "description": "the system VM type", "type": "string" }, { }, { "name": "privatenetmask", "description": "the private netmask for the system VM", "type": "string" }, { "name": "gateway", "description": "the gateway for the system VM", "type": "string" }, { "name": "podid", "description": "the Pod ID for the system VM", "type": "string" }, { }, { "name": "publicmacaddress", "description": "the public MAC address for the system VM", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the system vm", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hostid", "description": "the host ID for the system VM", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the system VM", "type": "string" }, { "name": "dns1", "description": "the first DNS for the system VM", "type": "string" }, { "name": "guestvlan", "description": "guest vlan range", "type": "string" }, { "name": "templateid", "description": "the template ID for the system VM", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the system VM", "type": "string" }, { "name": "name", "description": "the name of the system VM", "type": "string" }, { "name": "hostname", "description": "the hostname for the system VM", "type": "string" }, { "name": "jobid", "description": "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "dns2", "description": "the second DNS for the system VM", "type": "string" }, { "name": "publicip", "description": "the public IP address for the system VM", "type": "string" }, { "name": "id", "description": "the ID of the system VM", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the system vm", "type": "string" }, { "name": "activeviewersessions", "description": "the number of active console sessions for the console proxy system vm", "type": "integer" }, { "name": "publicvlan", "description": "public vlan range", "type": "list" }, { "name": "zonename", "description": "the Zone name for the system VM", "type": "string" } ] }, { "name": "createProject", "description": "Creates a project", "since": "3.0.0", "isasync": true, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject", "params": [ { "name": "account", "description": "account who will be Admin for the project", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "domain ID of the account owning a project", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "name", "description": "name of the project", "type": "string", "length": 255, "required": true }, { "name": "displaytext", "description": "display text of the project", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "name", "description": "the name of the project", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this project", "type": "string" }, { }, { "name": "domain", "description": "the domain name where the project belongs to", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the domain id the project belongs to", "type": "string" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this project", "type": "string" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the project can own", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by project", "type": "float" }, { "name": "iplimit", "description": "the total number of public ip addresses this project can acquire", "type": "string" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this project to acquire", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the project", "type": "string" }, { "name": "volumetotal", "description": "the total volume being used by this project", "type": "long" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the project can own", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this project", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this project", "type": "long" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this project", "type": "long" }, { "name": "account", "description": "the account name of the project's owner", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this project to acquire", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this project", "type": "integer" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by project", "type": "long" }, { "name": "volumelimit", "description": "the total volume which can be used by this project", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by project", "type": "long" }, { }, { "name": "memorylimit", "description": "the total memory (in MB) the project can own", "type": "string" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this project", "type": "integer" }, { "name": "projectaccountname", "description": "the project account name of the project", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this project", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this project", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by project", "type": "long" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this project", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by project", "type": "long" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this project", "type": "string" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this project", "type": "long" }, { "name": "state", "description": "the state of the project", "type": "string" }, { "name": "vpclimit", "description": "the total number of vpcs the project can own", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with vm", "type": "list", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "templatelimit", "description": "the total number of templates which can be created by this project", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by project", "type": "long" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this project", "type": "long" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the project can own", "type": "string" }, { "name": "id", "description": "the id of the project", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the project can own", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this project", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this project", "type": "string" } ] }, { "name": "assignCertToLoadBalancer", "description": "Assigns a certificate to a load balancer rule", "isasync": true, "params": [ { "name": "lbruleid", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" }, { "name": "certid", "description": "the ID of the certificate", "type": "uuid", "length": 255, "required": true, "related": "uploadSslCert" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "detachVolume", "description": "Detaches a disk volume from a virtual machine.", "isasync": true, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume", "params": [ { "name": "deviceid", "description": "the device ID on the virtual machine where volume is detached from", "type": "long", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "the ID of the virtual machine where the volume is detached from", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "id", "description": "the ID of the disk volume", "type": "uuid", "length": 255, "required": false, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,detachVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" } ], "response": [ { "name": "physicalsize", "description": "the bytes alloaated", "type": "long" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "storage", "description": "name of the primary storage hosting the disk volume", "type": "string" }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "chaininfo", "description": "the chain info of the volume", "type": "string" }, { "name": "quiescevm", "description": "need quiesce vm or not when taking snapshot", "type": "boolean" }, { "name": "snapshotid", "description": "ID of the snapshot from which this volume was created", "type": "string" }, { "name": "clustername", "description": "cluster name where the volume is allocated", "type": "string" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk volume", "type": "long" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes.", "type": "string" }, { "name": "vmname", "description": "name of the virtual machine", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the disk volume", "type": "string" }, { "name": "deviceid", "description": "the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached.", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displayvolume", "description": "an optional field whether to the display the volume to the end user or not.", "type": "boolean" }, { "name": "hypervisor", "description": "Hypervisor the volume belongs to", "type": "string" }, { "name": "vmdisplayname", "description": "display name of the virtual machine", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "serviceofferingid", "description": "ID of the service offering for root disk", "type": "string" }, { "name": "zonename", "description": "name of the availability zone", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { }, { "name": "storageid", "description": "id of the primary storage hosting the disk volume; returned to admin user only", "type": "string" }, { }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "attached", "description": "the date the volume was attached to a VM instance", "type": "date" }, { "name": "destroyed", "description": "the boolean state of whether the volume is destroyed or not", "type": "boolean" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk volume", "type": "long" }, { "name": "serviceofferingname", "description": "name of the service offering for root disk", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "path", "description": "the path of the volume", "type": "string" }, { "name": "type", "description": "type of the disk volume (ROOT or DATADISK)", "type": "string" }, { "name": "name", "description": "name of the disk volume", "type": "string" }, { "name": "podid", "description": "pod id of the volume", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "name of the disk offering", "type": "string" }, { "name": "size", "description": "size of the disk volume", "type": "long" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk volume", "type": "long" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk volume", "type": "long" }, { "name": "isextractable", "description": "true if the volume is extractable, false otherwise", "type": "boolean" }, { "name": "id", "description": "ID of the disk volume", "type": "string" }, { "name": "virtualmachineid", "description": "id of the virtual machine", "type": "string" }, { "name": "clusterid", "description": "cluster id of the volume", "type": "string" }, { "name": "miniops", "description": "min iops of the disk volume", "type": "long" }, { "name": "status", "description": "the status of the volume", "type": "string" }, { "name": "diskofferingid", "description": "ID of the disk offering", "type": "string" }, { "name": "storagetype", "description": "shared or local storage", "type": "string" }, { "name": "created", "description": "the date the disk volume was created", "type": "date" }, { "name": "diskofferingdisplaytext", "description": "the display text of the disk offering", "type": "string" }, { "name": "zoneid", "description": "ID of the availability zone", "type": "string" }, { "name": "serviceofferingdisplaytext", "description": "the display text of the service offering for root disk", "type": "string" }, { "name": "utilization", "description": "the disk utilization", "type": "string" }, { "name": "maxiops", "description": "max iops of the disk volume", "type": "long" }, { "name": "virtualsize", "description": "the bytes actually consumed on disk", "type": "long" }, { "name": "podname", "description": "pod name of the volume", "type": "string" }, { "name": "vmstate", "description": "state of the virtual machine", "type": "string" } ] }, { "name": "replaceNetworkACLList", "description": "Replaces ACL associated with a network or private gateway", "isasync": true, "params": [ { "name": "gatewayid", "description": "the ID of the private gateway", "type": "uuid", "length": 255, "required": false, "related": "createPrivateGateway" }, { "name": "aclid", "description": "the ID of the network ACL", "type": "uuid", "length": 255, "required": true, "related": "createNetworkACLList,listNetworkACLLists" }, { "name": "networkid", "description": "the ID of the network", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "enableOutOfBandManagementForZone", "description": "Enables out-of-band management for a zone", "since": "4.9.0", "isasync": true, "related": "disableOutOfBandManagementForHost,enableOutOfBandManagementForHost,disableOutOfBandManagementForCluster,enableOutOfBandManagementForCluster,issueOutOfBandManagementPowerAction", "params": [ { "name": "zoneid", "description": "the ID of the zone", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { "name": "status", "description": "the operation result", "type": "boolean" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "description", "description": "the operation result description", "type": "string" }, { "name": "powerstate", "description": "the out-of-band management interface powerState of the host", "type": "powerstate" }, { "name": "password", "description": "the out-of-band management interface password", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "action", "description": "the out-of-band management action (if issued)", "type": "string" }, { "name": "driver", "description": "the out-of-band management driver for the host", "type": "string" }, { "name": "address", "description": "the out-of-band management interface address", "type": "string" }, { "name": "enabled", "description": "true if out-of-band management is enabled for the host", "type": "boolean" }, { "name": "port", "description": "the out-of-band management interface port", "type": "string" }, { "name": "username", "description": "the out-of-band management interface username", "type": "string" }, { } ] }, { "name": "markDefaultZoneForAccount", "description": "Marks a default zone for this account", "since": "4.0", "isasync": true, "related": "enableAccount,createAccount,updateAccount,listAccounts,disableAccount,listAccounts", "params": [ { "name": "domainid", "description": "Marks the account that belongs to the specified domain.", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "zoneid", "description": "The Zone ID with which the account is to be marked.", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "account", "description": "Name of the account that is to be marked.", "type": "string", "length": 255, "required": true, "related": "enableAccount,createAccount,markDefaultZoneForAccount,updateAccount,listAccounts,disableAccount,listAccounts" } ], "response": [ { "name": "projecttotal", "description": "the total number of projects being administrated by this account", "type": "long" }, { "name": "accounttype", "description": "account type (admin, domain-admin, user)", "type": "short" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this account", "type": "string" }, { "name": "volumelimit", "description": "the total volume which can be used by this account", "type": "string" }, { "name": "receivedbytes", "description": "the total number of network traffic bytes received", "type": "long" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this account", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the account can own", "type": "string" }, { "name": "groups", "description": "the list of acl groups that account belongs to", "type": "list" }, { "name": "domain", "description": "name of the Domain the account belongs too", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this account", "type": "string" }, { "name": "id", "description": "the id of the account", "type": "string" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this account", "type": "string" }, { }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this account", "type": "integer" }, { "name": "cpulimit", "description": "the total number of cpu cores the account can own", "type": "string" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this account", "type": "string" }, { "name": "sentbytes", "description": "the total number of network traffic bytes sent", "type": "long" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this account", "type": "string" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this account", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by account", "type": "long" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this account to acquire", "type": "string" }, { "name": "state", "description": "the state of the account", "type": "string" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this account", "type": "long" }, { }, { "name": "volumetotal", "description": "the total volume being used by this account", "type": "long" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this account", "type": "long" }, { "name": "projectlimit", "description": "the total number of projects the account can own", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this account", "type": "integer" }, { "name": "defaultzoneid", "description": "the default zone of the account", "type": "string" }, { "name": "domainid", "description": "id of the Domain the account belongs too", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this account", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this account", "type": "string" }, { "name": "name", "description": "the name of the account", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by account", "type": "float" }, { "name": "cputotal", "description": "the total number of cpu cores owned by account", "type": "long" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by account", "type": "long" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this account to acquire", "type": "string" }, { "name": "iscleanuprequired", "description": "true if the account requires cleanup", "type": "boolean" }, { "name": "user", "description": "the list of users associated with account", "type": "list", "response": [ { "name": "state", "description": "the user state", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" } ] }, { "name": "networktotal", "description": "the total number of networks owned by account", "type": "long" }, { "name": "vpclimit", "description": "the total number of vpcs the account can own", "type": "string" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this account", "type": "string" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this account", "type": "long" }, { "name": "roletype", "description": "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this account", "type": "string" }, { "name": "isdefault", "description": "true if account is default, false otherwise", "type": "boolean" }, { "name": "accountdetails", "description": "details for the account", "type": "map" }, { "name": "iplimit", "description": "the total number of public ip addresses this account can acquire", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the account can own", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the account can own", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this account", "type": "long" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by account", "type": "long" }, { "name": "memorylimit", "description": "the total memory (in MB) the account can own", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listLdapUsers", "description": "Lists all LDAP Users", "since": "4.2.0", "isasync": false, "related": "", "params": [ { "name": "listtype", "description": "Determines whether all ldap users are returned or just non-cloudstack users", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "firstname", "description": "The user's firstname", "type": "string" }, { "name": "email", "description": "The user's email", "type": "string" }, { "name": "lastname", "description": "The user's lastname", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domain", "description": "The user's domain", "type": "string" }, { "name": "username", "description": "The user's username", "type": "string" }, { "name": "principal", "description": "The user's principle", "type": "string" }, { } ] }, { "name": "revokeCertificate", "description": "Revokes certificate using configured CA plugin", "since": "4.11.0", "isasync": true, "params": [ { "name": "cn", "description": "The certificate CN", "type": "string", "length": 255, "required": false }, { "name": "serial", "description": "The certificate serial number, as a hex value", "type": "string", "length": 255, "required": true }, { "name": "provider", "description": "Name of the CA service provider, otherwise the default configured provider plugin will be used", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "changeServiceForSystemVm", "description": "Changes the service offering for a system vm (console proxy or secondary storage). The system vm must be in a \"Stopped\" state for this command to take effect.", "isasync": false, "related": "migrateSystemVm,startSystemVm", "params": [ { "name": "serviceofferingid", "description": "the service offering ID to apply to the system vm", "type": "uuid", "length": 255, "required": true, "related": "createServiceOffering,listServiceOfferings,updateServiceOffering" }, { "name": "id", "description": "The ID of the system vm", "type": "uuid", "length": 255, "required": true, "related": "migrateSystemVm,changeServiceForSystemVm,startSystemVm" }, { "name": "details", "description": "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value", "type": "map", "length": 255, "required": false } ], "response": [ { "name": "activeviewersessions", "description": "the number of active console sessions for the console proxy system vm", "type": "integer" }, { "name": "publicip", "description": "the public IP address for the system VM", "type": "string" }, { "name": "name", "description": "the name of the system VM", "type": "string" }, { "name": "publicvlan", "description": "public vlan range", "type": "list" }, { "name": "privatenetmask", "description": "the private netmask for the system VM", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the system VM", "type": "string" }, { }, { }, { "name": "networkdomain", "description": "the network domain for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "integer" }, { "name": "privatemacaddress", "description": "the private MAC address for the system VM", "type": "string" }, { "name": "templateid", "description": "the template ID for the system VM", "type": "string" }, { "name": "gateway", "description": "the gateway for the system VM", "type": "string" }, { "name": "hostid", "description": "the host ID for the system VM", "type": "string" }, { "name": "created", "description": "the date and time the system VM was created", "type": "date" }, { "name": "state", "description": "the state of the system VM", "type": "string" }, { "name": "podid", "description": "the Pod ID for the system VM", "type": "string" }, { "name": "systemvmtype", "description": "the system VM type", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "linklocalnetmask", "description": "the link local netmask for the system vm", "type": "string" }, { "name": "zonename", "description": "the Zone name for the system VM", "type": "string" }, { "name": "jobid", "description": "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "string" }, { "name": "dns1", "description": "the first DNS for the system VM", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the system vm", "type": "string" }, { "name": "id", "description": "the ID of the system VM", "type": "string" }, { "name": "dns2", "description": "the second DNS for the system VM", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the system VM", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the system VM", "type": "string" }, { "name": "privateip", "description": "the private IP address for the system VM", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "hostname", "description": "the hostname for the system VM", "type": "string" }, { "name": "guestvlan", "description": "guest vlan range", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the system vm", "type": "string" } ] }, { "name": "enableNuageUnderlayVlanIpRange", "description": "enable Nuage underlay on vlan ip range", "since": "4.10", "isasync": true, "params": [ { "name": "id", "description": "VLAN IP Range ID", "type": "uuid", "length": 255, "required": true, "related": "listVlanIpRanges,dedicatePublicIpRange,createVlanIpRange" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listIpForwardingRules", "description": "List the IP forwarding rules", "isasync": false, "related": "listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule", "params": [ { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "Lists rule with the specified ID.", "type": "uuid", "length": 255, "required": false, "related": "listPortForwardingRules,updatePortForwardingRule,createPortForwardingRule,listIpForwardingRules" }, { "name": "virtualmachineid", "description": "Lists all rules applied to the specified VM.", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "ipaddressid", "description": "list the rule belonging to this public IP address", "type": "uuid", "length": 255, "required": false, "related": "restartNetwork,updateIpAddress,listPublicIpAddresses,associateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "id", "description": "the ID of the port forwarding rule", "type": "string" }, { "name": "publicport", "description": "the starting port of port forwarding rule's public port range", "type": "string" }, { "name": "networkid", "description": "the id of the guest network the port forwarding rule belongs to", "type": "string" }, { "name": "publicendport", "description": "the ending port of port forwarding rule's private port range", "type": "string" }, { "name": "vmguestip", "description": "the vm ip address for the port forwarding rule", "type": "string" }, { "name": "ipaddress", "description": "the public ip address for the port forwarding rule", "type": "string" }, { "name": "fordisplay", "description": "is firewall for display to the regular user", "type": "boolean" }, { "name": "protocol", "description": "the protocol of the port forwarding rule", "type": "string" }, { "name": "virtualmachinedisplayname", "description": "the VM display name for the port forwarding rule", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "privateport", "description": "the starting port of port forwarding rule's private port range", "type": "string" }, { "name": "virtualmachinename", "description": "the VM name for the port forwarding rule", "type": "string" }, { }, { "name": "ipaddressid", "description": "the public ip address id for the port forwarding rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { }, { "name": "privateendport", "description": "the ending port of port forwarding rule's private port range", "type": "string" }, { "name": "virtualmachineid", "description": "the VM ID for the port forwarding rule", "type": "string" } ] }, { "name": "deleteVMSnapshot", "description": "Deletes a vmsnapshot.", "since": "4.2.0", "isasync": true, "params": [ { "name": "vmsnapshotid", "description": "The ID of the VM snapshot", "type": "uuid", "length": 255, "required": true, "related": "createVMSnapshot,listVMSnapshot" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "createSnapshot", "description": "Creates an instant snapshot of a volume.", "isasync": true, "related": "archiveSnapshot,createSnapshotFromVMSnapshot,revertSnapshot", "params": [ { "name": "domainid", "description": "The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "account", "description": "The account of the snapshot. The account parameter must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "locationtype", "description": "Currently applicable only for managed storage. Valid location types: 'primary', 'secondary'. Default = 'primary'.", "type": "string", "length": 255, "required": false }, { "name": "asyncbackup", "description": "asynchronous backup if true", "type": "boolean", "length": 255, "required": false }, { "name": "name", "description": "the name of the snapshot", "type": "string", "length": 255, "required": false }, { "name": "policyid", "description": "policy id of the snapshot, if this is null, then use MANUAL_POLICY.", "type": "uuid", "length": 255, "required": false, "related": "updateSnapshotPolicy" }, { "name": "volumeid", "description": "The ID of the disk volume", "type": "uuid", "length": 255, "required": true, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "quiescevm", "description": "quiesce vm if true", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "zoneid", "description": "id of the availability zone", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with snapshot", "type": "list", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "locationtype", "description": "valid location types are primary and secondary.", "type": "string" }, { "name": "osdisplayname", "description": "display name of the os on volume", "type": "string" }, { "name": "project", "description": "the project name of the snapshot", "type": "string" }, { "name": "id", "description": "ID of the snapshot", "type": "string" }, { "name": "domainid", "description": "the domain ID of the snapshot's account", "type": "string" }, { "name": "state", "description": "the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage", "type": "state" }, { "name": "revertable", "description": "indicates whether the underlying storage supports reverting the volume to this snapshot", "type": "boolean" }, { "name": "volumename", "description": "name of the disk volume", "type": "string" }, { "name": "projectid", "description": "the project id of the snapshot", "type": "string" }, { "name": "name", "description": "name of the snapshot", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "volumeid", "description": "ID of the disk volume", "type": "string" }, { "name": "volumetype", "description": "type of the disk volume", "type": "string" }, { "name": "physicalsize", "description": "physical size of backedup snapshot on image store", "type": "long" }, { "name": "snapshottype", "description": "the type of the snapshot", "type": "string" }, { "name": "intervaltype", "description": "valid types are hourly, daily, weekly, monthy, template, and none.", "type": "string" }, { "name": "virtualsize", "description": "virtual size of backedup snapshot on image store", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "created", "description": " the date the snapshot was created", "type": "date" }, { "name": "ostypeid", "description": "id of the os on volume", "type": "string" }, { }, { "name": "account", "description": "the account associated with the snapshot", "type": "string" }, { "name": "domain", "description": "the domain name of the snapshot's account", "type": "string" } ] }, { "name": "listStoragePoolsMetrics", "description": "Lists storage pool metrics", "since": "4.9.3", "isasync": false, "related": "", "params": [ { "name": "path", "description": "the storage pool path", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID for the storage pool", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "podid", "description": "the Pod ID for the storage pool", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "scope", "description": "the ID of the storage pool", "type": "string", "length": 255, "required": false, "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "clusterid", "description": "list storage pools belongig to the specific cluster", "type": "uuid", "length": 255, "required": false, "related": "addCluster,updateCluster" }, { "name": "id", "description": "the ID of the storage pool", "type": "uuid", "length": 255, "required": false, "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "ipaddress", "description": "the IP address for the storage pool", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "the name of the storage pool", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "overprovisionfactor", "description": "the overprovisionfactor for the storage pool", "type": "string" }, { "name": "podid", "description": "the Pod ID of the storage pool", "type": "string" }, { "name": "disksizeunallocatedgb", "description": "disk size unallocated in GiB", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the storage pool", "type": "string" }, { "name": "allocatediops", "description": "total min IOPS currently in use by volumes", "type": "long" }, { }, { "name": "disksizeusedgb", "description": "disk size used in GiB", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "podname", "description": "the Pod name of the storage pool", "type": "string" }, { "name": "suitableformigration", "description": "true if this pool is suitable to migrate a volume, false otherwise", "type": "boolean" }, { "name": "disksizetotalgb", "description": "disk size in GiB", "type": "string" }, { "name": "storagecapabilities", "description": "the storage pool capabilities", "type": "map" }, { "name": "capacityiops", "description": "IOPS CloudStack can provision from this storage pool", "type": "long" }, { "name": "state", "description": "the state of the storage pool", "type": "storagepoolstatus" }, { "name": "tags", "description": "the tags for the storage pool", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor type of the storage pool", "type": "string" }, { "name": "disksizeused", "description": "the host's currently used disk size", "type": "long" }, { "name": "clusterid", "description": "the ID of the cluster for the storage pool", "type": "string" }, { "name": "provider", "description": "Storage provider for this pool", "type": "string" }, { "name": "id", "description": "the ID of the storage pool", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "clustername", "description": "the name of the cluster for the storage pool", "type": "string" }, { "name": "scope", "description": "the scope of the storage pool", "type": "string" }, { "name": "storageusagethreshold", "description": "storage usage notification threshold exceeded", "type": "boolean" }, { "name": "created", "description": "the date and time the storage pool was created", "type": "date" }, { }, { "name": "type", "description": "the storage pool type", "type": "string" }, { "name": "name", "description": "the name of the storage pool", "type": "string" }, { "name": "path", "description": "the storage pool path", "type": "string" }, { "name": "disksizeallocatedgb", "description": "disk size allocated in GiB", "type": "string" }, { "name": "disksizetotal", "description": "the total disk size of the storage pool", "type": "long" }, { "name": "ipaddress", "description": "the IP address of the storage pool", "type": "string" }, { "name": "storageusagedisablethreshold", "description": "storage usage disable threshold exceeded", "type": "boolean" }, { "name": "zonename", "description": "the Zone name of the storage pool", "type": "string" }, { "name": "storageallocateddisablethreshold", "description": "storage allocated disable threshold exceeded", "type": "boolean" }, { "name": "storageallocatedthreshold", "description": "storage allocated notification threshold exceeded", "type": "boolean" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" } ] }, { "name": "listNics", "description": "list the vm nics IP to NIC", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "the ID of the vm", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "networkid", "description": "list nic of the specific vm's network", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "nicid", "description": "the ID of the nic to to list IPs", "type": "uuid", "length": 255, "required": false, "related": "listNics" } ], "response": [ { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" } ] }, { "name": "rebootRouter", "description": "Starts a router.", "isasync": true, "related": "listRouters,changeServiceForRouter,destroyRouter,listInternalLoadBalancerVMs,stopInternalLoadBalancerVM", "params": [ { "name": "id", "description": "the ID of the router", "type": "uuid", "length": 255, "required": true, "related": "listRouters,changeServiceForRouter,destroyRouter,listInternalLoadBalancerVMs,rebootRouter,stopInternalLoadBalancerVM" } ], "response": [ { "name": "gateway", "description": "the gateway for the router", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domain", "description": "the domain associated with the router", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "podid", "description": "the Pod ID for the router", "type": "string" }, { "name": "created", "description": "the date and time the router was created", "type": "date" }, { "name": "zonename", "description": "the Zone name for the router", "type": "string" }, { "name": "vpcname", "description": "the name of VPC the router belongs to", "type": "string" }, { "name": "hostid", "description": "the host ID for the router", "type": "string" }, { "name": "version", "description": "the version of template", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "nic", "description": "the list of nics associated with the router", "type": "set", "response": [ { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" } ] }, { "name": "redundantstate", "description": "the state of redundant virtual router", "type": "string" }, { "name": "domainid", "description": "the domain ID associated with the router", "type": "string" }, { "name": "state", "description": "the state of the router", "type": "state" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "publicnetworkid", "description": "the ID of the corresponding public network", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "guestipaddress", "description": "the guest IP address for the router", "type": "string" }, { "name": "vpcid", "description": "VPC the router belongs to", "type": "string" }, { "name": "guestnetmask", "description": "the guest netmask for the router", "type": "string" }, { "name": "publicip", "description": "the public IP address for the router", "type": "string" }, { "name": "guestmacaddress", "description": "the guest MAC address for the router", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "templateid", "description": "the template ID for the router", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "guestnetworkid", "description": "the ID of the corresponding guest network", "type": "string" }, { "name": "dns1", "description": "the first DNS for the router", "type": "string" }, { }, { "name": "dns2", "description": "the second DNS for the router", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the router", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the router", "type": "string" }, { "name": "role", "description": "role of the domain router", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the router", "type": "string" }, { }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the router", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the router", "type": "string" }, { "name": "isredundantrouter", "description": "if this router is an redundant virtual router", "type": "boolean" }, { "name": "linklocalnetworkid", "description": "the ID of the corresponding link local network", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the router", "type": "string" }, { "name": "name", "description": "the name of the router", "type": "string" }, { "name": "scriptsversion", "description": "the version of scripts", "type": "string" }, { "name": "guestnetworkname", "description": "the name of the corresponding guest network", "type": "string" }, { "name": "account", "description": "the account associated with the router", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the router", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the router", "type": "string" }, { "name": "hostname", "description": "the hostname for the router", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the router", "type": "string" }, { "name": "requiresupgrade", "description": "true if the router template requires upgrader", "type": "boolean" } ] }, { "name": "createSSHKeyPair", "description": "Create a new keypair and returns the private key", "isasync": false, "related": "", "params": [ { "name": "domainid", "description": "an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "account", "description": "an optional account for the ssh key. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "Name of the keypair", "type": "string", "length": 255, "required": true }, { "name": "projectid", "description": "an optional project for the ssh key", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" } ], "response": [ { }, { "name": "account", "description": "the owner of the keypair", "type": "string" }, { "name": "privatekey", "description": "Private key", "type": "string" }, { "name": "domainid", "description": "the domain id of the keypair owner", "type": "string" }, { "name": "name", "description": "Name of the keypair", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domain", "description": "the domain name of the keypair owner", "type": "string" }, { }, { "name": "fingerprint", "description": "Fingerprint of the public key", "type": "string" } ] }, { "name": "createSnapshotFromVMSnapshot", "description": "Creates an instant snapshot of a volume from existing vm snapshot.", "since": "4.10.0", "isasync": true, "related": "archiveSnapshot,revertSnapshot", "params": [ { "name": "volumeid", "description": "The ID of the disk volume", "type": "uuid", "length": 255, "required": true, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "vmsnapshotid", "description": "The ID of the VM snapshot", "type": "uuid", "length": 255, "required": true, "related": "createVMSnapshot,listVMSnapshot" }, { "name": "name", "description": "the name of the snapshot", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "domain", "description": "the domain name of the snapshot's account", "type": "string" }, { "name": "state", "description": "the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage", "type": "state" }, { "name": "id", "description": "ID of the snapshot", "type": "string" }, { "name": "project", "description": "the project name of the snapshot", "type": "string" }, { "name": "physicalsize", "description": "physical size of backedup snapshot on image store", "type": "long" }, { "name": "account", "description": "the account associated with the snapshot", "type": "string" }, { "name": "ostypeid", "description": "id of the os on volume", "type": "string" }, { "name": "volumename", "description": "name of the disk volume", "type": "string" }, { "name": "virtualsize", "description": "virtual size of backedup snapshot on image store", "type": "long" }, { "name": "volumeid", "description": "ID of the disk volume", "type": "string" }, { "name": "revertable", "description": "indicates whether the underlying storage supports reverting the volume to this snapshot", "type": "boolean" }, { "name": "created", "description": " the date the snapshot was created", "type": "date" }, { "name": "zoneid", "description": "id of the availability zone", "type": "string" }, { }, { "name": "snapshottype", "description": "the type of the snapshot", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "osdisplayname", "description": "display name of the os on volume", "type": "string" }, { "name": "locationtype", "description": "valid location types are primary and secondary.", "type": "string" }, { "name": "volumetype", "description": "type of the disk volume", "type": "string" }, { "name": "intervaltype", "description": "valid types are hourly, daily, weekly, monthy, template, and none.", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with snapshot", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "name", "description": "name of the snapshot", "type": "string" }, { "name": "projectid", "description": "the project id of the snapshot", "type": "string" }, { "name": "domainid", "description": "the domain ID of the snapshot's account", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "authorizeSecurityGroupEgress", "description": "Authorizes a particular egress rule for this security group", "since": "3.0.0", "isasync": true, "related": "authorizeSecurityGroupIngress", "params": [ { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer", "length": 255, "required": false }, { "name": "endport", "description": "end port for this egress rule", "type": "integer", "length": 255, "required": false }, { "name": "domainid", "description": "an optional domainId for the security group. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "securitygroupname", "description": "The name of the security group. Mutually exclusive with securityGroupId parameter", "type": "string", "length": 255, "required": false }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "an optional account for the security group. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "cidrlist", "description": "the cidr list associated", "type": "list", "length": 255, "required": false }, { "name": "usersecuritygrouplist", "description": "user to security group mapping", "type": "map", "length": 255, "required": false }, { "name": "startport", "description": "start port for this egress rule", "type": "integer", "length": 255, "required": false }, { "name": "protocol", "description": "TCP is default. UDP is the other supported protocol", "type": "string", "length": 255, "required": false }, { "name": "securitygroupid", "description": "The ID of the security group. Mutually exclusive with securityGroupName parameter", "type": "uuid", "length": 255, "required": false, "related": "createSecurityGroup" }, { "name": "projectid", "description": "an optional project of the security group", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" } ] }, { "name": "listStoragePools", "description": "Lists storage pools.", "isasync": false, "related": "findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool", "params": [ { "name": "name", "description": "the name of the storage pool", "type": "string", "length": 255, "required": false }, { "name": "scope", "description": "the ID of the storage pool", "type": "string", "length": 255, "required": false, "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "the ID of the storage pool", "type": "uuid", "length": 255, "required": false, "related": "listStoragePools,findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "clusterid", "description": "list storage pools belongig to the specific cluster", "type": "uuid", "length": 255, "required": false, "related": "addCluster,updateCluster" }, { "name": "zoneid", "description": "the Zone ID for the storage pool", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "ipaddress", "description": "the IP address for the storage pool", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "podid", "description": "the Pod ID for the storage pool", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "path", "description": "the storage pool path", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "type", "description": "the storage pool type", "type": "string" }, { "name": "podid", "description": "the Pod ID of the storage pool", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "storagecapabilities", "description": "the storage pool capabilities", "type": "map" }, { "name": "clusterid", "description": "the ID of the cluster for the storage pool", "type": "string" }, { "name": "ipaddress", "description": "the IP address of the storage pool", "type": "string" }, { "name": "disksizeused", "description": "the host's currently used disk size", "type": "long" }, { "name": "scope", "description": "the scope of the storage pool", "type": "string" }, { "name": "id", "description": "the ID of the storage pool", "type": "string" }, { "name": "disksizetotal", "description": "the total disk size of the storage pool", "type": "long" }, { }, { }, { "name": "clustername", "description": "the name of the cluster for the storage pool", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor type of the storage pool", "type": "string" }, { "name": "name", "description": "the name of the storage pool", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the storage pool", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "allocatediops", "description": "total min IOPS currently in use by volumes", "type": "long" }, { "name": "podname", "description": "the Pod name of the storage pool", "type": "string" }, { "name": "suitableformigration", "description": "true if this pool is suitable to migrate a volume, false otherwise", "type": "boolean" }, { "name": "tags", "description": "the tags for the storage pool", "type": "string" }, { "name": "zonename", "description": "the Zone name of the storage pool", "type": "string" }, { "name": "created", "description": "the date and time the storage pool was created", "type": "date" }, { "name": "path", "description": "the storage pool path", "type": "string" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "overprovisionfactor", "description": "the overprovisionfactor for the storage pool", "type": "string" }, { "name": "provider", "description": "Storage provider for this pool", "type": "string" }, { "name": "state", "description": "the state of the storage pool", "type": "storagepoolstatus" }, { "name": "capacityiops", "description": "IOPS CloudStack can provision from this storage pool", "type": "long" } ] }, { "name": "findHostsForMigration", "description": "Find hosts suitable for migrating a virtual machine.", "isasync": false, "related": "", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "find hosts to which this VM can be migrated and flag the hosts with enough CPU/RAM to host the VM", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "lastpinged", "description": "the date and time the host was last pinged", "type": "date" }, { "name": "cpunumber", "description": "the CPU number of the host", "type": "integer" }, { "name": "hasenoughcapacity", "description": "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise", "type": "boolean" }, { "name": "hosttags", "description": "comma-separated list of tags for the host", "type": "string" }, { "name": "events", "description": "events available for the host", "type": "string" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "islocalstorageactive", "description": "true if local storage is active, false otherwise", "type": "boolean" }, { "name": "memoryallocated", "description": "the amount of the host's memory currently allocated", "type": "string" }, { "name": "state", "description": "the state of the host", "type": "status" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "resourcestate", "description": "the resource state of the host", "type": "string" }, { "name": "cpuwithoverprovisioning", "description": "the amount of the host's CPU after applying the cpu.overprovisioning.factor ", "type": "string" }, { "name": "clustertype", "description": "the cluster type of the cluster that host belongs to", "type": "string" }, { "name": "clusterid", "description": "the cluster ID of the host", "type": "string" }, { "name": "type", "description": "the host type", "type": "type" }, { "name": "disksizetotal", "description": "the total disk size of the host", "type": "long" }, { "name": "memoryused", "description": "the amount of the host's memory currently used", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "memorywithoverprovisioning", "description": "the amount of the host's memory after applying the mem.overprovisioning.factor ", "type": "string" }, { "name": "cpuused", "description": "the amount of the host's CPU currently used", "type": "string" }, { "name": "disconnected", "description": "true if the host is disconnected. False otherwise.", "type": "date" }, { "name": "networkkbsread", "description": "the incoming network traffic on the host", "type": "long" }, { }, { "name": "suitableformigration", "description": "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise", "type": "boolean" }, { "name": "managementserverid", "description": "the management server ID of the host", "type": "long" }, { "name": "requiresStorageMotion", "description": "true if migrating a vm to this host requires storage motion, false otherwise", "type": "boolean" }, { "name": "ipaddress", "description": "the IP address of the host", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "oscategoryname", "description": "the OS category name of the host", "type": "string" }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "oscategoryid", "description": "the OS category ID of the host", "type": "string" }, { "name": "name", "description": "the name of the host", "type": "string" }, { "name": "memorytotal", "description": "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning", "type": "long" }, { "name": "clustername", "description": "the cluster name of the host", "type": "string" }, { "name": "version", "description": "the host version", "type": "string" }, { "name": "capabilities", "description": "capabilities of the host", "type": "string" }, { "name": "id", "description": "the ID of the host", "type": "string" }, { "name": "cpuspeed", "description": "the CPU speed of the host", "type": "long" }, { }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "averageload", "description": "the cpu average load on the host", "type": "long" }, { "name": "hahost", "description": "true if the host is Ha host (dedicated to vms started by HA process; false otherwise", "type": "boolean" }, { "name": "hypervisor", "description": "the host hypervisor", "type": "hypervisortype" }, { "name": "cpuallocated", "description": "the amount of the host's CPU currently allocated", "type": "string" }, { "name": "zonename", "description": "the Zone name of the host", "type": "string" }, { "name": "podid", "description": "the Pod ID of the host", "type": "string" }, { "name": "podname", "description": "the Pod name of the host", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the host", "type": "string" } ] }, { "name": "updateHypervisorCapabilities", "description": "Updates a hypervisor capabilities.", "since": "3.0.0", "isasync": false, "related": "listHypervisorCapabilities", "params": [ { "name": "securitygroupenabled", "description": "set true to enable security group for this hypervisor.", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "ID of the hypervisor capability", "type": "uuid", "length": 255, "required": false, "related": "listHypervisorCapabilities,updateHypervisorCapabilities" }, { "name": "maxguestslimit", "description": "the max number of Guest VMs per host for this hypervisor.", "type": "long", "length": 255, "required": false } ], "response": [ { "name": "hypervisor", "description": "the hypervisor type", "type": "hypervisortype" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "storagemotionenabled", "description": "true if storage motion is supported", "type": "boolean" }, { "name": "maxguestslimit", "description": "the maximum number of guest vms recommended for this hypervisor", "type": "long" }, { "name": "securitygroupenabled", "description": "true if security group is supported", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "maxdatavolumeslimit", "description": "the maximum number of Data Volumes that can be attached for this hypervisor", "type": "integer" }, { }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "maxhostspercluster", "description": "the maximum number of Hosts per cluster for this hypervisor", "type": "integer" }, { "name": "id", "description": "the ID of the hypervisor capabilities row", "type": "string" } ] }, { "name": "dedicateGuestVlanRange", "description": "Dedicates a guest vlan range to an account", "isasync": false, "related": "listDedicatedGuestVlanRanges", "params": [ { "name": "vlanrange", "description": "guest vlan range to be dedicated", "type": "string", "length": 255, "required": true }, { "name": "account", "description": "account who will own the VLAN", "type": "string", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "physical network ID of the vlan", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" }, { "name": "domainid", "description": "domain ID of the account owning a VLAN", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "projectid", "description": "project who will own the VLAN", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" } ], "response": [ { "name": "id", "description": "the ID of the guest VLAN range", "type": "string" }, { "name": "domain", "description": "the domain name of the guest VLAN range", "type": "string" }, { "name": "domainid", "description": "the domain ID of the guest VLAN range", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network of the guest vlan range", "type": "long" }, { "name": "guestvlanrange", "description": "the guest VLAN range", "type": "string" }, { "name": "project", "description": "the project name of the guest vlan range", "type": "string" }, { "name": "zoneid", "description": "the zone of the guest vlan range", "type": "long" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "projectid", "description": "the project id of the guest vlan range", "type": "string" }, { "name": "account", "description": "the account of the guest VLAN range", "type": "string" }, { } ] }, { "name": "addNicToVirtualMachine", "description": "Adds VM to specified network by creating a NIC", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "virtualmachineid", "description": "Virtual Machine ID", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,addNicToVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "dhcpoptions", "description": "DHCP options which are passed to the nic Example: dhcpoptions[0].dhcp:114=url&dhcpoptions[0].dhcp:66=www.test.com", "type": "map", "length": 255, "required": false }, { "name": "networkid", "description": "Network ID", "type": "uuid", "length": 255, "required": true, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "macaddress", "description": "Mac Address for the new network", "type": "string", "length": 255, "required": false }, { "name": "ipaddress", "description": "IP Address for the new network", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" } ] }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" } ] }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" } ] }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" } ] } ] }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" } ] }, { "name": "listStaticRoutes", "description": "Lists all static routes", "isasync": false, "related": "", "params": [ { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "list static route by id", "type": "uuid", "length": 255, "required": false, "related": "listStaticRoutes" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "vpcid", "description": "list static routes by vpc id", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,listVPCs,createVPC,restartVPC,createVPC,updateVPC" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "gatewayid", "description": "list static routes by gateway id", "type": "uuid", "length": 255, "required": false, "related": "createPrivateGateway" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" } ], "response": [ { }, { "name": "projectid", "description": "the project id of the static route", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the static route", "type": "string" }, { "name": "project", "description": "the project name of the static route", "type": "string" }, { }, { "name": "cidr", "description": "static route CIDR", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of static route", "type": "string" }, { "name": "vpcid", "description": "VPC the static route belongs to", "type": "string" }, { "name": "gatewayid", "description": "VPC gateway the route is created for", "type": "string" }, { "name": "state", "description": "the state of the static route", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with static route", "type": "list", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domain", "description": "the domain associated with the static route", "type": "string" }, { "name": "account", "description": "the account associated with the static route", "type": "string" } ] }, { "name": "listPublicIpAddresses", "description": "Lists all public ip addresses", "isasync": false, "related": "restartNetwork,updateIpAddress,associateIpAddress,associateIpAddress,listPublicIpAddresses", "params": [ { "name": "physicalnetworkid", "description": "lists all public IP addresses by physical network ID", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "forloadbalancing", "description": "list only IPs used for load balancing", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "forvirtualnetwork", "description": "the virtual network for the IP address", "type": "boolean", "length": 255, "required": false }, { "name": "associatednetworkid", "description": "lists all public IP addresses associated to the network specified", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "allocatedonly", "description": "limits search results to allocated public IP addresses", "type": "boolean", "length": 255, "required": false }, { "name": "state", "description": "lists all public IP addresses by state", "type": "string", "length": 255, "required": false }, { "name": "ipaddress", "description": "lists the specified IP address", "type": "string", "length": 255, "required": false }, { "name": "issourcenat", "description": "list only source NAT IP addresses", "type": "boolean", "length": 255, "required": false }, { "name": "vpcid", "description": "List IPs belonging to the VPC", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,listVPCs,createVPC,restartVPC,createVPC,updateVPC" }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "vlanid", "description": "lists all public IP addresses by VLAN ID", "type": "uuid", "length": 255, "required": false, "related": "listVlanIpRanges,dedicatePublicIpRange,createVlanIpRange" }, { "name": "id", "description": "lists IP address by ID", "type": "uuid", "length": 255, "required": false, "related": "restartNetwork,updateIpAddress,listPublicIpAddresses,associateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "zoneid", "description": "lists all public IP addresses by zone ID", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "isstaticnat", "description": "list only static NAT IP addresses", "type": "boolean", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "fordisplay", "description": "is public ip for display to the regular user", "type": "boolean" }, { "name": "ipaddress", "description": "public IP address", "type": "string" }, { "name": "zonename", "description": "the name of the zone the public IP address belongs to", "type": "string" }, { "name": "issourcenat", "description": "true if the IP address is a source nat address, false otherwise", "type": "boolean" }, { "name": "associatednetworkid", "description": "the ID of the Network associated with the IP address", "type": "string" }, { }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "allocated", "description": "date the public IP address was acquired", "type": "date" }, { "name": "vmipaddress", "description": "virtual machine (dnat) ip address (not null only for static nat Ip)", "type": "string" }, { "name": "associatednetworkname", "description": "the name of the Network associated with the IP address", "type": "string" }, { "name": "isstaticnat", "description": "true if this ip is for static nat, false otherwise", "type": "boolean" }, { "name": "virtualmachineid", "description": "virtual machine id the ip address is assigned to (not null only for static nat Ip)", "type": "string" }, { "name": "isportable", "description": "is public IP portable across the zones", "type": "boolean" }, { "name": "domainid", "description": "the domain ID the public IP address is associated with", "type": "string" }, { "name": "vpcid", "description": "VPC the ip belongs to", "type": "string" }, { "name": "vlanid", "description": "the ID of the VLAN associated with the IP address. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "id", "description": "public IP address id", "type": "string" }, { "name": "zoneid", "description": "the ID of the zone the public IP address belongs to", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "virtualmachinedisplayname", "description": "virtual machine display name the ip address is assigned to (not null only for static nat Ip)", "type": "string" }, { "name": "issystem", "description": "true if this ip is system ip (was allocated as a part of deployVm or createLbRule)", "type": "boolean" }, { "name": "state", "description": "State of the ip address. Can be: Allocatin, Allocated and Releasing", "type": "string" }, { "name": "networkid", "description": "the ID of the Network where ip belongs to", "type": "string" }, { "name": "account", "description": "the account the public IP address is associated with", "type": "string" }, { "name": "purpose", "description": "purpose of the IP address. In Acton this value is not null for Ips with isSystem=true, and can have either StaticNat or LB value", "type": "string" }, { "name": "vlanname", "description": "the VLAN associated with the IP address", "type": "string" }, { "name": "domain", "description": "the domain the public IP address is associated with", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with ip address", "type": "list", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { "name": "forvirtualnetwork", "description": "the virtual network for the IP address", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "virtualmachinename", "description": "virtual machine name the ip address is assigned to (not null only for static nat Ip)", "type": "string" } ] }, { "name": "updateIso", "description": "Updates an ISO file.", "isasync": false, "related": "updateTemplate,listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates", "params": [ { "name": "isrouting", "description": "true if the template type is routing i.e., if template is used to deploy router", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the ID of the image file", "type": "uuid", "length": 255, "required": true, "related": "updateTemplate,listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,updateIso,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "requireshvm", "description": "true if the template requres HVM, false otherwise; available only for updateTemplate API", "type": "boolean", "length": 255, "required": false }, { "name": "details", "description": "Details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].hypervisortoolsversion=xenserver61", "type": "map", "length": 255, "required": false }, { "name": "isdynamicallyscalable", "description": "true if template/ISO contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean", "length": 255, "required": false }, { "name": "name", "description": "the name of the image file", "type": "string", "length": 255, "required": false }, { "name": "ostypeid", "description": "the ID of the OS type that best represents the OS of this image.", "type": "uuid", "length": 255, "required": false, "related": "addGuestOs,listOsTypes" }, { "name": "sortkey", "description": "sort key of the template, integer", "type": "integer", "length": 255, "required": false }, { "name": "passwordenabled", "description": "true if the image supports the password reset feature; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "sshkeyenabled", "description": "true if the template supports the sshkey upload feature; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "displaytext", "description": "the display text of the image", "type": "string", "length": 4096, "required": false }, { "name": "bootable", "description": "true if image is bootable, false otherwise; available only for updateIso API", "type": "boolean", "length": 255, "required": false }, { "name": "format", "description": "the format for the image", "type": "string", "length": 255, "required": false }, { "name": "cleanupdetails", "description": "optional boolean field, which indicates if details should be cleaned up or not (if set to true, details removed for this resource, details field ignored; if false or not set, no action)", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "bits", "description": "the processor bit size", "type": "int" }, { "name": "parenttemplateid", "description": "if Datadisk template, then id of the root disk template this template belongs to", "type": "string" }, { "name": "physicalsize", "description": "the physical size of the template", "type": "long" }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean" }, { "name": "crossZones", "description": "true if the template is managed across all Zones, false otherwise", "type": "boolean" }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" }, { "name": "displaytext", "description": "the template display text", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { }, { "name": "details", "description": "additional key/value details tied with template", "type": "map" }, { "name": "templatetype", "description": "the type of the template", "type": "string" }, { "name": "sshkeyenabled", "description": "true if template is sshkey enabled, false otherwise", "type": "boolean" }, { "name": "hostid", "description": "the ID of the secondary storage host for the template", "type": "string" }, { "name": "ostypename", "description": "the name of the OS type for this template.", "type": "string" }, { "name": "removed", "description": "the date this template was removed", "type": "date" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "checksum", "description": "checksum of the template", "type": "string" }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean" }, { "name": "passwordenabled", "description": "true if the reset password feature is enabled, false otherwise", "type": "boolean" }, { "name": "hostname", "description": "the name of the secondary storage host for the template", "type": "string" }, { "name": "zonename", "description": "the name of the zone for this template", "type": "string" }, { "name": "accountid", "description": "the account id to which the template belongs", "type": "string" }, { "name": "name", "description": "the template name", "type": "string" }, { "name": "ostypeid", "description": "the ID of the OS type for this template.", "type": "string" }, { "name": "requireshvm", "description": "true if template requires HVM enabled, false otherwise", "type": "boolean" }, { "name": "created", "description": "the date this template was created", "type": "date" }, { "name": "isextractable", "description": "true if the template is extractable, false otherwise", "type": "boolean" }, { "name": "status", "description": "the status of the template", "type": "string" }, { "name": "project", "description": "the project name of the template", "type": "string" }, { "name": "isready", "description": "true if the template is ready to be deployed from, false otherwise.", "type": "boolean" }, { "name": "zoneid", "description": "the ID of the zone for this template", "type": "string" }, { "name": "account", "description": "the account name to which the template belongs", "type": "string" }, { "name": "domain", "description": "the name of the domain to which the template belongs", "type": "string" }, { "name": "format", "description": "the format of the template.", "type": "imageformat" }, { "name": "size", "description": "the size of the template", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "projectid", "description": "the project id of the template", "type": "string" }, { "name": "childtemplates", "description": "if root disk template, then ids of the datas disk templates this template owns", "type": "set" }, { "name": "sourcetemplateid", "description": "the template ID of the parent template if present", "type": "string" }, { "name": "directdownload", "description": "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage", "type": "boolean" }, { "name": "templatetag", "description": "the tag of this template", "type": "string" }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" } ] }, { "name": "listOpenDaylightControllers", "description": "Lists OpenDyalight controllers", "isasync": false, "related": "addOpenDaylightController,deleteOpenDaylightController", "params": [ { "name": "id", "description": "the ID of a OpenDaylight Controller", "type": "uuid", "length": 255, "required": false, "related": "addOpenDaylightController,listOpenDaylightControllers,deleteOpenDaylightController" }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" } ], "response": [ { "name": "id", "description": "device id of the controller", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "username", "description": "the username to authenticate to the controller", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this controller belongs to", "type": "string" }, { "name": "name", "description": "the name assigned to the controller", "type": "string" }, { }, { "name": "url", "description": "the url of the controller api", "type": "string" } ] }, { "name": "addBigSwitchBcfDevice", "description": "Adds a BigSwitch BCF Controller device", "since": "4.6.0", "isasync": true, "related": "listBigSwitchBcfDevices", "params": [ { "name": "hostname", "description": "Hostname of ip address of the BigSwitch BCF Controller.", "type": "string", "length": 255, "required": true }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" }, { "name": "password", "description": "Password of the BigSwitch BCF Controller.", "type": "string", "length": 255, "required": true }, { "name": "nat", "description": "NAT support of the BigSwitch BCF Controller.", "type": "boolean", "length": 255, "required": true }, { "name": "username", "description": "Username of the BigSwitch BCF Controller.", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "password", "description": "the controller password", "type": "string" }, { "name": "username", "description": "the controller username", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this BigSwitch BCF segment belongs to", "type": "string" }, { "name": "bigswitchdevicename", "description": "device name", "type": "string" }, { "name": "hostname", "description": "the controller Ip address", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "nat", "description": "NAT support", "type": "boolean" }, { }, { "name": "bcfdeviceid", "description": "device id of the BigSwitch BCF Controller", "type": "string" } ] }, { "name": "deleteCounter", "description": "Deletes a counter", "isasync": true, "params": [ { "name": "id", "description": "the ID of the counter", "type": "uuid", "length": 255, "required": true, "related": "listCounters,createCounter" } ], "response": [ { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "updateDefaultNicForVirtualMachine", "description": "Changes the default NIC on a VM", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "nicid", "description": "NIC ID", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "virtualmachineid", "description": "Virtual Machine ID", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,updateDefaultNicForVirtualMachine,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" } ] }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" } ] }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" } ] }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" } ] }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" } ] }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" } ] }, { "name": "deleteUser", "description": "Deletes a user for an account", "isasync": false, "params": [ { "name": "id", "description": "id of the user to be deleted", "type": "uuid", "length": 255, "required": true, "related": "updateUser,lockUser,getUser,enableUser,listUsers,createUser,disableUser" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "issueOutOfBandManagementPowerAction", "description": "Initiates the specified power action to the host's out-of-band management interface", "since": "4.9.0", "isasync": true, "related": "disableOutOfBandManagementForHost,enableOutOfBandManagementForHost,disableOutOfBandManagementForCluster,enableOutOfBandManagementForCluster", "params": [ { "name": "timeout", "description": "optional operation timeout in seconds that overrides the global or cluster-level out-of-band management timeout setting", "type": "long", "length": 255, "required": false }, { "name": "hostid", "description": "the ID of the host", "type": "uuid", "length": 255, "required": true, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" }, { "name": "action", "description": "out-of-band management power actions, valid actions are: ON, OFF, CYCLE, RESET, SOFT, STATUS", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "status", "description": "the operation result", "type": "boolean" }, { }, { "name": "powerstate", "description": "the out-of-band management interface powerState of the host", "type": "powerstate" }, { "name": "password", "description": "the out-of-band management interface password", "type": "string" }, { }, { "name": "enabled", "description": "true if out-of-band management is enabled for the host", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "address", "description": "the out-of-band management interface address", "type": "string" }, { "name": "driver", "description": "the out-of-band management driver for the host", "type": "string" }, { "name": "action", "description": "the out-of-band management action (if issued)", "type": "string" }, { "name": "port", "description": "the out-of-band management interface port", "type": "string" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "description", "description": "the operation result description", "type": "string" }, { "name": "username", "description": "the out-of-band management interface username", "type": "string" } ] }, { "name": "issueCertificate", "description": "Issues a client certificate using configured or provided CA plugin", "since": "4.11.0", "isasync": true, "related": "listCaCertificate", "params": [ { "name": "ipaddress", "description": "Comma separated list of IP addresses, the certificate should be issued for", "type": "string", "length": 255, "required": false }, { "name": "duration", "description": "Certificate validity duration in number of days, when not provided the default configured value will be used", "type": "integer", "length": 255, "required": false }, { "name": "domain", "description": "Comma separated list of domains, the certificate should be issued for. When csr is not provided, the first domain is used as a subject/CN", "type": "string", "length": 255, "required": false }, { "name": "provider", "description": "Name of the CA service provider, otherwise the default configured provider plugin will be used", "type": "string", "length": 255, "required": false }, { "name": "csr", "description": "The certificate signing request (in pem format), if CSR is not provided then configured/provided options are considered", "type": "string", "length": 65535, "required": false } ], "response": [ { "name": "privatekey", "description": "Private key for the certificate", "type": "string" }, { }, { "name": "certificate", "description": "The client certificate", "type": "string" }, { "name": "cacertificates", "description": "The CA certificate(s)", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteNetworkDevice", "description": "Deletes network device.", "isasync": false, "params": [ { "name": "id", "description": "Id of network device to delete", "type": "uuid", "length": 255, "required": true, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "createPortForwardingRule", "description": "Creates a port forwarding rule", "isasync": true, "related": "listPortForwardingRules,updatePortForwardingRule", "params": [ { "name": "networkid", "description": "the network of the virtual machine the port forwarding rule will be created for. Required when public IP address is not associated with any guest network yet (VPC case).", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "publicendport", "description": "the ending port of port forwarding rule's private port range", "type": "integer", "length": 255, "required": false }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "list", "length": 255, "required": false }, { "name": "ipaddressid", "description": "the IP address id of the port forwarding rule", "type": "uuid", "length": 255, "required": true, "related": "restartNetwork,updateIpAddress,associateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "openfirewall", "description": "if true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitly. If not specified 1) defaulted to false when PF rule is being created for VPC guest network 2) in all other cases defaulted to true", "type": "boolean", "length": 255, "required": false }, { "name": "protocol", "description": "the protocol for the port forwarding rule. Valid values are TCP or UDP.", "type": "string", "length": 255, "required": true }, { "name": "privateport", "description": "the starting port of port forwarding rule's private port range", "type": "integer", "length": 255, "required": true }, { "name": "privateendport", "description": "the ending port of port forwarding rule's private port range", "type": "integer", "length": 255, "required": false }, { "name": "vmguestip", "description": "VM guest nic secondary IP address for the port forwarding rule", "type": "string", "length": 255, "required": false }, { "name": "publicport", "description": "the starting port of port forwarding rule's public port range", "type": "integer", "length": 255, "required": true }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "virtualmachineid", "description": "the ID of the virtual machine for the port forwarding rule", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "vmguestip", "description": "the vm ip address for the port forwarding rule", "type": "string" }, { "name": "ipaddressid", "description": "the public ip address id for the port forwarding rule", "type": "string" }, { "name": "id", "description": "the ID of the port forwarding rule", "type": "string" }, { "name": "networkid", "description": "the id of the guest network the port forwarding rule belongs to", "type": "string" }, { "name": "protocol", "description": "the protocol of the port forwarding rule", "type": "string" }, { "name": "virtualmachinedisplayname", "description": "the VM display name for the port forwarding rule", "type": "string" }, { "name": "publicendport", "description": "the ending port of port forwarding rule's private port range", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "privateendport", "description": "the ending port of port forwarding rule's private port range", "type": "string" }, { "name": "fordisplay", "description": "is firewall for display to the regular user", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "privateport", "description": "the starting port of port forwarding rule's private port range", "type": "string" }, { "name": "publicport", "description": "the starting port of port forwarding rule's public port range", "type": "string" }, { "name": "virtualmachineid", "description": "the VM ID for the port forwarding rule", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { }, { "name": "ipaddress", "description": "the public ip address for the port forwarding rule", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "virtualmachinename", "description": "the VM name for the port forwarding rule", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" } ] }, { "name": "dedicateZone", "description": "Dedicates a zones.", "isasync": true, "related": "", "params": [ { "name": "account", "description": "the name of the account which needs dedication. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the ID of the containing domain", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "zoneid", "description": "the ID of the zone", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { "name": "affinitygroupid", "description": "the Dedication Affinity Group ID of the zone", "type": "string" }, { "name": "accountid", "description": "the Account Id to which the Zone is dedicated", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "id", "description": "the ID of the dedicated resource", "type": "string" }, { }, { "name": "zoneid", "description": "the ID of the Zone", "type": "string" }, { "name": "zonename", "description": "the Name of the Zone", "type": "string" }, { }, { "name": "domainid", "description": "the domain ID to which the Zone is dedicated", "type": "string" } ] }, { "name": "prepareTemplate", "description": "load template into primary storage", "isasync": false, "related": "updateTemplate,listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,copyTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates", "params": [ { "name": "templateid", "description": "template ID of the template to be prepared in primary storage(s).", "type": "uuid", "length": 255, "required": true, "related": "updateTemplate,listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,prepareTemplate,copyTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "storageid", "description": "storage pool ID of the primary storage pool to which the template should be prepared. If it is not provided the template is prepared on all the available primary storage pools.", "type": "uuid", "length": 255, "required": false, "related": "findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "zoneid", "description": "zone ID of the template to be prepared in primary storage(s).", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { "name": "checksum", "description": "checksum of the template", "type": "string" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { "name": "accountid", "description": "the account id to which the template belongs", "type": "string" }, { "name": "isready", "description": "true if the template is ready to be deployed from, false otherwise.", "type": "boolean" }, { "name": "name", "description": "the template name", "type": "string" }, { "name": "account", "description": "the account name to which the template belongs", "type": "string" }, { "name": "zonename", "description": "the name of the zone for this template", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "requireshvm", "description": "true if template requires HVM enabled, false otherwise", "type": "boolean" }, { "name": "status", "description": "the status of the template", "type": "string" }, { "name": "hostname", "description": "the name of the secondary storage host for the template", "type": "string" }, { "name": "project", "description": "the project name of the template", "type": "string" }, { "name": "displaytext", "description": "the template display text", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "parenttemplateid", "description": "if Datadisk template, then id of the root disk template this template belongs to", "type": "string" }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean" }, { "name": "ostypename", "description": "the name of the OS type for this template.", "type": "string" }, { "name": "details", "description": "additional key/value details tied with template", "type": "map" }, { "name": "created", "description": "the date this template was created", "type": "date" }, { "name": "isextractable", "description": "true if the template is extractable, false otherwise", "type": "boolean" }, { "name": "ostypeid", "description": "the ID of the OS type for this template.", "type": "string" }, { "name": "templatetag", "description": "the tag of this template", "type": "string" }, { "name": "crossZones", "description": "true if the template is managed across all Zones, false otherwise", "type": "boolean" }, { "name": "size", "description": "the size of the template", "type": "long" }, { "name": "projectid", "description": "the project id of the template", "type": "string" }, { "name": "hostid", "description": "the ID of the secondary storage host for the template", "type": "string" }, { "name": "templatetype", "description": "the type of the template", "type": "string" }, { "name": "format", "description": "the format of the template.", "type": "imageformat" }, { }, { "name": "childtemplates", "description": "if root disk template, then ids of the datas disk templates this template owns", "type": "set" }, { "name": "sshkeyenabled", "description": "true if template is sshkey enabled, false otherwise", "type": "boolean" }, { "name": "directdownload", "description": "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage", "type": "boolean" }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean" }, { "name": "removed", "description": "the date this template was removed", "type": "date" }, { "name": "passwordenabled", "description": "true if the reset password feature is enabled, false otherwise", "type": "boolean" }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "sourcetemplateid", "description": "the template ID of the parent template if present", "type": "string" }, { "name": "bits", "description": "the processor bit size", "type": "int" }, { }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" }, { "name": "domain", "description": "the name of the domain to which the template belongs", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "physicalsize", "description": "the physical size of the template", "type": "long" }, { "name": "zoneid", "description": "the ID of the zone for this template", "type": "string" } ] }, { "name": "assignToLoadBalancerRule", "description": "Assigns virtual machine or a list of virtual machines to a load balancer rule.", "isasync": true, "params": [ { "name": "virtualmachineids", "description": "the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)", "type": "list", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "vmidipmap", "description": "VM ID and IP map, vmidipmap[0].vmid=1 vmidipmap[0].ip=10.1.1.75", "type": "map", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "listPortForwardingRules,updatePortForwardingRule" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "archiveAlerts", "description": "Archive one or more alerts.", "isasync": false, "params": [ { "name": "type", "description": "archive by alert type", "type": "string", "length": 255, "required": false }, { "name": "startdate", "description": "start date range to archive alerts (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")", "type": "date", "length": 255, "required": false }, { "name": "ids", "description": "the IDs of the alerts", "type": "list", "length": 255, "required": false, "related": "listAlerts" }, { "name": "enddate", "description": "end date range to archive alerts (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")", "type": "date", "length": 255, "required": false } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "listAsyncJobs", "description": "Lists all pending asynchronous jobs for the account.", "isasync": false, "related": "queryAsyncJobResult", "params": [ { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "startdate", "description": "the start date of the async job", "type": "tzdate", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "userid", "description": "the user that executed the async command", "type": "string" }, { "name": "accountid", "description": "the account that executed the async command", "type": "string" }, { "name": "created", "description": " the created date of the job", "type": "date" }, { "name": "jobresultcode", "description": "the result code for the job", "type": "integer" }, { }, { "name": "jobprocstatus", "description": "the progress information of the PENDING job", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobinstancetype", "description": "the instance/entity object related to the job", "type": "string" }, { "name": "jobresulttype", "description": "the result type", "type": "string" }, { "name": "jobinstanceid", "description": "the unique ID of the instance/entity object related to the job", "type": "string" }, { "name": "jobstatus", "description": "the current job status-should be 0 for PENDING", "type": "integer" }, { "name": "jobresult", "description": "the result reason", "type": "responseobject" }, { "name": "cmd", "description": "the async command executed", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "completed", "description": " the completed date of the job", "type": "date" }, { } ] }, { "name": "addBrocadeVcsDevice", "description": "Adds a Brocade VCS Switch", "isasync": true, "related": "listBrocadeVcsDevices", "params": [ { "name": "password", "description": "Credentials to access the Brocade VCS Switch API", "type": "string", "length": 255, "required": true }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" }, { "name": "hostname", "description": "Hostname of ip address of the Brocade VCS Switch.", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "Credentials to access the Brocade VCS Switch API", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "brocadedevicename", "description": "device name", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical Network to which this Brocade VCS belongs to", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hostname", "description": "the principal switch Ip address", "type": "string" }, { }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "vcsdeviceid", "description": "device id of the Brocade Vcs", "type": "string" } ] }, { "name": "stopInternalLoadBalancerVM", "description": "Stops an Internal LB vm.", "isasync": true, "related": "listRouters,changeServiceForRouter,destroyRouter,listInternalLoadBalancerVMs", "params": [ { "name": "forced", "description": "Force stop the VM. The caller knows the VM is stopped.", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the ID of the internal lb vm", "type": "uuid", "length": 255, "required": true, "related": "listRouters,changeServiceForRouter,destroyRouter,listInternalLoadBalancerVMs,stopInternalLoadBalancerVM" } ], "response": [ { "name": "requiresupgrade", "description": "true if the router template requires upgrader", "type": "boolean" }, { "name": "hostid", "description": "the host ID for the router", "type": "string" }, { "name": "hostname", "description": "the hostname for the router", "type": "string" }, { "name": "dns1", "description": "the first DNS for the router", "type": "string" }, { "name": "guestipaddress", "description": "the guest IP address for the router", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the router", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the router", "type": "string" }, { "name": "created", "description": "the date and time the router was created", "type": "date" }, { "name": "publicip", "description": "the public IP address for the router", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "version", "description": "the version of template", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the router", "type": "string" }, { "name": "vpcid", "description": "VPC the router belongs to", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "dns2", "description": "the second DNS for the router", "type": "string" }, { "name": "redundantstate", "description": "the state of redundant virtual router", "type": "string" }, { "name": "role", "description": "role of the domain router", "type": "string" }, { "name": "name", "description": "the name of the router", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "nic", "description": "the list of nics associated with the router", "type": "set", "response": [ { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" } ] }, { "name": "domainid", "description": "the domain ID associated with the router", "type": "string" }, { "name": "guestnetworkid", "description": "the ID of the corresponding guest network", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "zonename", "description": "the Zone name for the router", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the router", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the router", "type": "string" }, { "name": "state", "description": "the state of the router", "type": "state" }, { "name": "scriptsversion", "description": "the version of scripts", "type": "string" }, { }, { "name": "guestmacaddress", "description": "the guest MAC address for the router", "type": "string" }, { "name": "guestnetworkname", "description": "the name of the corresponding guest network", "type": "string" }, { "name": "gateway", "description": "the gateway for the router", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the router", "type": "string" }, { "name": "account", "description": "the account associated with the router", "type": "string" }, { "name": "linklocalnetworkid", "description": "the ID of the corresponding link local network", "type": "string" }, { "name": "templateid", "description": "the template ID for the router", "type": "string" }, { "name": "publicnetworkid", "description": "the ID of the corresponding public network", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the router", "type": "string" }, { "name": "vpcname", "description": "the name of VPC the router belongs to", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the router", "type": "string" }, { "name": "domain", "description": "the domain associated with the router", "type": "string" }, { "name": "guestnetmask", "description": "the guest netmask for the router", "type": "string" }, { "name": "isredundantrouter", "description": "if this router is an redundant virtual router", "type": "boolean" }, { "name": "podid", "description": "the Pod ID for the router", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the router", "type": "string" } ] }, { "name": "createDomain", "description": "Creates a domain", "isasync": false, "related": "listDomains,listDomains,listDomainChildren", "params": [ { "name": "parentdomainid", "description": "assigns new domain a parent domain by domain ID of the parent. If no parent domain is specied, the ROOT domain is assumed.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren,createDomain" }, { "name": "domainid", "description": "Domain UUID, required for adding domain from another Region", "type": "string", "length": 255, "required": false }, { "name": "networkdomain", "description": "Network domain for networks in the domain", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "creates domain with this name", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "projecttotal", "description": "the total number of projects being administrated by this domain", "type": "long" }, { "name": "level", "description": "the level of the domain", "type": "integer" }, { "name": "state", "description": "the state of the domain", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by domain", "type": "float" }, { "name": "volumeavailable", "description": "the total volume available for this domain", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the domain can own", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the domain can own", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this domain", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this domain", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this domain", "type": "string" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this domain", "type": "string" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this domain", "type": "string" }, { "name": "name", "description": "the name of the domain", "type": "string" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this domain", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this domain", "type": "long" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this domain", "type": "string" }, { }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this domain", "type": "long" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by domain", "type": "long" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this domain", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this domain", "type": "long" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this domain to acquire", "type": "string" }, { "name": "parentdomainid", "description": "the domain ID of the parent domain", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this domain", "type": "string" }, { "name": "projectlimit", "description": "the total number of projects the domain can own", "type": "string" }, { "name": "memorylimit", "description": "the total memory (in MB) the domain can own", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this domain to acquire", "type": "string" }, { "name": "parentdomainname", "description": "the domain name of the parent domain", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the domain can own", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by domain", "type": "long" }, { "name": "networktotal", "description": "the total number of networks owned by domain", "type": "long" }, { "name": "id", "description": "the ID of the domain", "type": "string" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this domain", "type": "string" }, { "name": "volumelimit", "description": "the total volume which can be used by this domain", "type": "string" }, { "name": "path", "description": "the path of the domain", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by domain", "type": "long" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this domain", "type": "string" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this domain", "type": "long" }, { "name": "vpclimit", "description": "the total number of vpcs the domain can own", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the domain can own", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by domain", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "iplimit", "description": "the total number of public ip addresses this domain can acquire", "type": "string" }, { }, { "name": "volumetotal", "description": "the total volume being used by this domain", "type": "long" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this domain", "type": "string" }, { "name": "haschild", "description": "whether the domain has one or more sub-domains", "type": "boolean" } ] }, { "name": "deleteTags", "description": "Deleting resource tag(s)", "since": "4.0.0", "isasync": true, "params": [ { "name": "tags", "description": "Delete tags matching key/value pairs", "type": "map", "length": 255, "required": false }, { "name": "resourceids", "description": "Delete tags for resource id(s)", "type": "list", "length": 255, "required": true }, { "name": "resourcetype", "description": "Delete tag by resource type", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "restartNetwork", "description": "Restarts the network; includes 1) restarting network elements - virtual routers, DHCP servers 2) reapplying all public IPs 3) reapplying loadBalancing/portForwarding rules", "isasync": true, "related": "updateIpAddress,associateIpAddress,associateIpAddress,listPublicIpAddresses", "params": [ { "name": "makeredundant", "description": "Turn the network into a network with redundant routers.", "type": "boolean", "length": 255, "required": false, "since": "4.11.1" }, { "name": "id", "description": "The ID of the network to restart.", "type": "uuid", "length": 255, "required": true, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "cleanup", "description": "If cleanup old network elements", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "associatednetworkname", "description": "the name of the Network associated with the IP address", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "virtualmachinename", "description": "virtual machine name the ip address is assigned to (not null only for static nat Ip)", "type": "string" }, { "name": "domain", "description": "the domain the public IP address is associated with", "type": "string" }, { "name": "purpose", "description": "purpose of the IP address. In Acton this value is not null for Ips with isSystem=true, and can have either StaticNat or LB value", "type": "string" }, { "name": "issourcenat", "description": "true if the IP address is a source nat address, false otherwise", "type": "boolean" }, { "name": "domainid", "description": "the domain ID the public IP address is associated with", "type": "string" }, { "name": "vlanid", "description": "the ID of the VLAN associated with the IP address. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "vlanname", "description": "the VLAN associated with the IP address", "type": "string" }, { "name": "isportable", "description": "is public IP portable across the zones", "type": "boolean" }, { "name": "isstaticnat", "description": "true if this ip is for static nat, false otherwise", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "virtualmachineid", "description": "virtual machine id the ip address is assigned to (not null only for static nat Ip)", "type": "string" }, { "name": "ipaddress", "description": "public IP address", "type": "string" }, { "name": "vmipaddress", "description": "virtual machine (dnat) ip address (not null only for static nat Ip)", "type": "string" }, { "name": "associatednetworkid", "description": "the ID of the Network associated with the IP address", "type": "string" }, { "name": "vpcid", "description": "VPC the ip belongs to", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "virtualmachinedisplayname", "description": "virtual machine display name the ip address is assigned to (not null only for static nat Ip)", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the IP address", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated with ip address", "type": "list", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "fordisplay", "description": "is public ip for display to the regular user", "type": "boolean" }, { "name": "id", "description": "public IP address id", "type": "string" }, { }, { "name": "account", "description": "the account the public IP address is associated with", "type": "string" }, { "name": "networkid", "description": "the ID of the Network where ip belongs to", "type": "string" }, { "name": "allocated", "description": "date the public IP address was acquired", "type": "date" }, { }, { "name": "state", "description": "State of the ip address. Can be: Allocatin, Allocated and Releasing", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "zonename", "description": "the name of the zone the public IP address belongs to", "type": "string" }, { "name": "issystem", "description": "true if this ip is system ip (was allocated as a part of deployVm or createLbRule)", "type": "boolean" }, { "name": "zoneid", "description": "the ID of the zone the public IP address belongs to", "type": "string" } ] }, { "name": "login", "description": "Logs a user into the CloudStack. A successful login attempt will generate a JSESSIONID cookie value that can be passed in subsequent Query command calls until the \"logout\" command has been issued or the session has expired.", "isasync": false, "related": "", "params": [ { "name": "password", "description": "Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "Username", "type": "string", "length": 255, "required": true }, { "name": "domainId", "description": "The id of the domain that the user belongs to. If both domain and domainId are passed in, \"domainId\" parameter takes precendence", "type": "long", "length": 255, "required": false }, { "name": "domain", "description": "Path of the domain that the user belongs to. Example: domain=/com/cloud/internal. If no domain is passed in, the ROOT (/) domain is assumed.", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "userid", "description": "User ID", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "timeout", "description": "the time period before the session has expired", "type": "integer" }, { "name": "sessionkey", "description": "Session key that can be passed in subsequent Query command calls", "type": "string" }, { "name": "registered", "description": "Is user registered", "type": "string" }, { "name": "firstname", "description": "first name of the user", "type": "string" }, { "name": "domainid", "description": "Domain ID that the user belongs to", "type": "string" }, { "name": "username", "description": "Username", "type": "string" }, { "name": "timezone", "description": "user time zone", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "account", "description": "the account name the user belongs to", "type": "string" }, { }, { "name": "lastname", "description": "last name of the user", "type": "string" }, { "name": "type", "description": "the account type (admin, domain-admin, read-only-admin, user)", "type": "string" }, { "name": "timezoneoffset", "description": "user time zoneoffset", "type": "string" } ] }, { "name": "listHypervisorCapabilities", "description": "Lists all hypervisor capabilities.", "since": "3.0.0", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "hypervisor", "description": "the hypervisor for which to restrict the search", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "ID of the hypervisor capability", "type": "uuid", "length": 255, "required": false, "related": "listHypervisorCapabilities" } ], "response": [ { "name": "maxguestslimit", "description": "the maximum number of guest vms recommended for this hypervisor", "type": "long" }, { "name": "storagemotionenabled", "description": "true if storage motion is supported", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the hypervisor capabilities row", "type": "string" }, { }, { "name": "hypervisor", "description": "the hypervisor type", "type": "hypervisortype" }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "securitygroupenabled", "description": "true if security group is supported", "type": "boolean" }, { "name": "maxdatavolumeslimit", "description": "the maximum number of Data Volumes that can be attached for this hypervisor", "type": "integer" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "maxhostspercluster", "description": "the maximum number of Hosts per cluster for this hypervisor", "type": "integer" } ] }, { "name": "addImageStore", "description": "Adds backup image store.", "since": "4.2.0", "isasync": false, "related": "listImageStores,addSecondaryStorage,updateCloudToUseObjectStore,listSwifts,addImageStoreS3", "params": [ { "name": "url", "description": "the URL for the image store", "type": "string", "length": 2048, "required": false }, { "name": "zoneid", "description": "the Zone ID for the image store", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "provider", "description": "the image store provider name", "type": "string", "length": 255, "required": true }, { "name": "details", "description": "the details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss", "type": "map", "length": 255, "required": false }, { "name": "name", "description": "the name for the image store", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "zonename", "description": "the Zone name of the image store", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the image store", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "id", "description": "the ID of the image store", "type": "string" }, { }, { }, { "name": "name", "description": "the name of the image store", "type": "string" }, { "name": "url", "description": "the url of the image store", "type": "string" }, { "name": "scope", "description": "the scope of the image store", "type": "scopetype" }, { "name": "providername", "description": "the provider name of the image store", "type": "string" }, { "name": "protocol", "description": "the protocol of the image store", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "getSolidFireAccountId", "description": "Get SolidFire Account ID", "isasync": false, "related": "", "params": [ { "name": "storageid", "description": "Storage Pool UUID", "type": "string", "length": 255, "required": true }, { "name": "accountid", "description": "CloudStack Account UUID", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "solidFireAccountId", "description": "SolidFire Account ID", "type": "long" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listSupportedNetworkServices", "description": "Lists all network services provided by CloudStack or for the given Provider.", "since": "3.0.0", "isasync": false, "related": "", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "provider", "description": "network service provider name", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "service", "description": "network service name to list providers and capabilities of", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "name", "description": "the service name", "type": "string" }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" } ] }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "name", "description": "the capability name", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "value", "description": "the capability value", "type": "string" } ] } ] }, { "name": "listRolePermissions", "description": "Lists role permissions", "since": "4.9.0", "isasync": false, "related": "", "params": [ { "name": "roleid", "description": "ID of the role", "type": "uuid", "length": 255, "required": false, "related": "updateRole,createRole,listRoles" } ], "response": [ { "name": "permission", "description": "the permission type of the api name or wildcard rule, allow/deny", "type": "string" }, { "name": "description", "description": "the description of the role permission", "type": "string" }, { }, { }, { "name": "rolename", "description": "the name of the role to which the role permission belongs", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "rule", "description": "the api name or wildcard rule", "type": "string" }, { "name": "id", "description": "the ID of the role permission", "type": "string" }, { "name": "roleid", "description": "the ID of the role to which the role permission belongs", "type": "string" } ] }, { "name": "revokeSecurityGroupIngress", "description": "Deletes a particular ingress rule from this security group", "isasync": true, "params": [ { "name": "id", "description": "The ID of the ingress rule", "type": "uuid", "length": 255, "required": true, "related": "authorizeSecurityGroupIngress" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "listDedicatedGuestVlanRanges", "description": "Lists dedicated guest vlan ranges", "isasync": false, "related": "", "params": [ { "name": "domainid", "description": "the domain ID with which the guest VLAN range is associated. If used with the account parameter, returns all guest VLAN ranges for that account in the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren" }, { "name": "id", "description": "list dedicated guest vlan ranges by id", "type": "uuid", "length": 255, "required": false, "related": "listDedicatedGuestVlanRanges" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "projectid", "description": "project who will own the guest VLAN range", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "guestvlanrange", "description": "the dedicated guest vlan range", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "zone of the guest VLAN range", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "physicalnetworkid", "description": "physical network id of the guest VLAN range", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "the account with which the guest VLAN range is associated. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "domainid", "description": "the domain ID of the guest VLAN range", "type": "string" }, { "name": "account", "description": "the account of the guest VLAN range", "type": "string" }, { "name": "domain", "description": "the domain name of the guest VLAN range", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "physicalnetworkid", "description": "the physical network of the guest vlan range", "type": "long" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "project", "description": "the project name of the guest vlan range", "type": "string" }, { "name": "guestvlanrange", "description": "the guest VLAN range", "type": "string" }, { "name": "projectid", "description": "the project id of the guest vlan range", "type": "string" }, { "name": "id", "description": "the ID of the guest VLAN range", "type": "string" }, { "name": "zoneid", "description": "the zone of the guest vlan range", "type": "long" } ] }, { "name": "addNetworkServiceProvider", "description": "Adds a network serviceProvider to a physical network", "since": "3.0.0", "isasync": true, "related": "listNetworkServiceProviders,listTrafficTypes", "params": [ { "name": "name", "description": "the name for the physical network service provider", "type": "string", "length": 255, "required": true }, { "name": "physicalnetworkid", "description": "the Physical Network ID to add the provider to", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" }, { "name": "servicelist", "description": "the list of services to be enabled for this physical network service provider", "type": "list", "length": 255, "required": false }, { "name": "destinationphysicalnetworkid", "description": "the destination Physical Network ID to bridge to", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" } ], "response": [ { }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "state", "description": "state of the network provider", "type": "string" } ] }, { "name": "listNetworkACLs", "description": "Lists all network ACL items", "isasync": false, "related": "moveNetworkAclItem,updateNetworkACLItem,createNetworkACL", "params": [ { "name": "aclid", "description": "list network ACL items by ACL ID", "type": "uuid", "length": 255, "required": false, "related": "createNetworkACLList,listNetworkACLLists" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren" }, { "name": "action", "description": "list network ACL items by action", "type": "string", "length": 255, "required": false }, { "name": "protocol", "description": "list network ACL items by protocol", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "Lists network ACL Item with the specified ID", "type": "uuid", "length": 255, "required": false, "related": "moveNetworkAclItem,listNetworkACLs,updateNetworkACLItem,createNetworkACL" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "traffictype", "description": "list network ACL items by traffic type - ingress or egress", "type": "string", "length": 255, "required": false }, { "name": "networkid", "description": "list network ACL items by network ID", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listNiciraNvpDeviceNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" } ], "response": [ { "name": "id", "description": "the ID of the ACL Item", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { }, { "name": "tags", "description": "the list of resource tags associated with the network ACLs", "type": "list", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "traffictype", "description": "the traffic type for the ACL", "type": "string" }, { "name": "endport", "description": "the ending port of ACL's port range", "type": "string" }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer" }, { "name": "reason", "description": "an explanation on why this ACL rule is being applied", "type": "string" }, { "name": "protocol", "description": "the protocol of the ACL", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "aclid", "description": "the ID of the ACL this item belongs to", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "action", "description": "Action of ACL Item. Allow/Deny", "type": "string" }, { }, { "name": "number", "description": "Number of the ACL Item", "type": "integer" }, { "name": "startport", "description": "the starting port of ACL's port range", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer" } ] }, { "name": "deleteVpnGateway", "description": "Delete site to site vpn gateway", "isasync": true, "params": [ { "name": "id", "description": "id of customer gateway", "type": "uuid", "length": 255, "required": true, "related": "updateVpnGateway,createVpnGateway,listVpnGateways" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "copyTemplate", "description": "Copies a template from one zone to another.", "isasync": true, "related": "updateTemplate,listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates", "params": [ { "name": "sourcezoneid", "description": "ID of the zone the template is currently hosted on. If not specified and template is cross-zone, then we will sync this template to region wide image store.", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "destzoneids", "description": "A list of IDs of the zones that the template needs to be copied to.Specify this list if the template needs to copied to multiple zones in one go. Do not specify destzoneid and destzoneids together, however one of them is required.", "type": "list", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "id", "description": "Template ID.", "type": "uuid", "length": 255, "required": true, "related": "updateTemplate,listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,copyTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "destzoneid", "description": "ID of the zone the template is being copied to.", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean" }, { "name": "zoneid", "description": "the ID of the zone for this template", "type": "string" }, { "name": "projectid", "description": "the project id of the template", "type": "string" }, { "name": "project", "description": "the project name of the template", "type": "string" }, { "name": "removed", "description": "the date this template was removed", "type": "date" }, { "name": "crossZones", "description": "true if the template is managed across all Zones, false otherwise", "type": "boolean" }, { "name": "templatetag", "description": "the tag of this template", "type": "string" }, { "name": "isextractable", "description": "true if the template is extractable, false otherwise", "type": "boolean" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "requireshvm", "description": "true if template requires HVM enabled, false otherwise", "type": "boolean" }, { "name": "parenttemplateid", "description": "if Datadisk template, then id of the root disk template this template belongs to", "type": "string" }, { "name": "details", "description": "additional key/value details tied with template", "type": "map" }, { "name": "created", "description": "the date this template was created", "type": "date" }, { "name": "bits", "description": "the processor bit size", "type": "int" }, { "name": "directdownload", "description": "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage", "type": "boolean" }, { "name": "name", "description": "the template name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { "name": "checksum", "description": "checksum of the template", "type": "string" }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "accountid", "description": "the account id to which the template belongs", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "account", "description": "the account name to which the template belongs", "type": "string" }, { "name": "format", "description": "the format of the template.", "type": "imageformat" }, { "name": "physicalsize", "description": "the physical size of the template", "type": "long" }, { "name": "sshkeyenabled", "description": "true if template is sshkey enabled, false otherwise", "type": "boolean" }, { "name": "sourcetemplateid", "description": "the template ID of the parent template if present", "type": "string" }, { "name": "childtemplates", "description": "if root disk template, then ids of the datas disk templates this template owns", "type": "set" }, { "name": "displaytext", "description": "the template display text", "type": "string" }, { "name": "size", "description": "the size of the template", "type": "long" }, { "name": "domain", "description": "the name of the domain to which the template belongs", "type": "string" }, { "name": "zonename", "description": "the name of the zone for this template", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean" }, { "name": "ostypeid", "description": "the ID of the OS type for this template.", "type": "string" }, { "name": "hostid", "description": "the ID of the secondary storage host for the template", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean" }, { "name": "status", "description": "the status of the template", "type": "string" }, { "name": "ostypename", "description": "the name of the OS type for this template.", "type": "string" }, { "name": "templatetype", "description": "the type of the template", "type": "string" }, { "name": "passwordenabled", "description": "true if the reset password feature is enabled, false otherwise", "type": "boolean" }, { "name": "hostname", "description": "the name of the secondary storage host for the template", "type": "string" }, { "name": "isready", "description": "true if the template is ready to be deployed from, false otherwise.", "type": "boolean" } ] }, { "name": "createServiceOffering", "description": "Creates a service offering.", "isasync": false, "related": "listServiceOfferings,updateServiceOffering", "params": [ { "name": "iopsreadratemax", "description": "burst requests read rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "miniops", "description": "min iops of the compute offering", "type": "long", "length": 255, "required": false, "since": "4.4" }, { "name": "bytesreadratemaxlength", "description": "length (in seconds) of the burst", "type": "long", "length": 255, "required": false }, { "name": "storagetype", "description": "the storage type of the service offering. Values are local and shared.", "type": "string", "length": 255, "required": false }, { "name": "deploymentplanner", "description": "The deployment planner heuristics used to deploy a VM of this offering. If null, value of global config vm.deployment.planner is used", "type": "string", "length": 255, "required": false }, { "name": "iopswriteratemaxlength", "description": "length (in seconds) of the burst", "type": "long", "length": 255, "required": false }, { "name": "domainid", "description": "the ID of the containing domain, null for public offerings", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren" }, { "name": "name", "description": "the name of the service offering", "type": "string", "length": 255, "required": true }, { "name": "maxiops", "description": "max iops of the compute offering", "type": "long", "length": 255, "required": false, "since": "4.4" }, { "name": "limitcpuuse", "description": "restrict the CPU usage to committed service offering", "type": "boolean", "length": 255, "required": false }, { "name": "issystem", "description": "is this a system vm offering", "type": "boolean", "length": 255, "required": false }, { "name": "byteswriterate", "description": "bytes write rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "displaytext", "description": "the display text of the service offering", "type": "string", "length": 255, "required": true }, { "name": "iopsreadrate", "description": "io requests read rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "hosttags", "description": "the host tag for this service offering.", "type": "string", "length": 255, "required": false }, { "name": "provisioningtype", "description": "provisioning type used to create volumes. Valid values are thin, sparse, fat.", "type": "string", "length": 255, "required": false }, { "name": "customizediops", "description": "whether compute offering iops is custom or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "hypervisorsnapshotreserve", "description": "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", "type": "integer", "length": 255, "required": false, "since": "4.4" }, { "name": "isvolatile", "description": "true if the virtual machine needs to be volatile so that on every reboot of VM, original root disk is dettached then destroyed and a fresh root disk is created and attached to VM", "type": "boolean", "length": 255, "required": false }, { "name": "iopswriterate", "description": "io requests write rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "networkrate", "description": "data transfer rate in megabits per second allowed. Supported only for non-System offering and system offerings having \"domainrouter\" systemvmtype", "type": "integer", "length": 255, "required": false }, { "name": "memory", "description": "the total memory of the service offering in MB", "type": "integer", "length": 255, "required": false }, { "name": "offerha", "description": "the HA for the service offering", "type": "boolean", "length": 255, "required": false }, { "name": "byteswriteratemax", "description": "burst bytes write rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "iopsreadratemaxlength", "description": "length (in seconds) of the burst", "type": "long", "length": 255, "required": false }, { "name": "byteswriteratemaxlength", "description": "length (in seconds) of the burst", "type": "long", "length": 255, "required": false }, { "name": "bytesreadratemax", "description": "burst bytes read rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "bytesreadrate", "description": "bytes read rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "cpunumber", "description": "the CPU number of the service offering", "type": "integer", "length": 255, "required": false }, { "name": "serviceofferingdetails", "description": "details for planner, used to store specific parameters", "type": "map", "length": 255, "required": false }, { "name": "tags", "description": "the tags for this service offering.", "type": "string", "length": 255, "required": false }, { "name": "systemvmtype", "description": "the system VM type. Possible types are \"domainrouter\", \"consoleproxy\" and \"secondarystoragevm\".", "type": "string", "length": 255, "required": false }, { "name": "cpuspeed", "description": "the CPU speed of the service offering in MHz.", "type": "integer", "length": 255, "required": false }, { "name": "iopswriteratemax", "description": "burst io requests write rate of the disk offering", "type": "long", "length": 255, "required": false } ], "response": [ { "name": "diskBytesWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the service offering", "type": "long" }, { "name": "diskBytesWriteRateMax", "description": "burst bytes write rate of the disk offering", "type": "long" }, { "name": "tags", "description": "the tags for the service offering", "type": "string" }, { "name": "iscustomized", "description": "is true if the offering is customized", "type": "boolean" }, { "name": "id", "description": "the id of the service offering", "type": "string" }, { "name": "cpunumber", "description": "the number of CPU", "type": "integer" }, { "name": "diskBytesReadRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "diskIopsWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { }, { "name": "maxiops", "description": "the max iops of the disk offering", "type": "long" }, { "name": "memory", "description": "the memory in MB", "type": "integer" }, { "name": "defaultuse", "description": "is this a default system vm offering", "type": "boolean" }, { "name": "domainid", "description": "the domain id of the service offering", "type": "string" }, { "name": "serviceofferingdetails", "description": "additional key/value details tied with this service offering", "type": "map" }, { "name": "offerha", "description": "the ha support in the service offering", "type": "boolean" }, { "name": "hypervisorsnapshotreserve", "description": "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", "type": "integer" }, { "name": "deploymentplanner", "description": "deployment strategy used to deploy VM.", "type": "string" }, { "name": "networkrate", "description": "data transfer rate in megabits per second allowed.", "type": "integer" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the service offering", "type": "long" }, { "name": "isvolatile", "description": "true if the vm needs to be volatile, i.e., on every reboot of vm from API root disk is discarded and creates a new root disk", "type": "boolean" }, { "name": "miniops", "description": "the min iops of the disk offering", "type": "long" }, { "name": "displaytext", "description": "an alternate display text of the service offering.", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hosttags", "description": "the host tag for the service offering", "type": "string" }, { "name": "storagetype", "description": "the storage type for this service offering", "type": "string" }, { "name": "limitcpuuse", "description": "restrict the CPU usage to committed service offering", "type": "boolean" }, { "name": "issystem", "description": "is this a system vm offering", "type": "boolean" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the service offering", "type": "long" }, { "name": "domain", "description": "Domain name for the offering", "type": "string" }, { "name": "name", "description": "the name of the service offering", "type": "string" }, { "name": "systemvmtype", "description": "is this a the systemvm type for system vm offering", "type": "string" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes. Valid values are thin, sparse, fat.", "type": "string" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the service offering", "type": "long" }, { "name": "diskIopsReadRateMaxLength", "description": "length (in second) of the burst", "type": "long" }, { "name": "iscustomizediops", "description": "true if disk offering uses custom iops, false otherwise", "type": "boolean" }, { "name": "diskIopsReadRateMax", "description": "burst io requests read rate of the disk offering", "type": "long" }, { "name": "diskBytesReadRateMax", "description": "burst bytes read rate of the disk offering", "type": "long" }, { "name": "created", "description": "the date this service offering was created", "type": "date" }, { "name": "diskIopsWriteRateMax", "description": "burst io requests write rate of the disk offering", "type": "long" }, { "name": "cpuspeed", "description": "the clock rate CPU speed in Mhz", "type": "integer" } ] }, { "name": "listNiciraNvpDeviceNetworks", "description": "lists network that are using a nicira nvp device", "isasync": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork", "params": [ { "name": "nvpdeviceid", "description": "nicira nvp device ID", "type": "uuid", "length": 255, "required": true, "related": "addNiciraNvpDevice,listNiciraNvpDevices" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "name", "description": "the service name", "type": "string" }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" } ] }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" } ] } ] }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" } ] }, { "name": "assignVirtualMachine", "description": "Change ownership of a VM from one account to another. This API is available for Basic zones with security groups and Advanced zones with guest networks. A root administrator can reassign a VM from any account to any other account in any domain. A domain administrator can reassign a VM to any account in the same domain.", "since": "3.0.0", "isasync": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "domainid", "description": "domain id of the new VM owner.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren" }, { "name": "projectid", "description": "an optional project for the new VM owner.", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "account", "description": "account name of the new VM owner.", "type": "string", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "id of the VM to be moved", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,assignVirtualMachine,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "securitygroupids", "description": "list of security group ids to be applied on the virtual machine. In case no security groups are provided the VM is part of the default security group.", "type": "list", "length": 255, "required": false, "related": "createSecurityGroup" }, { "name": "networkids", "description": "list of new network ids in which the moved VM will participate. In case no network ids are provided the VM will be part of the default network for that zone. In case there is no network yet created for the new account the default network will be created.", "type": "list", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" } ], "response": [ { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] } ] }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] } ] }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "description", "description": "the description of the security group", "type": "string" } ] }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" } ] }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" } ] }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "deleteBigSwitchBcfDevice", "description": " delete a BigSwitch BCF Controller device", "since": "4.6.0", "isasync": true, "params": [ { "name": "bcfdeviceid", "description": "BigSwitch device ID", "type": "uuid", "length": 255, "required": true, "related": "listBigSwitchBcfDevices" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "configureNetscalerLoadBalancer", "description": "configures a netscaler load balancer device", "isasync": true, "related": "addNetscalerLoadBalancer,deployNetscalerVpx,listNetscalerLoadBalancers,registerNetscalerControlCenter", "params": [ { "name": "lbdevicededicated", "description": "true if this netscaler device to dedicated for a account, false if the netscaler device will be shared by multiple accounts", "type": "boolean", "length": 255, "required": false }, { "name": "inline", "description": "true if netscaler load balancer is intended to be used in in-line with firewall, false if netscaler load balancer will side-by-side with firewall", "type": "boolean", "length": 255, "required": false }, { "name": "lbdevicecapacity", "description": "capacity of the device, Capacity will be interpreted as number of networks device can handle", "type": "long", "length": 255, "required": false }, { "name": "podids", "description": "Used when NetScaler device is provider of EIP service. This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to route pod's subnet IP to a NetScaler device.", "type": "list", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "lbdeviceid", "description": "Netscaler load balancer device ID", "type": "uuid", "length": 255, "required": true, "related": "configureNetscalerLoadBalancer,addNetscalerLoadBalancer,deployNetscalerVpx,listNetscalerLoadBalancers,registerNetscalerControlCenter" } ], "response": [ { "name": "lbdevicename", "description": "device name", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this netscaler device belongs to", "type": "string" }, { "name": "ipaddress", "description": "the management IP address of the external load balancer", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "lbdevicecapacity", "description": "device capacity", "type": "long" }, { "name": "lbdevicestate", "description": "device state", "type": "string" }, { "name": "gslbproviderprivateip", "description": "private IP of the NetScaler representing GSLB site", "type": "string" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "privateinterface", "description": "the private interface of the load balancer", "type": "string" }, { "name": "lbdevicededicated", "description": "true if device is dedicated for an account", "type": "boolean" }, { "name": "publicinterface", "description": "the public interface of the load balancer", "type": "string" }, { "name": "gslbproviderpublicip", "description": "public IP of the NetScaler representing GSLB site", "type": "string" }, { }, { "name": "lbdeviceid", "description": "device id of the netscaler load balancer", "type": "string" }, { }, { "name": "isexclusivegslbprovider", "description": "true if NetScaler device is provisioned exclusively to be a GSLB service provider", "type": "boolean" }, { "name": "podids", "description": "Used when NetScaler device is provider of EIP service. This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to route pod's subnet IP to a NetScaler device.", "type": "list" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "gslbprovider", "description": "true if NetScaler device is provisioned to be a GSLB service provider", "type": "boolean" } ] }, { "name": "listOvsElements", "description": "Lists all available ovs elements.", "isasync": false, "related": "configureOvsElement", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "list ovs elements by id", "type": "uuid", "length": 255, "required": false, "related": "listOvsElements,configureOvsElement" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "nspid", "description": "list ovs elements by network service provider id", "type": "uuid", "length": 255, "required": false, "related": "listNetworkServiceProviders,listTrafficTypes" }, { "name": "enabled", "description": "list network offerings by enabled state", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "nspid", "description": "the physical network service provider id of the provider", "type": "string" }, { }, { "name": "id", "description": "the id of the ovs", "type": "string" }, { "name": "enabled", "description": "Enabled/Disabled the service provider", "type": "boolean" }, { "name": "domainid", "description": "the domain ID associated with the provider", "type": "string" }, { "name": "domain", "description": "the domain associated with the provider", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "account", "description": "the account associated with the provider", "type": "string" }, { } ] }, { "name": "associateUcsProfileToBlade", "description": "associate a profile to a blade", "isasync": true, "related": "", "params": [ { "name": "bladeid", "description": "blade id", "type": "uuid", "length": 255, "required": true, "related": "associateUcsProfileToBlade" }, { "name": "profiledn", "description": "profile dn", "type": "string", "length": 255, "required": true }, { "name": "ucsmanagerid", "description": "ucs manager id", "type": "uuid", "length": 255, "required": true, "related": "listUcsManagers,addUcsManager" } ], "response": [ { }, { "name": "id", "description": "ucs blade id", "type": "string" }, { }, { "name": "ucsmanagerid", "description": "ucs manager id", "type": "string" }, { "name": "bladedn", "description": "ucs blade dn", "type": "string" }, { "name": "hostid", "description": "cloudstack host id this blade associates to", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "profiledn", "description": "associated ucs profile dn", "type": "string" } ] }, { "name": "listNetscalerControlCenter", "description": "list control center", "isasync": false, "related": "", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "numretries", "description": "num_retries", "type": "string" }, { "name": "ipaddress", "description": "ncc_ip", "type": "string" }, { "name": "uuid", "description": "uuid", "type": "string" }, { "name": "username", "description": "username", "type": "string" }, { "name": "id", "description": "id", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "resizeVolume", "description": "Resizes a volume", "isasync": true, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume", "params": [ { "name": "maxiops", "description": "New maximum number of IOPS", "type": "long", "length": 255, "required": false }, { "name": "size", "description": "New volume size in GB", "type": "long", "length": 255, "required": false }, { "name": "id", "description": "the ID of the disk volume", "type": "uuid", "length": 255, "required": true, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,resizeVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "shrinkok", "description": "Verify OK to Shrink", "type": "boolean", "length": 255, "required": false }, { "name": "miniops", "description": "New minimum number of IOPS", "type": "long", "length": 255, "required": false }, { "name": "diskofferingid", "description": "new disk offering id", "type": "uuid", "length": 255, "required": false, "related": "createDiskOffering,listDiskOfferings" } ], "response": [ { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "clustername", "description": "cluster name where the volume is allocated", "type": "string" }, { "name": "virtualmachineid", "description": "id of the virtual machine", "type": "string" }, { "name": "name", "description": "name of the disk volume", "type": "string" }, { "name": "podname", "description": "pod name of the volume", "type": "string" }, { "name": "miniops", "description": "min iops of the disk volume", "type": "long" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "chaininfo", "description": "the chain info of the volume", "type": "string" }, { "name": "serviceofferingname", "description": "name of the service offering for root disk", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "diskofferingid", "description": "ID of the disk offering", "type": "string" }, { "name": "size", "description": "size of the disk volume", "type": "long" }, { "name": "destroyed", "description": "the boolean state of whether the volume is destroyed or not", "type": "boolean" }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "status", "description": "the status of the volume", "type": "string" }, { "name": "clusterid", "description": "cluster id of the volume", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "attached", "description": "the date the volume was attached to a VM instance", "type": "date" }, { "name": "vmstate", "description": "state of the virtual machine", "type": "string" }, { "name": "utilization", "description": "the disk utilization", "type": "string" }, { "name": "serviceofferingid", "description": "ID of the service offering for root disk", "type": "string" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk volume", "type": "long" }, { "name": "isextractable", "description": "true if the volume is extractable, false otherwise", "type": "boolean" }, { }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "path", "description": "the path of the volume", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "displayvolume", "description": "an optional field whether to the display the volume to the end user or not.", "type": "boolean" }, { "name": "state", "description": "the state of the disk volume", "type": "string" }, { "name": "created", "description": "the date the disk volume was created", "type": "date" }, { "name": "maxiops", "description": "max iops of the disk volume", "type": "long" }, { "name": "storage", "description": "name of the primary storage hosting the disk volume", "type": "string" }, { "name": "zoneid", "description": "ID of the availability zone", "type": "string" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes.", "type": "string" }, { "name": "serviceofferingdisplaytext", "description": "the display text of the service offering for root disk", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "id", "description": "ID of the disk volume", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "physicalsize", "description": "the bytes alloaated", "type": "long" }, { "name": "diskofferingdisplaytext", "description": "the display text of the disk offering", "type": "string" }, { "name": "storageid", "description": "id of the primary storage hosting the disk volume; returned to admin user only", "type": "string" }, { "name": "deviceid", "description": "the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached.", "type": "long" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk volume", "type": "long" }, { "name": "hypervisor", "description": "Hypervisor the volume belongs to", "type": "string" }, { "name": "podid", "description": "pod id of the volume", "type": "string" }, { "name": "diskofferingname", "description": "name of the disk offering", "type": "string" }, { "name": "vmdisplayname", "description": "display name of the virtual machine", "type": "string" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk volume", "type": "long" }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "type", "description": "type of the disk volume (ROOT or DATADISK)", "type": "string" }, { "name": "vmname", "description": "name of the virtual machine", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk volume", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "snapshotid", "description": "ID of the snapshot from which this volume was created", "type": "string" }, { "name": "quiescevm", "description": "need quiesce vm or not when taking snapshot", "type": "boolean" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "storagetype", "description": "shared or local storage", "type": "string" }, { "name": "virtualsize", "description": "the bytes actually consumed on disk", "type": "long" }, { }, { "name": "zonename", "description": "name of the availability zone", "type": "string" } ] }, { "name": "deleteAffinityGroup", "description": "Deletes affinity group", "isasync": true, "params": [ { "name": "account", "description": "the account of the affinity group. Must be specified with domain ID", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "The ID of the affinity group. Mutually exclusive with name parameter", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "name", "description": "The name of the affinity group. Mutually exclusive with ID parameter", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the domain ID of account owning the affinity group", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren" }, { "name": "projectid", "description": "the project of the affinity group", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "deleteNetworkOffering", "description": "Deletes a network offering.", "since": "3.0.0", "isasync": false, "params": [ { "name": "id", "description": "the ID of the network offering", "type": "uuid", "length": 255, "required": true, "related": "listNetworkOfferings" } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteNetworkServiceProvider", "description": "Deletes a Network Service Provider.", "since": "3.0.0", "isasync": true, "params": [ { "name": "id", "description": "the ID of the network service provider", "type": "uuid", "length": 255, "required": true, "related": "listNetworkServiceProviders,listTrafficTypes" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "listNetworkDevice", "description": "List network devices", "isasync": false, "related": "addNetworkDevice", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "networkdeviceparameterlist", "description": "parameters for network device", "type": "map", "length": 255, "required": false }, { "name": "networkdevicetype", "description": "Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall, PaloAltoFirewall", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the network device", "type": "string" }, { } ] }, { "name": "updateStorageNetworkIpRange", "description": "Update a Storage network IP range, only allowed when no IPs in this range have been allocated.", "since": "3.0.0", "isasync": true, "related": "createStorageNetworkIpRange,listStorageNetworkIpRange", "params": [ { "name": "netmask", "description": "the netmask for storage network", "type": "string", "length": 255, "required": false }, { "name": "startip", "description": "the beginning IP address", "type": "string", "length": 255, "required": false }, { "name": "endip", "description": "the ending IP address", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "UUID of storage network ip range", "type": "uuid", "length": 255, "required": true, "related": "createStorageNetworkIpRange,listStorageNetworkIpRange,updateStorageNetworkIpRange" }, { "name": "vlan", "description": "Optional. the vlan the ip range sits on", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "gateway", "description": "the gateway of the storage network IP range", "type": "string" }, { "name": "podid", "description": "the Pod uuid for the storage network IP range", "type": "string" }, { "name": "startip", "description": "the start ip of the storage network IP range", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "netmask", "description": "the netmask of the storage network IP range", "type": "string" }, { "name": "networkid", "description": "the network uuid of storage network IP range", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "zoneid", "description": "the Zone uuid of the storage network IP range", "type": "string" }, { "name": "id", "description": "the uuid of storage network IP range.", "type": "string" }, { "name": "endip", "description": "the end ip of the storage network IP range", "type": "string" }, { "name": "vlan", "description": "the ID or VID of the VLAN.", "type": "integer" } ] }, { "name": "dedicatePod", "description": "Dedicates a Pod.", "isasync": true, "related": "listDedicatedPods", "params": [ { "name": "domainid", "description": "the ID of the containing domain", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomains,listDomainChildren" }, { "name": "account", "description": "the name of the account which needs dedication. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "podid", "description": "the ID of the Pod", "type": "uuid", "length": 255, "required": true, "related": "createManagementNetworkIpRange,updatePod" } ], "response": [ { "name": "affinitygroupid", "description": "the Dedication Affinity Group ID of the pod", "type": "string" }, { "name": "accountid", "description": "the Account Id to which the Pod is dedicated", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the domain ID to which the Pod is dedicated", "type": "string" }, { "name": "podname", "description": "the Name of the Pod", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "podid", "description": "the ID of the Pod", "type": "string" }, { "name": "id", "description": "the ID of the dedicated resource", "type": "string" } ] }, { "name": "querySimulatorMock", "description": "query simulator mock", "isasync": false, "related": "", "params": [ { "name": "id", "description": "id of the configured mock", "type": "long", "length": 255, "required": false } ], "response": [ { "name": "zoneid", "description": "the Zone ID scope of the mock", "type": "long" }, { "name": "count", "description": "number of times mock is executed, if not specified then mock remains active till cleaned up", "type": "integer" }, { "name": "clusterid", "description": "the Cluster ID scope of the mock", "type": "long" }, { "name": "podid", "description": "the Pod ID scope of the mock", "type": "long" }, { "name": "name", "description": "the agent command to be mocked", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the mock ID", "type": "long" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "hostid", "description": "the Host ID scope of the mock", "type": "long" } ] }, { "name": "deleteOpenDaylightController", "description": "Removes an OpenDyalight controler", "isasync": true, "related": "addOpenDaylightController", "params": [ { "name": "id", "description": "OpenDaylight Controller ID", "type": "uuid", "length": 255, "required": true, "related": "addOpenDaylightController,deleteOpenDaylightController" } ], "response": [ { "name": "username", "description": "the username to authenticate to the controller", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this controller belongs to", "type": "string" }, { "name": "name", "description": "the name assigned to the controller", "type": "string" }, { }, { "name": "id", "description": "device id of the controller", "type": "string" }, { "name": "url", "description": "the url of the controller api", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "updateTemplate", "description": "Updates attributes of a template.", "isasync": false, "related": "listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates", "params": [ { "name": "passwordenabled", "description": "true if the image supports the password reset feature; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "isdynamicallyscalable", "description": "true if template/ISO contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean", "length": 255, "required": false }, { "name": "displaytext", "description": "the display text of the image", "type": "string", "length": 4096, "required": false }, { "name": "sshkeyenabled", "description": "true if the template supports the sshkey upload feature; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "bootable", "description": "true if image is bootable, false otherwise; available only for updateIso API", "type": "boolean", "length": 255, "required": false }, { "name": "name", "description": "the name of the image file", "type": "string", "length": 255, "required": false }, { "name": "details", "description": "Details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].hypervisortoolsversion=xenserver61", "type": "map", "length": 255, "required": false }, { "name": "isrouting", "description": "true if the template type is routing i.e., if template is used to deploy router", "type": "boolean", "length": 255, "required": false }, { "name": "format", "description": "the format for the image", "type": "string", "length": 255, "required": false }, { "name": "cleanupdetails", "description": "optional boolean field, which indicates if details should be cleaned up or not (if set to true, details removed for this resource, details field ignored; if false or not set, no action)", "type": "boolean", "length": 255, "required": false }, { "name": "ostypeid", "description": "the ID of the OS type that best represents the OS of this image.", "type": "uuid", "length": 255, "required": false, "related": "addGuestOs,listOsTypes" }, { "name": "id", "description": "the ID of the image file", "type": "uuid", "length": 255, "required": true, "related": "updateTemplate,listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "requireshvm", "description": "true if the template requres HVM, false otherwise; available only for updateTemplate API", "type": "boolean", "length": 255, "required": false }, { "name": "sortkey", "description": "sort key of the template, integer", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "templatetype", "description": "the type of the template", "type": "string" }, { "name": "displaytext", "description": "the template display text", "type": "string" }, { "name": "checksum", "description": "checksum of the template", "type": "string" }, { "name": "hostname", "description": "the name of the secondary storage host for the template", "type": "string" }, { "name": "accountid", "description": "the account id to which the template belongs", "type": "string" }, { "name": "bits", "description": "the processor bit size", "type": "int" }, { }, { "name": "requireshvm", "description": "true if template requires HVM enabled, false otherwise", "type": "boolean" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "zoneid", "description": "the ID of the zone for this template", "type": "string" }, { "name": "projectid", "description": "the project id of the template", "type": "string" }, { "name": "project", "description": "the project name of the template", "type": "string" }, { "name": "format", "description": "the format of the template.", "type": "imageformat" }, { "name": "templatetag", "description": "the tag of this template", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean" }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean" }, { "name": "sshkeyenabled", "description": "true if template is sshkey enabled, false otherwise", "type": "boolean" }, { "name": "domain", "description": "the name of the domain to which the template belongs", "type": "string" }, { "name": "physicalsize", "description": "the physical size of the template", "type": "long" }, { "name": "details", "description": "additional key/value details tied with template", "type": "map" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "isextractable", "description": "true if the template is extractable, false otherwise", "type": "boolean" }, { "name": "crossZones", "description": "true if the template is managed across all Zones, false otherwise", "type": "boolean" }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean" }, { "name": "zonename", "description": "the name of the zone for this template", "type": "string" }, { "name": "isready", "description": "true if the template is ready to be deployed from, false otherwise.", "type": "boolean" }, { "name": "ostypeid", "description": "the ID of the OS type for this template.", "type": "string" }, { "name": "account", "description": "the account name to which the template belongs", "type": "string" }, { }, { "name": "hostid", "description": "the ID of the secondary storage host for the template", "type": "string" }, { "name": "size", "description": "the size of the template", "type": "long" }, { "name": "name", "description": "the template name", "type": "string" }, { "name": "parenttemplateid", "description": "if Datadisk template, then id of the root disk template this template belongs to", "type": "string" }, { "name": "sourcetemplateid", "description": "the template ID of the parent template if present", "type": "string" }, { "name": "passwordenabled", "description": "true if the reset password feature is enabled, false otherwise", "type": "boolean" }, { "name": "childtemplates", "description": "if root disk template, then ids of the datas disk templates this template owns", "type": "set" }, { "name": "status", "description": "the status of the template", "type": "string" }, { "name": "directdownload", "description": "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage", "type": "boolean" }, { "name": "removed", "description": "the date this template was removed", "type": "date" }, { "name": "ostypename", "description": "the name of the OS type for this template.", "type": "string" }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "created", "description": "the date this template was created", "type": "date" } ] }, { "name": "createVlanIpRange", "description": "Creates a VLAN IP range.", "isasync": false, "related": "listVlanIpRanges,dedicatePublicIpRange", "params": [ { "name": "netmask", "description": "the netmask of the VLAN IP range", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "domain ID of the account owning a VLAN", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren" }, { "name": "account", "description": "account who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited", "type": "string", "length": 255, "required": false }, { "name": "podid", "description": "optional parameter. Have to be specified for Direct Untagged vlan only.", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "startip", "description": "the beginning IP address in the VLAN IP range", "type": "string", "length": 255, "required": false }, { "name": "forsystemvms", "description": "true if IP range is set to system vms, false if not", "type": "boolean", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "vlan", "description": "the ID or VID of the VLAN. If not specified, will be defaulted to the vlan of the network or if vlan of the network is null - to Untagged", "type": "string", "length": 255, "required": false }, { "name": "startipv6", "description": "the beginning IPv6 address in the IPv6 network range", "type": "string", "length": 255, "required": false }, { "name": "networkid", "description": "the network id", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewallNetworks,migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "ip6gateway", "description": "the gateway of the IPv6 network. Required for Shared networks and Isolated networks when it belongs to VPC", "type": "string", "length": 255, "required": false }, { "name": "forvirtualnetwork", "description": "true if VLAN is of Virtual type, false if Direct", "type": "boolean", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "endip", "description": "the ending IP address in the VLAN IP range", "type": "string", "length": 255, "required": false }, { "name": "gateway", "description": "the gateway of the VLAN IP range", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "project who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "endipv6", "description": "the ending IPv6 address in the IPv6 network range", "type": "string", "length": 255, "required": false }, { "name": "ip6cidr", "description": "the CIDR of IPv6 network, must be at least /64", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "domain", "description": "the domain name of the VLAN IP range", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the VLAN IP range", "type": "string" }, { "name": "netmask", "description": "the netmask of the VLAN IP range", "type": "string" }, { "name": "account", "description": "the account of the VLAN IP range", "type": "string" }, { "name": "project", "description": "the project name of the vlan range", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "vlan", "description": "the ID or VID of the VLAN.", "type": "string" }, { "name": "podid", "description": "the Pod ID for the VLAN IP range", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the VLAN IP range", "type": "boolean" }, { }, { "name": "forsystemvms", "description": "indicates whether VLAN IP range is dedicated to system vms or not", "type": "boolean" }, { "name": "networkid", "description": "the network id of vlan range", "type": "string" }, { "name": "startipv6", "description": "the start ipv6 of the VLAN IP range", "type": "string" }, { "name": "projectid", "description": "the project id of the vlan range", "type": "string" }, { "name": "startip", "description": "the start ip of the VLAN IP range", "type": "string" }, { }, { "name": "zoneid", "description": "the Zone ID of the VLAN IP range", "type": "string" }, { "name": "domainid", "description": "the domain ID of the VLAN IP range", "type": "string" }, { "name": "endip", "description": "the end ip of the VLAN IP range", "type": "string" }, { "name": "endipv6", "description": "the end ipv6 of the VLAN IP range", "type": "string" }, { "name": "podname", "description": "the Pod name for the VLAN IP range", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "gateway", "description": "the gateway of the VLAN IP range", "type": "string" }, { "name": "description", "description": "the description of the VLAN IP range", "type": "string" } ] }, { "name": "updateVpnConnection", "description": "Updates site to site vpn connection", "since": "4.4", "isasync": true, "related": "createVpnConnection,listVpnConnections", "params": [ { "name": "fordisplay", "description": "an optional field, whether to the display the vpn to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "id of vpn connection", "type": "uuid", "length": 255, "required": true, "related": "createVpnConnection,listVpnConnections,updateVpnConnection" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "ipsecpsk", "description": "IPsec Preshared-Key of the customer gateway", "type": "string" }, { "name": "fordisplay", "description": "is connection for display to the regular user", "type": "boolean" }, { "name": "projectid", "description": "the project id", "type": "string" }, { }, { "name": "id", "description": "the connection ID", "type": "string" }, { "name": "cidrlist", "description": "guest cidr list of the customer gateway", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "esplifetime", "description": "Lifetime of ESP SA of customer gateway", "type": "long" }, { "name": "state", "description": "State of vpn connection", "type": "string" }, { "name": "gateway", "description": "public ip address id of the customer gateway", "type": "string" }, { "name": "publicip", "description": "the public IP address", "type": "string" }, { "name": "project", "description": "the project name", "type": "string" }, { "name": "s2scustomergatewayid", "description": "the customer gateway ID", "type": "string" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "s2svpngatewayid", "description": "the vpn gateway ID", "type": "string" }, { "name": "dpd", "description": "if DPD is enabled for customer gateway", "type": "boolean" }, { "name": "forceencap", "description": "if Force NAT Encapsulation is enabled for customer gateway", "type": "boolean" }, { "name": "esppolicy", "description": "ESP policy of the customer gateway", "type": "string" }, { "name": "ikepolicy", "description": "IKE policy of the customer gateway", "type": "string" }, { "name": "ikelifetime", "description": "Lifetime of IKE SA of customer gateway", "type": "long" }, { "name": "passive", "description": "State of vpn connection", "type": "boolean" }, { "name": "account", "description": "the owner", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { }, { "name": "domainid", "description": "the domain id of the owner", "type": "string" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" } ] }, { "name": "listPaloAltoFirewallNetworks", "description": "lists network that are using Palo Alto firewall device", "isasync": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "lbdeviceid", "description": "palo alto balancer device ID", "type": "uuid", "length": 255, "required": true, "related": "listPaloAltoFirewalls,configurePaloAltoFirewall,addPaloAltoFirewall" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "name", "description": "the service name", "type": "string" }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "name", "description": "the capability name", "type": "string" } ] }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" } ] } ] }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" } ] }, { "name": "getPathForVolume", "description": "Get the path associated with the provided volume UUID", "isasync": false, "related": "", "params": [ { "name": "volumeid", "description": "CloudStack Volume UUID", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "path", "description": "The path field for the volume", "type": "string" } ] }, { "name": "listManagementServers", "description": "Lists management servers.", "isasync": false, "related": "", "params": [ { "name": "name", "description": "the name of the management server", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "the id of the management server", "type": "uuid", "length": 255, "required": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "state", "description": "the state of the management server", "type": "state" }, { "name": "version", "description": "the version of the management server", "type": "string" }, { }, { "name": "name", "description": "the name of the management server", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "id", "description": "the ID of the management server", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "updateInstanceGroup", "description": "Updates a vm group", "isasync": false, "related": "createInstanceGroup", "params": [ { "name": "name", "description": "new instance group name", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "Instance group ID", "type": "uuid", "length": 255, "required": true, "related": "createInstanceGroup,updateInstanceGroup" } ], "response": [ { "name": "project", "description": "the project name of the instance group", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "created", "description": "time and date the instance group was created", "type": "date" }, { "name": "name", "description": "the name of the instance group", "type": "string" }, { "name": "projectid", "description": "the project ID of the instance group", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "id", "description": "the ID of the instance group", "type": "string" }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the instance group", "type": "string" }, { "name": "domain", "description": "the domain name of the instance group", "type": "string" } ] }, { "name": "listUcsManagers", "description": "List ucs manager", "isasync": false, "related": "addUcsManager", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the ID of the ucs manager", "type": "uuid", "length": 255, "required": false, "related": "listUcsManagers,addUcsManager" }, { "name": "zoneid", "description": "the zone id", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "url", "description": "the url of ucs manager", "type": "string" }, { "name": "name", "description": "the name of ucs manager", "type": "string" }, { "name": "id", "description": "the ID of the ucs manager", "type": "string" }, { }, { }, { "name": "zoneid", "description": "the zone ID of ucs manager", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "deleteLdapConfiguration", "description": "Remove an Ldap Configuration", "since": "4.2.0", "isasync": false, "related": "addLdapConfiguration", "params": [ { "name": "domainid", "description": "linked domain", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren" }, { "name": "hostname", "description": "Hostname", "type": "string", "length": 255, "required": true }, { "name": "port", "description": "port", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "domainid", "description": "linked domain", "type": "string" }, { "name": "port", "description": "port teh ldap server is running on", "type": "int" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hostname", "description": "name of the host running the ldap server", "type": "string" } ] }, { "name": "changeServiceForRouter", "description": "Upgrades domain router to a new service offering", "isasync": false, "related": "listRouters,destroyRouter,listInternalLoadBalancerVMs", "params": [ { "name": "id", "description": "The ID of the router", "type": "uuid", "length": 255, "required": true, "related": "listRouters,changeServiceForRouter,destroyRouter,listInternalLoadBalancerVMs" }, { "name": "serviceofferingid", "description": "the service offering ID to apply to the domain router", "type": "uuid", "length": 255, "required": true, "related": "listServiceOfferings,updateServiceOffering" } ], "response": [ { }, { "name": "guestnetworkname", "description": "the name of the corresponding guest network", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the router", "type": "string" }, { "name": "guestnetworkid", "description": "the ID of the corresponding guest network", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the router", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the router", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the router", "type": "string" }, { "name": "publicip", "description": "the public IP address for the router", "type": "string" }, { "name": "nic", "description": "the list of nics associated with the router", "type": "set", "response": [ { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" } ] }, { "name": "domainid", "description": "the domain ID associated with the router", "type": "string" }, { "name": "hostid", "description": "the host ID for the router", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "linklocalnetworkid", "description": "the ID of the corresponding link local network", "type": "string" }, { "name": "role", "description": "role of the domain router", "type": "string" }, { "name": "version", "description": "the version of template", "type": "string" }, { "name": "isredundantrouter", "description": "if this router is an redundant virtual router", "type": "boolean" }, { "name": "gateway", "description": "the gateway for the router", "type": "string" }, { "name": "name", "description": "the name of the router", "type": "string" }, { "name": "domain", "description": "the domain associated with the router", "type": "string" }, { "name": "redundantstate", "description": "the state of redundant virtual router", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "created", "description": "the date and time the router was created", "type": "date" }, { "name": "guestmacaddress", "description": "the guest MAC address for the router", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the router", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "dns1", "description": "the first DNS for the router", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the router", "type": "string" }, { "name": "podid", "description": "the Pod ID for the router", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the router", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the router", "type": "string" }, { "name": "requiresupgrade", "description": "true if the router template requires upgrader", "type": "boolean" }, { "name": "vpcname", "description": "the name of VPC the router belongs to", "type": "string" }, { "name": "guestipaddress", "description": "the guest IP address for the router", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the router", "type": "string" }, { "name": "templateid", "description": "the template ID for the router", "type": "string" }, { "name": "publicnetworkid", "description": "the ID of the corresponding public network", "type": "string" }, { "name": "hostname", "description": "the hostname for the router", "type": "string" }, { "name": "guestnetmask", "description": "the guest netmask for the router", "type": "string" }, { "name": "dns2", "description": "the second DNS for the router", "type": "string" }, { "name": "vpcid", "description": "VPC the router belongs to", "type": "string" }, { "name": "zonename", "description": "the Zone name for the router", "type": "string" }, { "name": "state", "description": "the state of the router", "type": "state" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "scriptsversion", "description": "the version of scripts", "type": "string" }, { }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the router", "type": "string" } ] }, { "name": "updateVolume", "description": "Updates the volume.", "isasync": true, "related": "attachVolume,createVolume,createVolume,listVolumes,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume", "params": [ { "name": "displayvolume", "description": "an optional field, whether to the display the volume to the end user or not.", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the ID of the disk volume", "type": "uuid", "length": 255, "required": false, "related": "attachVolume,updateVolume,createVolume,createVolume,listVolumes,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "storageid", "description": "Destination storage pool UUID for the volume", "type": "uuid", "length": 255, "required": false, "since": "4.3", "related": "findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "state", "description": "The state of the volume", "type": "string", "length": 255, "required": false, "since": "4.3" }, { "name": "chaininfo", "description": "The chain info of the volume", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "path", "description": "The path of the volume", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "zoneid", "description": "ID of the availability zone", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "storageid", "description": "id of the primary storage hosting the disk volume; returned to admin user only", "type": "string" }, { "name": "isextractable", "description": "true if the volume is extractable, false otherwise", "type": "boolean" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk volume", "type": "long" }, { "name": "serviceofferingid", "description": "ID of the service offering for root disk", "type": "string" }, { "name": "chaininfo", "description": "the chain info of the volume", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk volume", "type": "long" }, { "name": "vmname", "description": "name of the virtual machine", "type": "string" }, { "name": "storage", "description": "name of the primary storage hosting the disk volume", "type": "string" }, { "name": "size", "description": "size of the disk volume", "type": "long" }, { "name": "clusterid", "description": "cluster id of the volume", "type": "string" }, { "name": "id", "description": "ID of the disk volume", "type": "string" }, { "name": "virtualsize", "description": "the bytes actually consumed on disk", "type": "long" }, { "name": "snapshotid", "description": "ID of the snapshot from which this volume was created", "type": "string" }, { "name": "destroyed", "description": "the boolean state of whether the volume is destroyed or not", "type": "boolean" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk volume", "type": "long" }, { "name": "serviceofferingdisplaytext", "description": "the display text of the service offering for root disk", "type": "string" }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "hypervisor", "description": "Hypervisor the volume belongs to", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "physicalsize", "description": "the bytes alloaated", "type": "long" }, { "name": "vmstate", "description": "state of the virtual machine", "type": "string" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk volume", "type": "long" }, { "name": "created", "description": "the date the disk volume was created", "type": "date" }, { "name": "serviceofferingname", "description": "name of the service offering for root disk", "type": "string" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "maxiops", "description": "max iops of the disk volume", "type": "long" }, { "name": "zonename", "description": "name of the availability zone", "type": "string" }, { "name": "miniops", "description": "min iops of the disk volume", "type": "long" }, { "name": "deviceid", "description": "the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached.", "type": "long" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "podid", "description": "pod id of the volume", "type": "string" }, { "name": "quiescevm", "description": "need quiesce vm or not when taking snapshot", "type": "boolean" }, { "name": "clustername", "description": "cluster name where the volume is allocated", "type": "string" }, { "name": "vmdisplayname", "description": "display name of the virtual machine", "type": "string" }, { "name": "type", "description": "type of the disk volume (ROOT or DATADISK)", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "utilization", "description": "the disk utilization", "type": "string" }, { "name": "status", "description": "the status of the volume", "type": "string" }, { "name": "displayvolume", "description": "an optional field whether to the display the volume to the end user or not.", "type": "boolean" }, { "name": "diskofferingname", "description": "name of the disk offering", "type": "string" }, { }, { "name": "path", "description": "the path of the volume", "type": "string" }, { "name": "storagetype", "description": "shared or local storage", "type": "string" }, { "name": "diskofferingdisplaytext", "description": "the display text of the disk offering", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "attached", "description": "the date the volume was attached to a VM instance", "type": "date" }, { "name": "podname", "description": "pod name of the volume", "type": "string" }, { "name": "state", "description": "the state of the disk volume", "type": "string" }, { "name": "name", "description": "name of the disk volume", "type": "string" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes.", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "diskofferingid", "description": "ID of the disk offering", "type": "string" }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "virtualmachineid", "description": "id of the virtual machine", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listTrafficTypes", "description": "Lists traffic types of a given physical network.", "since": "3.0.0", "isasync": false, "related": "listNetworkServiceProviders", "params": [ { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "updateVirtualMachine", "description": "Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call.", "isasync": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "displayvm", "description": "an optional field, whether to the display the vm to the end user or not.", "type": "boolean", "length": 255, "required": false }, { "name": "instancename", "description": "instance name of the user vm", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "dhcpoptionsnetworklist", "description": "DHCP options which are passed to the VM on start up Example: dhcpoptionsnetworklist[0].dhcp:114=url&dhcpoptionsetworklist[0].networkid=networkid&dhcpoptionsetworklist[0].dhcp:66=www.test.com", "type": "map", "length": 255, "required": false }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "extraconfig", "description": "an optional URL encoded string that can be passed to the virtual machine upon successful deployment", "type": "string", "length": 5120, "required": false, "since": "4.12" }, { "name": "group", "description": "group of the virtual machine", "type": "string", "length": 255, "required": false }, { "name": "displayname", "description": "user generated name", "type": "string", "length": 255, "required": false }, { "name": "details", "description": "Details in key/value pairs.", "type": "map", "length": 255, "required": false }, { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "haenable", "description": "true if high-availability is enabled for the virtual machine, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "userdata", "description": "an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.", "type": "string", "length": 32768, "required": false }, { "name": "isdynamicallyscalable", "description": "true if VM contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean", "length": 255, "required": false }, { "name": "cleanupdetails", "description": "optional boolean field, which indicates if details should be cleaned up or not (if set to true, details removed for this resource, details field ignored; if false or not set, no action)", "type": "boolean", "length": 255, "required": false }, { "name": "securitygroupids", "description": "list of security group ids to be applied on the virtual machine.", "type": "list", "length": 255, "required": false, "related": "createSecurityGroup" }, { "name": "name", "description": "new host name of the vm. The VM has to be stopped/started for this update to take affect", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "securitygroupnames", "description": "comma separated list of security groups names that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter", "type": "list", "length": 255, "required": false, "related": "createSecurityGroup" }, { "name": "ostypeid", "description": "the ID of the OS type that best represents this VM.", "type": "uuid", "length": 255, "required": false, "related": "addGuestOs,listOsTypes" } ], "response": [ { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" } ] }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" } ] }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" } ] }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { }, { }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" } ] }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" } ] }, { "name": "addSecondaryStorage", "description": "Adds secondary storage.", "isasync": false, "related": "listImageStores,updateCloudToUseObjectStore,listSwifts,addImageStoreS3", "params": [ { "name": "url", "description": "the URL for the secondary storage", "type": "string", "length": 255, "required": true }, { "name": "zoneid", "description": "the Zone ID for the secondary storage", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "url", "description": "the url of the image store", "type": "string" }, { "name": "name", "description": "the name of the image store", "type": "string" }, { "name": "zonename", "description": "the Zone name of the image store", "type": "string" }, { "name": "scope", "description": "the scope of the image store", "type": "scopetype" }, { "name": "protocol", "description": "the protocol of the image store", "type": "string" }, { "name": "providername", "description": "the provider name of the image store", "type": "string" }, { }, { "name": "id", "description": "the ID of the image store", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the image store", "type": "string" } ] }, { "name": "updateAccount", "description": "Updates account information for the authenticated user", "isasync": false, "related": "enableAccount,createAccount,listAccounts,disableAccount,listAccounts", "params": [ { "name": "newname", "description": "New name for the account", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "The UUID of the domain where the account exists", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren" }, { "name": "networkdomain", "description": "Network domain for the account's networks; empty string will update domainName with NULL value", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "Account UUID", "type": "uuid", "length": 255, "required": false, "related": "enableAccount,createAccount,updateAccount,listAccounts,disableAccount,listAccounts" }, { "name": "roleid", "description": "The UUID of the dynamic role to set for the account", "type": "uuid", "length": 255, "required": false, "related": "updateRole,createRole,listRoles" }, { "name": "accountdetails", "description": "Details for the account used to store specific parameters", "type": "map", "length": 255, "required": false }, { "name": "account", "description": "Current account name", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this account", "type": "long" }, { "name": "roletype", "description": "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)", "type": "string" }, { "name": "defaultzoneid", "description": "the default zone of the account", "type": "string" }, { }, { "name": "volumeavailable", "description": "the total volume available for this account", "type": "string" }, { "name": "state", "description": "the state of the account", "type": "string" }, { "name": "id", "description": "the id of the account", "type": "string" }, { "name": "isdefault", "description": "true if account is default, false otherwise", "type": "boolean" }, { "name": "networklimit", "description": "the total number of networks the account can own", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by account", "type": "long" }, { "name": "receivedbytes", "description": "the total number of network traffic bytes received", "type": "long" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this account", "type": "long" }, { "name": "memorylimit", "description": "the total memory (in MB) the account can own", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this account to acquire", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this account", "type": "long" }, { }, { "name": "domain", "description": "name of the Domain the account belongs too", "type": "string" }, { "name": "volumetotal", "description": "the total volume being used by this account", "type": "long" }, { "name": "iplimit", "description": "the total number of public ip addresses this account can acquire", "type": "string" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this account to acquire", "type": "string" }, { "name": "volumelimit", "description": "the total volume which can be used by this account", "type": "string" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this account", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by account", "type": "long" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this account", "type": "long" }, { "name": "iscleanuprequired", "description": "true if the account requires cleanup", "type": "boolean" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this account", "type": "string" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this account", "type": "string" }, { "name": "projectlimit", "description": "the total number of projects the account can own", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this account", "type": "string" }, { "name": "user", "description": "the list of users associated with account", "type": "list", "response": [ { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" } ] }, { "name": "projecttotal", "description": "the total number of projects being administrated by this account", "type": "long" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this account", "type": "string" }, { "name": "accounttype", "description": "account type (admin, domain-admin, user)", "type": "short" }, { "name": "groups", "description": "the list of acl groups that account belongs to", "type": "list" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this account", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by account", "type": "long" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this account", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the account can own", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the account can own", "type": "string" }, { "name": "vpclimit", "description": "the total number of vpcs the account can own", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this account", "type": "integer" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this account", "type": "string" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by account", "type": "long" }, { "name": "cpulimit", "description": "the total number of cpu cores the account can own", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by account", "type": "long" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "accountdetails", "description": "details for the account", "type": "map" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this account", "type": "string" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this account", "type": "integer" }, { "name": "domainid", "description": "id of the Domain the account belongs too", "type": "string" }, { "name": "sentbytes", "description": "the total number of network traffic bytes sent", "type": "long" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this account", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by account", "type": "float" }, { "name": "name", "description": "the name of the account", "type": "string" } ] }, { "name": "listDomains", "description": "Lists domains and provides detailed information for listed domains", "isasync": false, "related": "listDomains,listDomainChildren", "params": [ { "name": "level", "description": "List domains by domain level.", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "List domain by domain name.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "List domain by domain ID.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomains,listDomainChildren" }, { "name": "details", "description": "comma separated list of domain details requested, value can be a list of [ all, resource, min]", "type": "list", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this domain", "type": "string" }, { "name": "path", "description": "the path of the domain", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by domain", "type": "long" }, { "name": "cputotal", "description": "the total number of cpu cores owned by domain", "type": "long" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this domain", "type": "string" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by domain", "type": "long" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this domain", "type": "string" }, { }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this domain", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this domain", "type": "string" }, { "name": "parentdomainname", "description": "the domain name of the parent domain", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the domain can own", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by domain", "type": "long" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this domain", "type": "string" }, { "name": "state", "description": "the state of the domain", "type": "string" }, { "name": "volumetotal", "description": "the total volume being used by this domain", "type": "long" }, { "name": "level", "description": "the level of the domain", "type": "integer" }, { "name": "volumelimit", "description": "the total volume which can be used by this domain", "type": "string" }, { "name": "vpclimit", "description": "the total number of vpcs the domain can own", "type": "string" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this domain", "type": "long" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this domain", "type": "long" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the domain can own", "type": "string" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this domain", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this domain", "type": "string" }, { "name": "memorylimit", "description": "the total memory (in MB) the domain can own", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this domain", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "haschild", "description": "whether the domain has one or more sub-domains", "type": "boolean" }, { "name": "vpctotal", "description": "the total number of vpcs owned by domain", "type": "long" }, { "name": "name", "description": "the name of the domain", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this domain", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this domain", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this domain", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the domain can own", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this domain", "type": "string" }, { "name": "projecttotal", "description": "the total number of projects being administrated by this domain", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by domain", "type": "float" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "projectlimit", "description": "the total number of projects the domain can own", "type": "string" }, { "name": "iplimit", "description": "the total number of public ip addresses this domain can acquire", "type": "string" }, { "name": "parentdomainid", "description": "the domain ID of the parent domain", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this domain to acquire", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this domain", "type": "long" }, { "name": "networklimit", "description": "the total number of networks the domain can own", "type": "string" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this domain", "type": "long" }, { "name": "id", "description": "the ID of the domain", "type": "string" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this domain to acquire", "type": "string" } ] }, { "name": "disableAccount", "description": "Disables an account", "isasync": true, "related": "enableAccount,createAccount,listAccounts,listAccounts", "params": [ { "name": "domainid", "description": "Disables specified account in this domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "account", "description": "Disables specified account.", "type": "string", "length": 255, "required": false }, { "name": "lock", "description": "If true, only lock the account; else disable the account", "type": "boolean", "length": 255, "required": true }, { "name": "id", "description": "Account id", "type": "uuid", "length": 255, "required": false, "related": "enableAccount,createAccount,listAccounts,disableAccount,listAccounts" } ], "response": [ { }, { "name": "memorylimit", "description": "the total memory (in MB) the account can own", "type": "string" }, { }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this account", "type": "string" }, { "name": "volumetotal", "description": "the total volume being used by this account", "type": "long" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this account to acquire", "type": "string" }, { "name": "sentbytes", "description": "the total number of network traffic bytes sent", "type": "long" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this account", "type": "integer" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "isdefault", "description": "true if account is default, false otherwise", "type": "boolean" }, { "name": "domainid", "description": "id of the Domain the account belongs too", "type": "string" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this account", "type": "long" }, { "name": "cputotal", "description": "the total number of cpu cores owned by account", "type": "long" }, { "name": "projecttotal", "description": "the total number of projects being administrated by this account", "type": "long" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this account", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this account", "type": "string" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this account", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the account can own", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this account", "type": "integer" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this account to acquire", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by account", "type": "long" }, { "name": "roletype", "description": "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this account", "type": "string" }, { "name": "iplimit", "description": "the total number of public ip addresses this account can acquire", "type": "string" }, { "name": "iscleanuprequired", "description": "true if the account requires cleanup", "type": "boolean" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this account", "type": "string" }, { "name": "state", "description": "the state of the account", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the account can own", "type": "string" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this account", "type": "long" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this account", "type": "string" }, { "name": "vpclimit", "description": "the total number of vpcs the account can own", "type": "string" }, { "name": "groups", "description": "the list of acl groups that account belongs to", "type": "list" }, { "name": "projectlimit", "description": "the total number of projects the account can own", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this account", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the account can own", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this account", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this account", "type": "long" }, { "name": "networktotal", "description": "the total number of networks owned by account", "type": "long" }, { "name": "accountdetails", "description": "details for the account", "type": "map" }, { "name": "id", "description": "the id of the account", "type": "string" }, { "name": "user", "description": "the list of users associated with account", "type": "list", "response": [ { "name": "username", "description": "the user name", "type": "string" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" } ] }, { "name": "volumelimit", "description": "the total volume which can be used by this account", "type": "string" }, { "name": "defaultzoneid", "description": "the default zone of the account", "type": "string" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this account", "type": "long" }, { "name": "accounttype", "description": "account type (admin, domain-admin, user)", "type": "short" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by account", "type": "long" }, { "name": "vpctotal", "description": "the total number of vpcs owned by account", "type": "long" }, { "name": "name", "description": "the name of the account", "type": "string" }, { "name": "receivedbytes", "description": "the total number of network traffic bytes received", "type": "long" }, { "name": "networklimit", "description": "the total number of networks the account can own", "type": "string" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this account", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by account", "type": "float" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this account", "type": "string" }, { "name": "domain", "description": "name of the Domain the account belongs too", "type": "string" } ] }, { "name": "updateNetwork", "description": "Updates a network", "isasync": true, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork", "params": [ { "name": "updateinsequence", "description": "if true, we will update the routers one after the other. applicable only for redundant router based networks using virtual router as provider", "type": "boolean", "length": 255, "required": false }, { "name": "guestvmcidr", "description": "CIDR for guest VMs, CloudStack allocates IPs to guest VMs only from this CIDR", "type": "string", "length": 255, "required": false }, { "name": "changecidr", "description": "Force update even if CIDR type is different", "type": "boolean", "length": 255, "required": false }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean", "length": 255, "required": false }, { "name": "networkdomain", "description": "network domain", "type": "string", "length": 255, "required": false }, { "name": "displaytext", "description": "the new display text for the network", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "the new name for the network", "type": "string", "length": 255, "required": false }, { "name": "networkofferingid", "description": "network offering ID", "type": "uuid", "length": 255, "required": false, "related": "listNetworkOfferings" }, { "name": "forced", "description": "Setting this to true will cause a forced network update,", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the ID of the network", "type": "uuid", "length": 255, "required": true, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,updateNetwork,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" } ] }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" } ] }, { "name": "name", "description": "the service name", "type": "string" } ] }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" } ] }, { "name": "listUsageTypes", "description": "List Usage Types", "isasync": false, "related": "", "params": [ ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "usagetypeid", "description": "usage type", "type": "integer" }, { "name": "description", "description": "description of usage type", "type": "string" } ] }, { "name": "deleteTemplate", "description": "Deletes a template from the system. All virtual machines using the deleted template will not be affected.", "isasync": true, "params": [ { "name": "forced", "description": "Force delete a template.", "type": "boolean", "length": 255, "required": false, "since": "4.9+" }, { "name": "id", "description": "the ID of the template", "type": "uuid", "length": 255, "required": true, "related": "listIsos,createTemplate,registerTemplate,registerIso,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "zoneid", "description": "the ID of zone of the template", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "listNetworkACLLists", "description": "Lists all network ACLs", "isasync": false, "related": "createNetworkACLList", "params": [ { "name": "vpcid", "description": "list network ACLs by VPC ID", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,listVPCs,createVPC,restartVPC,createVPC,updateVPC" }, { "name": "id", "description": "Lists network ACL with the specified ID.", "type": "uuid", "length": 255, "required": false, "related": "createNetworkACLList,listNetworkACLLists" }, { "name": "networkid", "description": "list network ACLs by network ID", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "list network ACLs by specified name", "type": "string", "length": 255, "required": false }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "id", "description": "the ID of the ACL", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "fordisplay", "description": "is ACL for display to the regular user", "type": "boolean" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "name", "description": "the Name of the ACL", "type": "string" }, { }, { "name": "description", "description": "Description of the ACL", "type": "string" }, { "name": "vpcid", "description": "Id of the VPC this ACL is associated with", "type": "string" } ] }, { "name": "archiveSnapshot", "description": "Archives (moves) a snapshot on primary storage to secondary storage", "isasync": true, "related": "revertSnapshot", "params": [ { "name": "id", "description": "The ID of the snapshot", "type": "uuid", "length": 255, "required": true, "related": "archiveSnapshot,revertSnapshot" } ], "response": [ { "name": "name", "description": "name of the snapshot", "type": "string" }, { "name": "volumename", "description": "name of the disk volume", "type": "string" }, { "name": "virtualsize", "description": "virtual size of backedup snapshot on image store", "type": "long" }, { "name": "zoneid", "description": "id of the availability zone", "type": "string" }, { "name": "account", "description": "the account associated with the snapshot", "type": "string" }, { "name": "snapshottype", "description": "the type of the snapshot", "type": "string" }, { "name": "volumetype", "description": "type of the disk volume", "type": "string" }, { "name": "ostypeid", "description": "id of the os on volume", "type": "string" }, { "name": "physicalsize", "description": "physical size of backedup snapshot on image store", "type": "long" }, { "name": "id", "description": "ID of the snapshot", "type": "string" }, { }, { "name": "domainid", "description": "the domain ID of the snapshot's account", "type": "string" }, { "name": "revertable", "description": "indicates whether the underlying storage supports reverting the volume to this snapshot", "type": "boolean" }, { "name": "projectid", "description": "the project id of the snapshot", "type": "string" }, { "name": "created", "description": " the date the snapshot was created", "type": "date" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "intervaltype", "description": "valid types are hourly, daily, weekly, monthy, template, and none.", "type": "string" }, { "name": "osdisplayname", "description": "display name of the os on volume", "type": "string" }, { "name": "project", "description": "the project name of the snapshot", "type": "string" }, { "name": "domain", "description": "the domain name of the snapshot's account", "type": "string" }, { "name": "volumeid", "description": "ID of the disk volume", "type": "string" }, { "name": "state", "description": "the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage", "type": "state" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with snapshot", "type": "list", "response": [ { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "locationtype", "description": "valid location types are primary and secondary.", "type": "string" } ] }, { "name": "deleteVPC", "description": "Deletes a VPC", "isasync": true, "params": [ { "name": "id", "description": "the ID of the VPC", "type": "uuid", "length": 255, "required": true, "related": "migrateVPC,listVPCs,listVPCs,createVPC,restartVPC,createVPC,updateVPC" } ], "response": [ { }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "updateVpnGateway", "description": "Updates site to site vpn local gateway", "since": "4.4", "isasync": true, "related": "createVpnGateway,listVpnGateways", "params": [ { "name": "id", "description": "id of customer gateway", "type": "uuid", "length": 255, "required": true, "related": "updateVpnGateway,createVpnGateway,listVpnGateways" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "fordisplay", "description": "an optional field, whether to the display the vpn to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "vpcid", "description": "the vpc id of this gateway", "type": "string" }, { "name": "publicip", "description": "the public IP address", "type": "string" }, { "name": "id", "description": "the vpn gateway ID", "type": "string" }, { "name": "projectid", "description": "the project id", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "domainid", "description": "the domain id of the owner", "type": "string" }, { }, { "name": "account", "description": "the owner", "type": "string" }, { "name": "project", "description": "the project name", "type": "string" }, { "name": "fordisplay", "description": "is vpn gateway for display to the regular user", "type": "boolean" } ] }, { "name": "releaseDedicatedGuestVlanRange", "description": "Releases a dedicated guest vlan range to the system", "isasync": true, "params": [ { "name": "id", "description": "the ID of the dedicated guest vlan range", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "deleteSecurityGroup", "description": "Deletes security group", "isasync": false, "params": [ { "name": "name", "description": "The ID of the security group. Mutually exclusive with id parameter", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "the account of the security group. Must be specified with domain ID", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the domain ID of account owning the security group", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "id", "description": "The ID of the security group. Mutually exclusive with name parameter", "type": "uuid", "length": 255, "required": false, "related": "createSecurityGroup" }, { "name": "projectid", "description": "the project of the security group", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "migrateVirtualMachine", "description": "Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "virtualmachineid", "description": "the ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,migrateVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "hostid", "description": "Destination Host ID to migrate VM to. Required for live migrating a VM from host to host", "type": "uuid", "length": 255, "required": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" }, { "name": "storageid", "description": "Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume", "type": "uuid", "length": 255, "required": false, "related": "findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" } ] }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] } ] }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" } ] } ] }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" } ] }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" } ] }, { "name": "createTemplate", "description": "Creates a template of a virtual machine. The virtual machine must be in a STOPPED state. A template created from this command is automatically designated as a private template visible to the account that created it.", "isasync": true, "related": "listIsos,registerTemplate,registerIso,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates", "params": [ { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean", "length": 255, "required": false }, { "name": "name", "description": "the name of the template", "type": "string", "length": 255, "required": true }, { "name": "displaytext", "description": "the display text of the template. This is usually used for display purposes.", "type": "string", "length": 4096, "required": true }, { "name": "ostypeid", "description": "the ID of the OS Type that best represents the OS of this template.", "type": "uuid", "length": 255, "required": true, "related": "addGuestOs,listOsTypes" }, { "name": "projectid", "description": "create template for the project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "snapshotid", "description": "the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in", "type": "uuid", "length": 255, "required": false, "related": "revertSnapshot" }, { "name": "volumeid", "description": "the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in", "type": "uuid", "length": 255, "required": false, "related": "attachVolume,createVolume,createVolume,listVolumes,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "sshkeyenabled", "description": "true if the template supports the sshkey upload feature; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "details", "description": "Template details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].hypervisortoolsversion=xenserver61", "type": "map", "length": 255, "required": false }, { "name": "templatetag", "description": "the tag for this template.", "type": "string", "length": 255, "required": false }, { "name": "bits", "description": "32 or 64 bit", "type": "integer", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "passwordenabled", "description": "true if the template supports the password reset feature; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "requireshvm", "description": "true if the template requres HVM, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "url", "description": "Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server", "type": "string", "length": 2048, "required": false }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "sourcetemplateid", "description": "the template ID of the parent template if present", "type": "string" }, { }, { "name": "requireshvm", "description": "true if template requires HVM enabled, false otherwise", "type": "boolean" }, { "name": "ostypename", "description": "the name of the OS type for this template.", "type": "string" }, { "name": "checksum", "description": "checksum of the template", "type": "string" }, { "name": "isextractable", "description": "true if the template is extractable, false otherwise", "type": "boolean" }, { "name": "status", "description": "the status of the template", "type": "string" }, { "name": "childtemplates", "description": "if root disk template, then ids of the datas disk templates this template owns", "type": "set" }, { "name": "passwordenabled", "description": "true if the reset password feature is enabled, false otherwise", "type": "boolean" }, { "name": "zonename", "description": "the name of the zone for this template", "type": "string" }, { "name": "size", "description": "the size of the template", "type": "long" }, { "name": "templatetag", "description": "the tag of this template", "type": "string" }, { "name": "projectid", "description": "the project id of the template", "type": "string" }, { "name": "parenttemplateid", "description": "if Datadisk template, then id of the root disk template this template belongs to", "type": "string" }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean" }, { "name": "bits", "description": "the processor bit size", "type": "int" }, { "name": "hostname", "description": "the name of the secondary storage host for the template", "type": "string" }, { "name": "directdownload", "description": "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage", "type": "boolean" }, { "name": "ostypeid", "description": "the ID of the OS type for this template.", "type": "string" }, { "name": "displaytext", "description": "the template display text", "type": "string" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { "name": "format", "description": "the format of the template.", "type": "imageformat" }, { }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean" }, { "name": "physicalsize", "description": "the physical size of the template", "type": "long" }, { "name": "zoneid", "description": "the ID of the zone for this template", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean" }, { "name": "name", "description": "the template name", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "created", "description": "the date this template was created", "type": "date" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "accountid", "description": "the account id to which the template belongs", "type": "string" }, { "name": "domain", "description": "the name of the domain to which the template belongs", "type": "string" }, { "name": "removed", "description": "the date this template was removed", "type": "date" }, { "name": "account", "description": "the account name to which the template belongs", "type": "string" }, { "name": "details", "description": "additional key/value details tied with template", "type": "map" }, { "name": "sshkeyenabled", "description": "true if template is sshkey enabled, false otherwise", "type": "boolean" }, { "name": "crossZones", "description": "true if the template is managed across all Zones, false otherwise", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "templatetype", "description": "the type of the template", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "isready", "description": "true if the template is ready to be deployed from, false otherwise.", "type": "boolean" }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" }, { "name": "project", "description": "the project name of the template", "type": "string" }, { "name": "hostid", "description": "the ID of the secondary storage host for the template", "type": "string" } ] }, { "name": "listBaremetalRct", "description": "list baremetal rack configuration", "isasync": false, "related": "addBaremetalRct", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "url", "description": "url", "type": "string" }, { }, { "name": "id", "description": "id of rct", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listDedicatedClusters", "description": "Lists dedicated clusters.", "isasync": false, "related": "", "params": [ { "name": "account", "description": "the name of the account associated with the cluster. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "clusterid", "description": "the ID of the cluster", "type": "uuid", "length": 255, "required": false, "related": "addCluster,updateCluster" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the ID of the domain associated with the cluster", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "affinitygroupid", "description": "list dedicated clusters by affinity group", "type": "uuid", "length": 255, "required": false, "related": "" } ], "response": [ { "name": "accountid", "description": "the Account ID of the cluster", "type": "string" }, { "name": "clusterid", "description": "the ID of the cluster", "type": "string" }, { "name": "affinitygroupid", "description": "the Dedication Affinity Group ID of the cluster", "type": "string" }, { "name": "domainid", "description": "the domain ID of the cluster", "type": "string" }, { "name": "id", "description": "the ID of the dedicated resource", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "clustername", "description": "the name of the cluster", "type": "string" }, { } ] }, { "name": "uploadCustomCertificate", "description": "Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself.", "isasync": true, "related": "", "params": [ { "name": "id", "description": "An integer providing the location in a chain that the certificate will hold. Usually, this can be left empty. When creating a chain, the top level certificate should have an ID of 1, with each step in the chain incrementing by one. Example, CA with id = 1, Intermediate CA with id = 2, Site certificate with ID = 3", "type": "integer", "length": 255, "required": false }, { "name": "certificate", "description": "The certificate to be uploaded.", "type": "string", "length": 65535, "required": true }, { "name": "privatekey", "description": "The private key for the attached certificate.", "type": "string", "length": 65535, "required": false }, { "name": "name", "description": "A name / alias for the certificate.", "type": "string", "length": 255, "required": false }, { "name": "domainsuffix", "description": "DNS domain suffix that the certificate is granted for.", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "message", "description": "message of the certificate upload operation", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "listCAProviders", "description": "Lists available certificate authority providers in CloudStack", "since": "4.11.0", "isasync": false, "related": "", "params": [ { "name": "name", "description": "List CA service provider by name", "type": "string", "length": 255, "required": false } ], "response": [ { }, { }, { "name": "name", "description": "the CA service provider name", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "description", "description": "the description of the CA service provider", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteVpnCustomerGateway", "description": "Delete site to site vpn customer gateway", "isasync": true, "params": [ { "name": "id", "description": "id of customer gateway", "type": "uuid", "length": 255, "required": true, "related": "listVpnCustomerGateways,createVpnCustomerGateway" } ], "response": [ { }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "acquirePodIpAddress", "description": "Allocates IP addresses in respective Pod of a Zone", "isasync": false, "related": "", "params": [ { "name": "zoneid", "description": "the ID of the zone", "type": "string", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "podid", "description": "Pod ID", "type": "string", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" } ], "response": [ { "name": "nicid", "description": "the ID of the nic", "type": "long" }, { "name": "gateway", "description": "Gateway for Pod ", "type": "string" }, { }, { "name": "cidr", "description": "CIDR of the Pod", "type": "string" }, { "name": "ipaddress", "description": "Allocated IP address", "type": "string" }, { "name": "hostmac", "description": "MAC address of the pod the IP", "type": "long" }, { }, { "name": "id", "description": "the ID of the pod the IP address", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "podid", "description": "the ID of the pod the IP address belongs to", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listPortForwardingRules", "description": "Lists all port forwarding rules for an IP address.", "isasync": false, "related": "updatePortForwardingRule", "params": [ { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "id", "description": "Lists rule with the specified ID.", "type": "uuid", "length": 255, "required": false, "related": "listPortForwardingRules,updatePortForwardingRule" }, { "name": "ipaddressid", "description": "the ID of IP address of the port forwarding services", "type": "uuid", "length": 255, "required": false, "related": "updateIpAddress,associateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "networkid", "description": "list port forwarding rules for certain network", "type": "uuid", "length": 255, "required": false, "since": "4.3", "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork" } ], "response": [ { "name": "privateport", "description": "the starting port of port forwarding rule's private port range", "type": "string" }, { "name": "publicport", "description": "the starting port of port forwarding rule's public port range", "type": "string" }, { "name": "privateendport", "description": "the ending port of port forwarding rule's private port range", "type": "string" }, { "name": "ipaddress", "description": "the public ip address for the port forwarding rule", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "virtualmachineid", "description": "the VM ID for the port forwarding rule", "type": "string" }, { "name": "ipaddressid", "description": "the public ip address id for the port forwarding rule", "type": "string" }, { "name": "fordisplay", "description": "is firewall for display to the regular user", "type": "boolean" }, { "name": "id", "description": "the ID of the port forwarding rule", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "networkid", "description": "the id of the guest network the port forwarding rule belongs to", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "protocol", "description": "the protocol of the port forwarding rule", "type": "string" }, { "name": "virtualmachinedisplayname", "description": "the VM display name for the port forwarding rule", "type": "string" }, { }, { "name": "vmguestip", "description": "the vm ip address for the port forwarding rule", "type": "string" }, { "name": "publicendport", "description": "the ending port of port forwarding rule's private port range", "type": "string" }, { "name": "virtualmachinename", "description": "the VM name for the port forwarding rule", "type": "string" }, { } ] }, { "name": "enableOutOfBandManagementForCluster", "description": "Enables out-of-band management for a cluster", "since": "4.9.0", "isasync": true, "related": "disableOutOfBandManagementForHost,enableOutOfBandManagementForHost,disableOutOfBandManagementForCluster", "params": [ { "name": "clusterid", "description": "the ID of the cluster", "type": "uuid", "length": 255, "required": true, "related": "addCluster,updateCluster" } ], "response": [ { "name": "powerstate", "description": "the out-of-band management interface powerState of the host", "type": "powerstate" }, { "name": "driver", "description": "the out-of-band management driver for the host", "type": "string" }, { "name": "port", "description": "the out-of-band management interface port", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "username", "description": "the out-of-band management interface username", "type": "string" }, { }, { "name": "password", "description": "the out-of-band management interface password", "type": "string" }, { }, { "name": "action", "description": "the out-of-band management action (if issued)", "type": "string" }, { "name": "status", "description": "the operation result", "type": "boolean" }, { "name": "description", "description": "the operation result description", "type": "string" }, { "name": "address", "description": "the out-of-band management interface address", "type": "string" }, { "name": "enabled", "description": "true if out-of-band management is enabled for the host", "type": "boolean" } ] }, { "name": "updateTemplatePermissions", "description": "Updates a template visibility permissions. A public template is visible to all accounts within the same domain. A private template is visible only to the owner of the template. A priviledged template is a private template with account permissions added. Only accounts specified under the template permissions are visible to them.", "isasync": false, "params": [ { "name": "op", "description": "permission operator (add, remove, reset)", "type": "string", "length": 255, "required": false }, { "name": "isextractable", "description": "true if the template/iso is extractable, false other wise. Can be set only by root admin", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the template ID", "type": "uuid", "length": 255, "required": true, "related": "listIsos,registerTemplate,registerIso,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "accounts", "description": "a comma delimited list of accounts. If specified, \"op\" parameter has to be passed in.", "type": "list", "length": 255, "required": false }, { "name": "isfeatured", "description": "true for featured template/iso, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "ispublic", "description": "true for public template/iso, false for private templates/isos", "type": "boolean", "length": 255, "required": false }, { "name": "projectids", "description": "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.", "type": "list", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" } ], "response": [ { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listTrafficMonitors", "description": "List traffic monitor Hosts.", "isasync": false, "related": "addTrafficMonitor", "params": [ { "name": "zoneid", "description": "zone Id", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "timeout", "description": "the timeout (in seconds) for requests to the external firewall", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "numretries", "description": "the number of times to retry requests to the external firewall", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "ipaddress", "description": "the management IP address of the external firewall", "type": "string" }, { "name": "id", "description": "the ID of the external firewall", "type": "string" }, { }, { "name": "zoneid", "description": "the zone ID of the external firewall", "type": "string" }, { } ] }, { "name": "resetPasswordForVirtualMachine", "description": "Resets the password for virtual machine. The virtual machine must be in a \"Stopped\" state and the template must already support this feature for this command to take effect. [async]", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,resetPasswordForVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" } ] }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" } ] }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" } ] }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" } ] }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "type", "description": "the type of the affinity group", "type": "string" } ] }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" } ] }, { "name": "listBrocadeVcsDevices", "description": "Lists Brocade VCS Switches", "isasync": false, "related": "", "params": [ { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "vcsdeviceid", "description": "Brocade VCS switch ID", "type": "uuid", "length": 255, "required": false, "related": "listBrocadeVcsDevices" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "vcsdeviceid", "description": "device id of the Brocade Vcs", "type": "string" }, { "name": "brocadedevicename", "description": "device name", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical Network to which this Brocade VCS belongs to", "type": "string" }, { "name": "hostname", "description": "the principal switch Ip address", "type": "string" }, { } ] }, { "name": "updatePortForwardingRule", "description": "Updates a port forwarding rule. Only the private port and the virtual machine can be updated.", "isasync": true, "related": "", "params": [ { "name": "virtualmachineid", "description": "the ID of the virtual machine for the port forwarding rule", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "privateendport", "description": "the private end port of the port forwarding rule", "type": "integer", "length": 255, "required": false }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "vmguestip", "description": "VM guest nic Secondary ip address for the port forwarding rule", "type": "string", "length": 255, "required": false, "since": "4.5" }, { "name": "id", "description": "the ID of the port forwarding rule", "type": "uuid", "length": 255, "required": true, "since": "4.4", "related": "updatePortForwardingRule" }, { "name": "privateport", "description": "the private start port of the port forwarding rule", "type": "integer", "length": 255, "required": false }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "networkid", "description": "the id of the guest network the port forwarding rule belongs to", "type": "string" }, { }, { "name": "ipaddressid", "description": "the public ip address id for the port forwarding rule", "type": "string" }, { "name": "id", "description": "the ID of the port forwarding rule", "type": "string" }, { "name": "virtualmachinename", "description": "the VM name for the port forwarding rule", "type": "string" }, { "name": "vmguestip", "description": "the vm ip address for the port forwarding rule", "type": "string" }, { "name": "publicport", "description": "the starting port of port forwarding rule's public port range", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "protocol", "description": "the protocol of the port forwarding rule", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "publicendport", "description": "the ending port of port forwarding rule's private port range", "type": "string" }, { "name": "virtualmachineid", "description": "the VM ID for the port forwarding rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "ipaddress", "description": "the public ip address for the port forwarding rule", "type": "string" }, { "name": "fordisplay", "description": "is firewall for display to the regular user", "type": "boolean" }, { "name": "privateport", "description": "the starting port of port forwarding rule's private port range", "type": "string" }, { "name": "privateendport", "description": "the ending port of port forwarding rule's private port range", "type": "string" }, { "name": "virtualmachinedisplayname", "description": "the VM display name for the port forwarding rule", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "linkDomainToLdap", "description": "link an existing cloudstack domain to group or OU in ldap", "since": "4.6.0", "isasync": false, "related": "linkAccountToLdap", "params": [ { "name": "name", "description": "name of the group or OU in LDAP", "type": "string", "length": 255, "required": false }, { "name": "type", "description": "type of the ldap name. GROUP or OU", "type": "string", "length": 255, "required": true }, { "name": "domainid", "description": "The id of the domain which has to be linked to LDAP.", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomainChildren" }, { "name": "admin", "description": "domain admin username in LDAP ", "type": "string", "length": 255, "required": false }, { "name": "accounttype", "description": "Type of the account to auto import. Specify 0 for user and 2 for domain admin", "type": "short", "length": 255, "required": true }, { "name": "ldapdomain", "description": "name of the group or OU in LDAP", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "type", "description": "type of the name in LDAP which is linke to the domain", "type": "string" }, { "name": "accountid", "description": "Domain Admin accountId that is created", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "accounttype", "description": "Type of the account to auto import", "type": "short" }, { "name": "ldapdomain", "description": "name of the group or OU in LDAP which is linked to the domain", "type": "string" }, { "name": "domainid", "description": "id of the Domain which is linked to LDAP", "type": "string" }, { "name": "name", "description": "name of the group or OU in LDAP which is linked to the domain", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "associateIpAddress", "description": "Acquires and associates a public IP to an account. Either of the parameters are required, i.e. either zoneId, or networkId, or vpcId ", "isasync": true, "related": "updateIpAddress,associateIpAddress,listPublicIpAddresses", "params": [ { "name": "isportable", "description": "should be set to true if public IP is required to be transferable across zones, if not specified defaults to false", "type": "boolean", "length": 255, "required": false }, { "name": "networkid", "description": "The network this IP address should be associated to.", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "zoneid", "description": "the ID of the availability zone you want to acquire an public IP address from", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "vpcid", "description": "the VPC you want the IP address to be associated with", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,listVPCs,createVPC,restartVPC,createVPC,updateVPC" }, { "name": "regionid", "description": "region ID from where portable IP is to be associated.", "type": "integer", "length": 255, "required": false, "related": "addRegion,listRegions" }, { "name": "fordisplay", "description": "an optional field, whether to the display the IP to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "account", "description": "the account to associate with this IP address", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the ID of the domain to associate with this IP address", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "projectid", "description": "Deploy VM for the project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" } ], "response": [ { "name": "forvirtualnetwork", "description": "the virtual network for the IP address", "type": "boolean" }, { "name": "issourcenat", "description": "true if the IP address is a source nat address, false otherwise", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated with ip address", "type": "list", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "isportable", "description": "is public IP portable across the zones", "type": "boolean" }, { "name": "ipaddress", "description": "public IP address", "type": "string" }, { "name": "account", "description": "the account the public IP address is associated with", "type": "string" }, { "name": "zoneid", "description": "the ID of the zone the public IP address belongs to", "type": "string" }, { "name": "networkid", "description": "the ID of the Network where ip belongs to", "type": "string" }, { "name": "vmipaddress", "description": "virtual machine (dnat) ip address (not null only for static nat Ip)", "type": "string" }, { "name": "associatednetworkid", "description": "the ID of the Network associated with the IP address", "type": "string" }, { "name": "vpcid", "description": "VPC the ip belongs to", "type": "string" }, { }, { "name": "vlanid", "description": "the ID of the VLAN associated with the IP address. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "purpose", "description": "purpose of the IP address. In Acton this value is not null for Ips with isSystem=true, and can have either StaticNat or LB value", "type": "string" }, { "name": "virtualmachinedisplayname", "description": "virtual machine display name the ip address is assigned to (not null only for static nat Ip)", "type": "string" }, { "name": "issystem", "description": "true if this ip is system ip (was allocated as a part of deployVm or createLbRule)", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "public IP address id", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "state", "description": "State of the ip address. Can be: Allocatin, Allocated and Releasing", "type": "string" }, { "name": "fordisplay", "description": "is public ip for display to the regular user", "type": "boolean" }, { "name": "vlanname", "description": "the VLAN associated with the IP address", "type": "string" }, { "name": "zonename", "description": "the name of the zone the public IP address belongs to", "type": "string" }, { "name": "isstaticnat", "description": "true if this ip is for static nat, false otherwise", "type": "boolean" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "associatednetworkname", "description": "the name of the Network associated with the IP address", "type": "string" }, { "name": "domain", "description": "the domain the public IP address is associated with", "type": "string" }, { "name": "virtualmachineid", "description": "virtual machine id the ip address is assigned to (not null only for static nat Ip)", "type": "string" }, { "name": "allocated", "description": "date the public IP address was acquired", "type": "date" }, { "name": "domainid", "description": "the domain ID the public IP address is associated with", "type": "string" }, { }, { "name": "virtualmachinename", "description": "virtual machine name the ip address is assigned to (not null only for static nat Ip)", "type": "string" } ] }, { "name": "getSolidFireVolumeAccessGroupIds", "description": "Get the SF Volume Access Group IDs", "isasync": false, "related": "", "params": [ { "name": "clusterid", "description": "Cluster UUID", "type": "string", "length": 255, "required": true }, { "name": "storageid", "description": "Storage Pool UUID", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "solidFireVolumeAccessGroupIds", "description": "SolidFire Volume Access Group Ids", "type": "long[]" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "deleteVpnConnection", "description": "Delete site to site vpn connection", "isasync": true, "params": [ { "name": "id", "description": "id of vpn connection", "type": "uuid", "length": 255, "required": true, "related": "createVpnConnection,listVpnConnections" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "deleteManagementNetworkIpRange", "description": "Deletes a management network IP range. This action is only allowed when no IPs in this range are allocated.", "since": "4.11.0.0", "isasync": true, "params": [ { "name": "podid", "description": "UUID of POD, where the IP range belongs to.", "type": "uuid", "length": 255, "required": true, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "endip", "description": "The ending IP address.", "type": "string", "length": 255, "required": true }, { "name": "vlan", "description": "The vlan id the ip range sits on", "type": "string", "length": 255, "required": true }, { "name": "startip", "description": "The starting IP address.", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "listVpnCustomerGateways", "description": "Lists site to site vpn customer gateways", "isasync": false, "related": "createVpnCustomerGateway", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "id", "description": "id of the customer gateway", "type": "uuid", "length": 255, "required": false, "related": "listVpnCustomerGateways,createVpnCustomerGateway" } ], "response": [ { "name": "cidrlist", "description": "guest cidr list of the customer gateway", "type": "string" }, { "name": "ikelifetime", "description": "Lifetime of IKE SA of customer gateway", "type": "long" }, { "name": "id", "description": "the vpn gateway ID", "type": "string" }, { "name": "gateway", "description": "public ip address id of the customer gateway", "type": "string" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "dpd", "description": "if DPD is enabled for customer gateway", "type": "boolean" }, { "name": "esppolicy", "description": "IPsec policy of customer gateway", "type": "string" }, { "name": "ipsecpsk", "description": "IPsec preshared-key of customer gateway", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "forceencap", "description": "if Force NAT Encapsulation is enabled for customer gateway", "type": "boolean" }, { "name": "ipaddress", "description": "guest ip of the customer gateway", "type": "string" }, { }, { "name": "ikepolicy", "description": "IKE policy of customer gateway", "type": "string" }, { "name": "name", "description": "name of the customer gateway", "type": "string" }, { }, { "name": "domainid", "description": "the domain id of the owner", "type": "string" }, { "name": "projectid", "description": "the project id", "type": "string" }, { "name": "account", "description": "the owner", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "project", "description": "the project name", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "esplifetime", "description": "Lifetime of ESP SA of customer gateway", "type": "long" } ] }, { "name": "resetSSHKeyForVirtualMachine", "description": "Resets the SSH Key for virtual machine. The virtual machine must be in a \"Stopped\" state. [async]", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "keypair", "description": "name of the ssh key pair used to login to the virtual machine", "type": "string", "length": 255, "required": true }, { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,resetSSHKeyForVirtualMachine,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "account", "description": "an optional account for the ssh key. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "projectid", "description": "an optional project for the ssh key", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" } ], "response": [ { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" } ] }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "type", "description": "the type of the nic", "type": "string" } ] }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" } ] }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "description", "description": "the description of the security group", "type": "string" } ] }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" } ] }, { "name": "createNetworkACL", "description": "Creates a ACL rule in the given network (the network has to belong to VPC)", "isasync": true, "related": "moveNetworkAclItem,updateNetworkACLItem", "params": [ { "name": "networkid", "description": "The network of the VM the ACL will be created for", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "aclid", "description": "The network of the VM the ACL will be created for", "type": "uuid", "length": 255, "required": false, "related": "createNetworkACLList" }, { "name": "protocol", "description": "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number", "type": "string", "length": 255, "required": true }, { "name": "icmpcode", "description": "error code for this ICMP message", "type": "integer", "length": 255, "required": false }, { "name": "traffictype", "description": "the traffic type for the ACL,can be ingress or egress, defaulted to ingress if not specified", "type": "string", "length": 255, "required": false }, { "name": "action", "description": "scl entry action, allow or deny", "type": "string", "length": 255, "required": false }, { "name": "number", "description": "The number of the ACL item, its ordering", "type": "integer", "length": 255, "required": false }, { "name": "cidrlist", "description": "the CIDR list to allow traffic from/to", "type": "list", "length": 255, "required": false }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "endport", "description": "the ending port of ACL", "type": "integer", "length": 255, "required": false }, { "name": "startport", "description": "the starting port of ACL", "type": "integer", "length": 255, "required": false }, { "name": "icmptype", "description": "type of the ICMP message being sent", "type": "integer", "length": 255, "required": false }, { "name": "reason", "description": "A description indicating why the ACL rule is required.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "number", "description": "Number of the ACL Item", "type": "integer" }, { "name": "reason", "description": "an explanation on why this ACL rule is being applied", "type": "string" }, { "name": "traffictype", "description": "the traffic type for the ACL", "type": "string" }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer" }, { "name": "aclid", "description": "the ID of the ACL this item belongs to", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "id", "description": "the ID of the ACL Item", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "startport", "description": "the starting port of ACL's port range", "type": "string" }, { "name": "action", "description": "Action of ACL Item. Allow/Deny", "type": "string" }, { "name": "protocol", "description": "the protocol of the ACL", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the network ACLs", "type": "list", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "endport", "description": "the ending port of ACL's port range", "type": "string" }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer" }, { } ] }, { "name": "createGlobalLoadBalancerRule", "description": "Creates a global load balancer rule", "isasync": true, "related": "listGlobalLoadBalancerRules,updateGlobalLoadBalancerRule", "params": [ { "name": "description", "description": "the description of the load balancer rule", "type": "string", "length": 4096, "required": false }, { "name": "gslbstickysessionmethodname", "description": "session sticky method (sourceip) if not specified defaults to sourceip", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the domain ID associated with the load balancer", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "name", "description": "name of the load balancer rule", "type": "string", "length": 255, "required": true }, { "name": "gslbservicetype", "description": "GSLB service type (tcp, udp, http)", "type": "string", "length": 255, "required": true }, { "name": "regionid", "description": "region where the global load balancer is going to be created.", "type": "integer", "length": 255, "required": true, "related": "addRegion,listRegions" }, { "name": "gslbdomainname", "description": "domain name for the GSLB service.", "type": "string", "length": 255, "required": true }, { "name": "account", "description": "the account associated with the global load balancer. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "gslblbmethod", "description": "load balancer algorithm (roundrobin, leastconn, proximity) that method is used to distribute traffic across the zones participating in global server load balancing, if not specified defaults to 'round robin'", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "gslblbmethod", "description": "Load balancing method used for the global load balancer", "type": "string" }, { "name": "gslbstickysessionmethodname", "description": "session persistence method used for the global load balancer", "type": "string" }, { "name": "regionid", "description": "Region Id in which global load balancer is created", "type": "integer" }, { "name": "account", "description": "the account of the load balancer rule", "type": "string" }, { "name": "gslbservicetype", "description": "GSLB service type", "type": "string" }, { "name": "domainid", "description": "the domain ID of the load balancer rule", "type": "string" }, { "name": "id", "description": "global load balancer rule ID", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "projectid", "description": "the project id of the load balancer", "type": "string" }, { "name": "name", "description": "name of the global load balancer rule", "type": "string" }, { }, { }, { "name": "gslbdomainname", "description": "DNS domain name given for the global load balancer", "type": "string" }, { "name": "description", "description": "the description of the global load balancer rule", "type": "string" }, { "name": "project", "description": "the project name of the load balancer", "type": "string" }, { "name": "loadbalancerrule", "description": "List of load balancer rules that are part of GSLB rule", "type": "list", "response": [ { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "domain", "description": "the domain of the load balancer rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the loadbalanacer rule", "type": "string" }, { "name": "description", "description": "the description of the load balancer", "type": "string" }, { "name": "publicip", "description": "the public ip address", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with load balancer", "type": "list", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "id", "description": "the load balancer rule ID", "type": "string" }, { "name": "privateport", "description": "the private port", "type": "string" }, { "name": "account", "description": "the account of the load balancer rule", "type": "string" }, { "name": "zonename", "description": "the name of the zone the load balancer rule belongs to", "type": "string" }, { "name": "name", "description": "the name of the load balancer", "type": "string" }, { "name": "algorithm", "description": "the load balancer algorithm (source, roundrobin, leastconn)", "type": "string" }, { "name": "domainid", "description": "the domain ID of the load balancer rule", "type": "string" }, { "name": "zoneid", "description": "the id of the zone the rule belongs to", "type": "string" }, { "name": "networkid", "description": "the id of the guest network the lb rule belongs to", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "publicport", "description": "the public port", "type": "string" }, { "name": "projectid", "description": "the project id of the load balancer", "type": "string" }, { "name": "project", "description": "the project name of the load balancer", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "publicipid", "description": "the public ip address id", "type": "string" } ] }, { "name": "domain", "description": "the domain of the load balancer rule", "type": "string" } ] }, { "name": "deleteNetscalerLoadBalancer", "description": " delete a netscaler load balancer device", "isasync": true, "params": [ { "name": "lbdeviceid", "description": "netscaler load balancer device ID", "type": "uuid", "length": 255, "required": true, "related": "addNetscalerLoadBalancer,deployNetscalerVpx,listNetscalerLoadBalancers,registerNetscalerControlCenter" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listGlobalLoadBalancerRules", "description": "Lists load balancer rules.", "isasync": false, "related": "updateGlobalLoadBalancerRule", "params": [ { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "regionid", "description": "region ID", "type": "integer", "length": 255, "required": false, "related": "addRegion,listRegions" }, { "name": "id", "description": "the ID of the global load balancer rule", "type": "uuid", "length": 255, "required": false, "related": "listGlobalLoadBalancerRules,updateGlobalLoadBalancerRule" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "project", "description": "the project name of the load balancer", "type": "string" }, { "name": "id", "description": "global load balancer rule ID", "type": "string" }, { "name": "loadbalancerrule", "description": "List of load balancer rules that are part of GSLB rule", "type": "list", "response": [ { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "zoneid", "description": "the id of the zone the rule belongs to", "type": "string" }, { "name": "algorithm", "description": "the load balancer algorithm (source, roundrobin, leastconn)", "type": "string" }, { "name": "projectid", "description": "the project id of the load balancer", "type": "string" }, { "name": "description", "description": "the description of the load balancer", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "publicip", "description": "the public ip address", "type": "string" }, { "name": "privateport", "description": "the private port", "type": "string" }, { "name": "domainid", "description": "the domain ID of the load balancer rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the loadbalanacer rule", "type": "string" }, { "name": "zonename", "description": "the name of the zone the load balancer rule belongs to", "type": "string" }, { "name": "project", "description": "the project name of the load balancer", "type": "string" }, { "name": "name", "description": "the name of the load balancer", "type": "string" }, { "name": "domain", "description": "the domain of the load balancer rule", "type": "string" }, { "name": "id", "description": "the load balancer rule ID", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "publicipid", "description": "the public ip address id", "type": "string" }, { "name": "account", "description": "the account of the load balancer rule", "type": "string" }, { "name": "publicport", "description": "the public port", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with load balancer", "type": "list", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "networkid", "description": "the id of the guest network the lb rule belongs to", "type": "string" } ] }, { "name": "name", "description": "name of the global load balancer rule", "type": "string" }, { "name": "account", "description": "the account of the load balancer rule", "type": "string" }, { "name": "projectid", "description": "the project id of the load balancer", "type": "string" }, { "name": "gslbstickysessionmethodname", "description": "session persistence method used for the global load balancer", "type": "string" }, { "name": "domainid", "description": "the domain ID of the load balancer rule", "type": "string" }, { "name": "description", "description": "the description of the global load balancer rule", "type": "string" }, { }, { "name": "gslbdomainname", "description": "DNS domain name given for the global load balancer", "type": "string" }, { "name": "gslbservicetype", "description": "GSLB service type", "type": "string" }, { }, { "name": "domain", "description": "the domain of the load balancer rule", "type": "string" }, { "name": "regionid", "description": "Region Id in which global load balancer is created", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "gslblbmethod", "description": "Load balancing method used for the global load balancer", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteDiskOffering", "description": "Updates a disk offering.", "isasync": false, "params": [ { "name": "id", "description": "ID of the disk offering", "type": "uuid", "length": 255, "required": true, "related": "createDiskOffering,listDiskOfferings" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "releaseDedicatedCluster", "description": "Release the dedication for cluster", "isasync": true, "params": [ { "name": "clusterid", "description": "the ID of the Cluster", "type": "uuid", "length": 255, "required": true, "related": "addCluster,updateCluster" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listTags", "description": "List resource tag(s)", "since": "4.0.0", "isasync": false, "related": "", "params": [ { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "resourcetype", "description": "list by resource type", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "value", "description": "list by value", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "key", "description": "list by key", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "customer", "description": "list by customer name", "type": "string", "length": 255, "required": false }, { "name": "resourceid", "description": "list by resource id", "type": "string", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { }, { }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "createVirtualRouterElement", "description": "Create a virtual router element.", "isasync": true, "related": "configureVirtualRouterElement,listVirtualRouterElements", "params": [ { "name": "providertype", "description": "The provider type. Supported types are VirtualRouter (default) and VPCVirtualRouter", "type": "uuid", "length": 255, "required": false, "related": "listNetworkServiceProviders" }, { "name": "nspid", "description": "the network service provider ID of the virtual router element", "type": "uuid", "length": 255, "required": true, "related": "listNetworkServiceProviders" } ], "response": [ { "name": "domainid", "description": "the domain ID associated with the provider", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "enabled", "description": "Enabled/Disabled the service provider", "type": "boolean" }, { }, { "name": "account", "description": "the account associated with the provider", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "domain", "description": "the domain associated with the provider", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "nspid", "description": "the physical network service provider id of the provider", "type": "string" } ] }, { "name": "createVPC", "description": "Creates a VPC", "isasync": true, "related": "migrateVPC,listVPCs,listVPCs,restartVPC,createVPC,updateVPC", "params": [ { "name": "account", "description": "the account associated with the VPC. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "start", "description": "If set to false, the VPC won't start (VPC VR will not get allocated) until its first network gets implemented. True by default.", "type": "boolean", "length": 255, "required": false, "since": "4.3" }, { "name": "domainid", "description": "the domain ID associated with the VPC. If used with the account parameter returns the VPC associated with the account for the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "networkdomain", "description": "VPC network domain. All networks inside the VPC will belong to this domain", "type": "string", "length": 255, "required": false }, { "name": "cidr", "description": "the cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR", "type": "string", "length": 255, "required": true }, { "name": "name", "description": "the name of the VPC", "type": "string", "length": 255, "required": true }, { "name": "projectid", "description": "create VPC for the project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "fordisplay", "description": "an optional field, whether to the display the vpc to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "vpcofferingid", "description": "the ID of the VPC offering", "type": "uuid", "length": 255, "required": true, "related": "updateVPCOffering" }, { "name": "zoneid", "description": "the ID of the availability zone", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "displaytext", "description": "the display text of the VPC", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" } ] }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "name", "description": "the capability name", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" } ] }, { "name": "redundantvpcrouter", "description": "if this VPC has redundant router", "type": "boolean" }, { "name": "fordisplay", "description": "is vpc for display to the regular user", "type": "boolean" }, { "name": "zonename", "description": "the name of the zone the VPC belongs to", "type": "string" }, { "name": "state", "description": "state of the VPC. Can be Inactive/Enabled", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the id of the VPC", "type": "string" }, { "name": "created", "description": "the date this VPC was created", "type": "date" }, { "name": "restartrequired", "description": "true VPC requires restart", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "project", "description": "the project name of the VPC", "type": "string" }, { "name": "domainid", "description": "the domain id of the VPC owner", "type": "string" }, { "name": "cidr", "description": "the cidr the VPC", "type": "string" }, { "name": "network", "description": "the list of networks belongign to the VPC", "type": "list", "response": [ { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "servicelist", "description": "services for this provider", "type": "list" } ] } ] }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" } ] }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "vpcofferingid", "description": "vpc offering id the VPC is created from", "type": "string" }, { "name": "displaytext", "description": "an alternate display text of the VPC.", "type": "string" }, { "name": "zoneid", "description": "zone id of the vpc", "type": "string" }, { "name": "distributedvpcrouter", "description": "is VPC uses distributed router for one hop forwarding and host based network ACL's", "type": "boolean" }, { "name": "name", "description": "the name of the VPC", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the project", "type": "list", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "regionlevelvpc", "description": "true if VPC is region level", "type": "boolean" }, { }, { "name": "account", "description": "the owner of the VPC", "type": "string" }, { "name": "networkdomain", "description": "the network domain of the VPC", "type": "string" }, { "name": "projectid", "description": "the project id of the VPC", "type": "string" } ] }, { "name": "deleteAutoScalePolicy", "description": "Deletes a autoscale policy.", "isasync": true, "params": [ { "name": "id", "description": "the ID of the autoscale policy", "type": "uuid", "length": 255, "required": true, "related": "updateAutoScalePolicy,listAutoScalePolicies" } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "deleteRole", "description": "Deletes a role", "since": "4.9.0", "isasync": false, "params": [ { "name": "id", "description": "ID of the role", "type": "uuid", "length": 255, "required": true, "related": "updateRole,createRole,listRoles" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listInternalLoadBalancerVMs", "description": "List internal LB VMs.", "isasync": false, "related": "listRouters,destroyRouter", "params": [ { "name": "podid", "description": "the Pod ID of the Internal LB VM", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "networkid", "description": "list by network id", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "hostid", "description": "the host ID of the Internal LB VM", "type": "uuid", "length": 255, "required": false, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "vpcid", "description": "List Internal LB VMs by VPC", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,listVPCs,restartVPC,createVPC,updateVPC" }, { "name": "state", "description": "the state of the Internal LB VM", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the ID of the Internal LB VM", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "name", "description": "the name of the Internal LB VM", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID of the Internal LB VM", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "forvpc", "description": "if true is passed for this parameter, list only VPC Internal LB VMs", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "dns1", "description": "the first DNS for the router", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the router", "type": "string" }, { "name": "publicip", "description": "the public IP address for the router", "type": "string" }, { "name": "guestipaddress", "description": "the guest IP address for the router", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "redundantstate", "description": "the state of redundant virtual router", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "domain", "description": "the domain associated with the router", "type": "string" }, { "name": "requiresupgrade", "description": "true if the router template requires upgrader", "type": "boolean" }, { "name": "networkdomain", "description": "the network domain for the router", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the router", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the router", "type": "string" }, { "name": "state", "description": "the state of the router", "type": "state" }, { }, { "name": "vpcname", "description": "the name of VPC the router belongs to", "type": "string" }, { "name": "linklocalnetworkid", "description": "the ID of the corresponding link local network", "type": "string" }, { "name": "dns2", "description": "the second DNS for the router", "type": "string" }, { "name": "guestnetworkid", "description": "the ID of the corresponding guest network", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the router", "type": "string" }, { "name": "domainid", "description": "the domain ID associated with the router", "type": "string" }, { "name": "isredundantrouter", "description": "if this router is an redundant virtual router", "type": "boolean" }, { "name": "nic", "description": "the list of nics associated with the router", "type": "set", "response": [ { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" } ] }, { "name": "scriptsversion", "description": "the version of scripts", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "name", "description": "the name of the router", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "hostid", "description": "the host ID for the router", "type": "string" }, { "name": "account", "description": "the account associated with the router", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the router", "type": "string" }, { "name": "guestnetworkname", "description": "the name of the corresponding guest network", "type": "string" }, { "name": "gateway", "description": "the gateway for the router", "type": "string" }, { "name": "zonename", "description": "the Zone name for the router", "type": "string" }, { "name": "vpcid", "description": "VPC the router belongs to", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the router", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the router", "type": "string" }, { "name": "guestnetmask", "description": "the guest netmask for the router", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "templateid", "description": "the template ID for the router", "type": "string" }, { "name": "podid", "description": "the Pod ID for the router", "type": "string" }, { "name": "version", "description": "the version of template", "type": "string" }, { "name": "guestmacaddress", "description": "the guest MAC address for the router", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the router", "type": "string" }, { "name": "hostname", "description": "the hostname for the router", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "role", "description": "role of the domain router", "type": "string" }, { "name": "publicnetworkid", "description": "the ID of the corresponding public network", "type": "string" }, { "name": "created", "description": "the date and time the router was created", "type": "date" } ] }, { "name": "removeResourceDetail", "description": "Removes detail for the Resource.", "isasync": true, "params": [ { "name": "resourceid", "description": "Delete details for resource id", "type": "string", "length": 255, "required": true }, { "name": "key", "description": "Delete details matching key/value pairs", "type": "string", "length": 255, "required": false }, { "name": "resourcetype", "description": "Delete detail by resource type", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { } ] }, { "name": "listOsTypes", "description": "Lists all supported OS types for this cloud.", "isasync": false, "related": "addGuestOs", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "list by Os type Id", "type": "uuid", "length": 255, "required": false, "related": "addGuestOs,listOsTypes" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "description", "description": "list os by description", "type": "string", "length": 255, "required": false, "since": "3.0.1" }, { "name": "oscategoryid", "description": "list by Os Category id", "type": "uuid", "length": 255, "required": false, "related": "listOsCategories" } ], "response": [ { "name": "isuserdefined", "description": "is the guest OS user defined", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "oscategoryid", "description": "the ID of the OS category", "type": "string" }, { }, { "name": "description", "description": "the name/description of the OS type", "type": "string" }, { "name": "id", "description": "the ID of the OS type", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "revokeSecurityGroupEgress", "description": "Deletes a particular egress rule from this security group", "since": "3.0.0", "isasync": true, "params": [ { "name": "id", "description": "The ID of the egress rule", "type": "uuid", "length": 255, "required": true, "related": "authorizeSecurityGroupIngress" } ], "response": [ { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "removeGuestOs", "description": "Removes a Guest OS from listing.", "since": "4.4.0", "isasync": true, "params": [ { "name": "id", "description": "ID of the guest OS", "type": "uuid", "length": 255, "required": true, "related": "addGuestOs" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "detachIso", "description": "Detaches any ISO file (if any) currently attached to a virtual machine.", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "virtualmachineid", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,detachIso,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" } ] }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" } ] }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" } ] }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" } ] }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" } ] }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" } ] }, { "name": "deletePaloAltoFirewall", "description": " delete a Palo Alto firewall device", "isasync": true, "params": [ { "name": "fwdeviceid", "description": "Palo Alto firewall device ID", "type": "uuid", "length": 255, "required": true, "related": "listPaloAltoFirewalls,configurePaloAltoFirewall,addPaloAltoFirewall" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "deletePod", "description": "Deletes a Pod.", "isasync": false, "params": [ { "name": "id", "description": "the ID of the Pod", "type": "uuid", "length": 255, "required": true, "related": "createManagementNetworkIpRange,updatePod" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "listDeploymentPlanners", "description": "Lists all DeploymentPlanners available.", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "name", "description": "Deployment Planner name", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "prepareHostForMaintenance", "description": "Prepares a host for maintenance.", "isasync": true, "related": "cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost", "params": [ { "name": "id", "description": "the host ID", "type": "uuid", "length": 255, "required": true, "related": "prepareHostForMaintenance,cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" } ], "response": [ { "name": "podname", "description": "the Pod name of the host", "type": "string" }, { "name": "islocalstorageactive", "description": "true if local storage is active, false otherwise", "type": "boolean" }, { }, { "name": "cpuwithoverprovisioning", "description": "the amount of the host's CPU after applying the cpu.overprovisioning.factor ", "type": "string" }, { "name": "hosttags", "description": "comma-separated list of tags for the host", "type": "string" }, { "name": "outofbandmanagement", "description": "the host out-of-band management information", "type": "outofbandmanagementresponse" }, { "name": "cpuused", "description": "the amount of the host's CPU currently used", "type": "string" }, { "name": "averageload", "description": "the cpu average load on the host", "type": "long" }, { "name": "type", "description": "the host type", "type": "type" }, { "name": "capabilities", "description": "capabilities of the host", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "resourcestate", "description": "the resource state of the host", "type": "string" }, { "name": "oscategoryid", "description": "the OS category ID of the host", "type": "string" }, { "name": "hahost", "description": "true if the host is Ha host (dedicated to vms started by HA process; false otherwise", "type": "boolean" }, { "name": "hypervisor", "description": "the host hypervisor", "type": "hypervisortype" }, { "name": "hostha", "description": "the host HA information information", "type": "hostharesponse" }, { "name": "clustertype", "description": "the cluster type of the cluster that host belongs to", "type": "string" }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "cpuspeed", "description": "the CPU speed of the host", "type": "long" }, { "name": "name", "description": "the name of the host", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the host", "type": "string" }, { "name": "podid", "description": "the Pod ID of the host", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "oscategoryname", "description": "the OS category name of the host", "type": "string" }, { "name": "disksizetotal", "description": "the total disk size of the host", "type": "long" }, { "name": "id", "description": "the ID of the host", "type": "string" }, { "name": "zonename", "description": "the Zone name of the host", "type": "string" }, { "name": "memorytotal", "description": "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning", "type": "long" }, { }, { "name": "hasenoughcapacity", "description": "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise", "type": "boolean" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "managementserverid", "description": "the management server ID of the host", "type": "long" }, { "name": "memoryused", "description": "the amount of the host's memory currently used", "type": "long" }, { "name": "memoryallocated", "description": "the amount of the host's memory currently allocated", "type": "long" }, { "name": "annotation", "description": "the last annotation set on this host by an admin", "type": "string" }, { "name": "cpuallocated", "description": "the amount of the host's CPU currently allocated", "type": "string" }, { "name": "username", "description": "the admin that annotated this host", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the host", "type": "long" }, { "name": "suitableformigration", "description": "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise", "type": "boolean" }, { "name": "cpunumber", "description": "the CPU number of the host", "type": "integer" }, { "name": "ipaddress", "description": "the IP address of the host", "type": "string" }, { "name": "memorywithoverprovisioning", "description": "the amount of the host's memory after applying the mem.overprovisioning.factor", "type": "string" }, { "name": "lastpinged", "description": "the date and time the host was last pinged", "type": "date" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "events", "description": "events available for the host", "type": "string" }, { "name": "clustername", "description": "the cluster name of the host", "type": "string" }, { "name": "gpugroup", "description": "GPU cards present in the host", "type": "list", "response": [ { "name": "gpugroupname", "description": "GPU cards present in the host", "type": "string" }, { "name": "vgpu", "description": "the list of enabled vGPUs", "type": "list", "response": [ { "name": "maxresolutiony", "description": "Maximum Y resolution per display", "type": "long" }, { "name": "maxheads", "description": "Maximum displays per user", "type": "long" }, { "name": "remainingcapacity", "description": "Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type", "type": "long" }, { "name": "maxcapacity", "description": "Maximum vgpu can be created with this vgpu type on the given gpu group", "type": "long" }, { "name": "maxresolutionx", "description": "Maximum X resolution per display", "type": "long" }, { "name": "videoram", "description": "Video RAM for this vGPU type", "type": "long" }, { "name": "maxvgpuperpgpu", "description": "Maximum no. of vgpu per gpu card (pgpu)", "type": "long" }, { "name": "vgputype", "description": "Model Name of vGPU", "type": "string" } ] } ] }, { "name": "state", "description": "the state of the host", "type": "status" }, { "name": "version", "description": "the host version", "type": "string" }, { "name": "cpusockets", "description": "the number of CPU sockets on the host", "type": "integer" }, { "name": "details", "description": "Host details in key/value pairs.", "type": "map" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "lastannotated", "description": "the last time this host was annotated", "type": "date" }, { "name": "clusterid", "description": "the cluster ID of the host", "type": "string" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "disconnected", "description": "true if the host is disconnected. False otherwise.", "type": "date" } ] }, { "name": "deleteCluster", "description": "Deletes a cluster.", "isasync": false, "params": [ { "name": "id", "description": "the cluster ID", "type": "uuid", "length": 255, "required": true, "related": "addCluster,updateCluster" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "createRole", "description": "Creates a role", "since": "4.9.0", "isasync": false, "related": "updateRole,listRoles", "params": [ { "name": "description", "description": "The description of the role", "type": "string", "length": 255, "required": false }, { "name": "type", "description": "The type of the role, valid options are: Admin, ResourceAdmin, DomainAdmin, User", "type": "string", "length": 255, "required": true }, { "name": "name", "description": "creates a role with this unique name", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "name", "description": "the name of the role", "type": "string" }, { "name": "id", "description": "the ID of the role", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "description", "description": "the description of the role", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "type", "description": "the type of the role", "type": "string" }, { } ] }, { "name": "getVolumeiScsiName", "description": "Get Volume's iSCSI Name", "isasync": false, "related": "", "params": [ { "name": "volumeid", "description": "CloudStack Volume UUID", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "volumeiScsiName", "description": "Volume iSCSI Name", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "removeRegion", "description": "Removes specified region", "isasync": false, "params": [ { "name": "id", "description": "ID of the region to delete", "type": "integer", "length": 255, "required": true } ], "response": [ { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "getUploadParamsForVolume", "description": "Upload a data disk to the cloudstack cloud.", "since": "4.6.0", "isasync": false, "related": "getUploadParamsForTemplate", "params": [ { "name": "domainid", "description": "an optional domainId. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "account", "description": "an optional accountName. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "the name of the volume/template", "type": "string", "length": 255, "required": true }, { "name": "zoneid", "description": "the ID of the zone the volume/template is to be hosted on", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "format", "description": "the format for the volume/template. Possible values include QCOW2, OVA, and VHD.", "type": "string", "length": 255, "required": true }, { "name": "diskofferingid", "description": "the ID of the disk offering. This must be a custom sized offering since during upload of volume/template size is unknown.", "type": "uuid", "length": 255, "required": false, "related": "createDiskOffering,listDiskOfferings" }, { "name": "imagestoreuuid", "description": "Image store uuid", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "Upload volume/template for the project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "checksum", "description": "the checksum value of this volume/template The parameter containing the checksum will be considered a MD5sum if it is not prefixed\n and just a plain ascii/utf8 representation of a hexadecimal string. If it is required to\n use another algorithm the hexadecimal string is to be prefixed with a string of the form,\n \"{}\", not including the double quotes. In this is the exact string\n representing the java supported algorithm, i.e. MD5 or SHA-256. Note that java does not\n contain an algorithm called SHA256 or one called sha-256, only SHA-256.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "metadata", "description": "encrypted data to be sent in the POST request.", "type": "string" }, { "name": "id", "description": "the template/volume ID", "type": "uuid" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "postURL", "description": "POST url to upload the file to", "type": "url" }, { }, { "name": "expires", "description": "the timestamp after which the signature expires", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "signature", "description": "signature to be sent in the POST request.", "type": "string" } ] }, { "name": "updateAutoScaleVmProfile", "description": "Updates an existing autoscale vm profile.", "isasync": true, "related": "listAutoScaleVmProfiles,createAutoScaleVmProfile", "params": [ { "name": "fordisplay", "description": "an optional field, whether to the display the profile to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "the ID of the autoscale vm profile", "type": "uuid", "length": 255, "required": true, "related": "updateAutoScaleVmProfile,listAutoScaleVmProfiles,createAutoScaleVmProfile" }, { "name": "counterparam", "description": "counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161", "type": "map", "length": 255, "required": false }, { "name": "destroyvmgraceperiod", "description": "the time allowed for existing connections to get closed before a vm is destroyed", "type": "integer", "length": 255, "required": false }, { "name": "templateid", "description": "the template of the auto deployed virtual machine", "type": "uuid", "length": 255, "required": false, "related": "listIsos,registerTemplate,registerIso,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "autoscaleuserid", "description": "the ID of the user used to launch and destroy the VMs", "type": "uuid", "length": 255, "required": false, "related": "updateUser,lockUser,getUser,enableUser,listUsers,createUser,disableUser" } ], "response": [ { "name": "destroyvmgraceperiod", "description": "the time allowed for existing connections to get closed before a vm is destroyed", "type": "integer" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "autoscaleuserid", "description": "the ID of the user used to launch and destroy the VMs", "type": "string" }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { "name": "otherdeployparams", "description": "parameters other than zoneId/serviceOfferringId/templateId to be used while deploying a virtual machine", "type": "string" }, { "name": "templateid", "description": "the template to be used while deploying a virtual machine", "type": "string" }, { "name": "domain", "description": "the domain name of the vm profile", "type": "string" }, { "name": "fordisplay", "description": "is profile for display to the regular user", "type": "boolean" }, { "name": "projectid", "description": "the project id vm profile", "type": "string" }, { "name": "serviceofferingid", "description": "the service offering to be used while deploying a virtual machine", "type": "string" }, { }, { "name": "project", "description": "the project name of the vm profile", "type": "string" }, { "name": "zoneid", "description": "the availability zone to be used while deploying a virtual machine", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the domain ID of the vm profile", "type": "string" }, { }, { }, { "name": "id", "description": "the autoscale vm profile ID", "type": "string" } ] }, { "name": "updateAutoScaleVmGroup", "description": "Updates an existing autoscale vm group.", "isasync": true, "related": "enableAutoScaleVmGroup,listAutoScaleVmGroups", "params": [ { "name": "id", "description": "the ID of the autoscale group", "type": "uuid", "length": 255, "required": true, "related": "enableAutoScaleVmGroup,listAutoScaleVmGroups,updateAutoScaleVmGroup" }, { "name": "interval", "description": "the frequency at which the conditions have to be evaluated", "type": "integer", "length": 255, "required": false }, { "name": "maxmembers", "description": "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.", "type": "integer", "length": 255, "required": false }, { "name": "scaledownpolicyids", "description": "list of scaledown autoscale policies", "type": "list", "length": 255, "required": false, "related": "updateAutoScalePolicy,listAutoScalePolicies" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "fordisplay", "description": "an optional field, whether to the display the group to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "minmembers", "description": "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.", "type": "integer", "length": 255, "required": false }, { "name": "scaleuppolicyids", "description": "list of scaleup autoscale policies", "type": "list", "length": 255, "required": false, "related": "updateAutoScalePolicy,listAutoScalePolicies" } ], "response": [ { "name": "state", "description": "the current state of the AutoScale Vm Group", "type": "string" }, { "name": "lbruleid", "description": "the load balancer rule ID", "type": "string" }, { "name": "scaleuppolicies", "description": "list of scaleup autoscale policies", "type": "list" }, { }, { "name": "vmprofileid", "description": "the autoscale profile that contains information about the vms in the vm group.", "type": "string" }, { "name": "domainid", "description": "the domain ID of the vm profile", "type": "string" }, { "name": "scaledownpolicies", "description": "list of scaledown autoscale policies", "type": "list" }, { "name": "project", "description": "the project name of the vm profile", "type": "string" }, { "name": "interval", "description": "the frequency at which the conditions have to be evaluated", "type": "int" }, { "name": "maxmembers", "description": "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.", "type": "int" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domain", "description": "the domain name of the vm profile", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { "name": "id", "description": "the autoscale vm group ID", "type": "string" }, { "name": "minmembers", "description": "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.", "type": "int" }, { }, { "name": "fordisplay", "description": "is group for display to the regular user", "type": "boolean" }, { "name": "projectid", "description": "the project id vm profile", "type": "string" } ] }, { "name": "enableAutoScaleVmGroup", "description": "Enables an AutoScale Vm Group", "isasync": true, "related": "listAutoScaleVmGroups", "params": [ { "name": "id", "description": "the ID of the autoscale group", "type": "uuid", "length": 255, "required": true, "related": "enableAutoScaleVmGroup,listAutoScaleVmGroups" } ], "response": [ { "name": "interval", "description": "the frequency at which the conditions have to be evaluated", "type": "int" }, { "name": "id", "description": "the autoscale vm group ID", "type": "string" }, { "name": "lbruleid", "description": "the load balancer rule ID", "type": "string" }, { "name": "scaleuppolicies", "description": "list of scaleup autoscale policies", "type": "list" }, { "name": "domain", "description": "the domain name of the vm profile", "type": "string" }, { }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { "name": "scaledownpolicies", "description": "list of scaledown autoscale policies", "type": "list" }, { "name": "vmprofileid", "description": "the autoscale profile that contains information about the vms in the vm group.", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "minmembers", "description": "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.", "type": "int" }, { "name": "maxmembers", "description": "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.", "type": "int" }, { "name": "domainid", "description": "the domain ID of the vm profile", "type": "string" }, { "name": "fordisplay", "description": "is group for display to the regular user", "type": "boolean" }, { "name": "projectid", "description": "the project id vm profile", "type": "string" }, { "name": "project", "description": "the project name of the vm profile", "type": "string" }, { "name": "state", "description": "the current state of the AutoScale Vm Group", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "deleteSnapshot", "description": "Deletes a snapshot of a disk volume.", "isasync": true, "params": [ { "name": "id", "description": "The ID of the snapshot", "type": "uuid", "length": 255, "required": true, "related": "revertSnapshot" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listVirtualMachines", "description": "List the virtual machines owned by the account.", "isasync": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "isoid", "description": "list vms by iso", "type": "uuid", "length": 255, "required": false }, { "name": "hypervisor", "description": "the target hypervisor for the template", "type": "string", "length": 255, "required": false }, { "name": "affinitygroupid", "description": "list vms by affinity group", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "networkid", "description": "list by network id", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "userid", "description": "the user ID that created the VM and is under the account that owns the VM", "type": "uuid", "length": 255, "required": false, "related": "updateUser,lockUser,getUser,enableUser,listUsers,createUser,disableUser" }, { "name": "templateid", "description": "list vms by template", "type": "uuid", "length": 255, "required": false, "related": "listIsos,registerTemplate,registerIso,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "serviceofferingid", "description": "list by the service offering", "type": "uuid", "length": 255, "required": false, "since": "4.4", "related": "listServiceOfferings,updateServiceOffering" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "hostid", "description": "the host ID", "type": "uuid", "length": 255, "required": false, "related": "cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the availability zone ID", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "displayvm", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "vpcid", "description": "list vms by vpc", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,listVPCs,restartVPC,createVPC,updateVPC" }, { "name": "id", "description": "the ID of the virtual machine", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "groupid", "description": "the group ID", "type": "uuid", "length": 255, "required": false, "related": "createInstanceGroup" }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "keypair", "description": "list vms by ssh keypair name", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "storageid", "description": "the storage ID where vm's volumes belong to", "type": "uuid", "length": 255, "required": false, "related": "findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "forvirtualnetwork", "description": "list by network type; true if need to list vms using Virtual Network, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "state", "description": "state of the virtual machine. Possible values are: Running, Stopped, Present, Destroyed, Expunged. Present is used for the state equal not destroyed.", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "name of the virtual machine (a substring match is made against the parameter value, data for all matching VMs will be returned)", "type": "string", "length": 255, "required": false }, { "name": "details", "description": "comma separated list of host details requested, value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, diskoff, iso, volume, min, affgrp]. If no parameter is passed in, the details will be defaulted to all", "type": "list", "length": 255, "required": false }, { "name": "ids", "description": "the IDs of the virtual machines, mutually exclusive with id", "type": "list", "length": 255, "required": false, "since": "4.4", "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,listVirtualMachines,destroyVirtualMachine,attachIso,revertToVMSnapshot,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "podid", "description": "the pod ID", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" } ], "response": [ { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" } ] }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" } ] }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" } ] }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" } ] }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" } ] }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" } ] }, { "name": "updateGuestOsMapping", "description": "Updates the information about Guest OS to Hypervisor specific name mapping", "since": "4.4.0", "isasync": true, "related": "", "params": [ { "name": "osnameforhypervisor", "description": "Hypervisor specific name for this Guest OS", "type": "string", "length": 255, "required": true }, { "name": "id", "description": "UUID of the Guest OS to hypervisor name Mapping", "type": "uuid", "length": 255, "required": true, "related": "updateGuestOsMapping" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the Guest OS mapping", "type": "string" }, { }, { "name": "hypervisor", "description": "the hypervisor", "type": "string" }, { "name": "ostypeid", "description": "the ID of the Guest OS type", "type": "string" }, { "name": "hypervisorversion", "description": "version of the hypervisor for mapping", "type": "string" }, { "name": "osnameforhypervisor", "description": "hypervisor specific name for the Guest OS", "type": "string" }, { "name": "isuserdefined", "description": "is the mapping user defined", "type": "string" }, { "name": "osdisplayname", "description": "standard display name for the Guest OS", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "listDiskOfferings", "description": "Lists all available disk offerings.", "isasync": false, "related": "createDiskOffering", "params": [ { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "ID of the disk offering", "type": "uuid", "length": 255, "required": false, "related": "createDiskOffering,listDiskOfferings" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "name of the disk offering", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "maxiops", "description": "the max iops of the disk offering", "type": "long" }, { "name": "cacheMode", "description": "the cache mode to use for this disk offering. none, writeback or writethrough", "type": "string" }, { "name": "displaytext", "description": "an alternate display text of the disk offering.", "type": "string" }, { "name": "diskIopsWriteRateMax", "description": "burst io requests write rate of the disk offering", "type": "long" }, { "name": "domainid", "description": "the domain ID this disk offering belongs to. Ignore this information as it is not currently applicable.", "type": "string" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk offering", "type": "long" }, { "name": "disksize", "description": "the size of the disk offering in GB", "type": "long" }, { "name": "diskIopsWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk offering", "type": "long" }, { "name": "domain", "description": "the domain name this disk offering belongs to. Ignore this information as it is not currently applicable.", "type": "string" }, { }, { "name": "miniops", "description": "the min iops of the disk offering", "type": "long" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes. Valid values are thin, sparse, fat.", "type": "string" }, { "name": "iscustomized", "description": "true if disk offering uses custom size, false otherwise", "type": "boolean" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk offering", "type": "long" }, { "name": "iscustomizediops", "description": "true if disk offering uses custom iops, false otherwise", "type": "boolean" }, { }, { "name": "tags", "description": "the tags for the disk offering", "type": "string" }, { "name": "created", "description": "the date this disk offering was created", "type": "date" }, { "name": "storagetype", "description": "the storage type for this disk offering", "type": "string" }, { "name": "diskBytesReadRateMax", "description": "burst bytes read rate of the disk offering", "type": "long" }, { "name": "diskBytesWriteRateMax", "description": "burst bytes write rate of the disk offering", "type": "long" }, { "name": "displayoffering", "description": "whether to display the offering to the end user or not.", "type": "boolean" }, { "name": "diskIopsReadRateMax", "description": "burst io requests read rate of the disk offering", "type": "long" }, { "name": "name", "description": "the name of the disk offering", "type": "string" }, { "name": "diskBytesWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hypervisorsnapshotreserve", "description": "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", "type": "integer" }, { "name": "id", "description": "unique ID of the disk offering", "type": "string" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk offering", "type": "long" }, { "name": "diskIopsReadRateMaxLength", "description": "length (in second) of the burst", "type": "long" }, { "name": "diskBytesReadRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" } ] }, { "name": "updateHostPassword", "description": "Update password of a host/pool on management server.", "isasync": false, "params": [ { "name": "password", "description": "the new password for the host/cluster", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "the username for the host/cluster", "type": "string", "length": 255, "required": true }, { "name": "clusterid", "description": "the cluster ID", "type": "uuid", "length": 255, "required": false, "related": "addCluster,updateCluster" }, { "name": "update_passwd_on_host", "description": "if the password should also be updated on the hosts", "type": "boolean", "length": 255, "required": false }, { "name": "hostid", "description": "the host ID", "type": "uuid", "length": 255, "required": false, "related": "cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "createPortableIpRange", "description": "adds a range of portable public IP's to a region", "since": "4.2.0", "isasync": true, "related": "", "params": [ { "name": "startip", "description": "the beginning IP address in the portable IP range", "type": "string", "length": 255, "required": true }, { "name": "gateway", "description": "the gateway for the portable IP range", "type": "string", "length": 255, "required": true }, { "name": "vlan", "description": "VLAN id, if not specified defaulted to untagged", "type": "string", "length": 255, "required": false }, { "name": "endip", "description": "the ending IP address in the portable IP range", "type": "string", "length": 255, "required": true }, { "name": "regionid", "description": "Id of the Region", "type": "integer", "length": 255, "required": true, "related": "addRegion,listRegions" }, { "name": "netmask", "description": "the netmask of the portable IP range", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "endip", "description": "the end ip of the portable IP range", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "portableipaddress", "description": "List of portable IP and association with zone/network/vpc details that are part of GSLB rule", "type": "list", "response": [ { "name": "networkid", "description": "the ID of the Network where ip belongs to", "type": "string" }, { "name": "domainid", "description": "the domain ID the portable IP address is associated with", "type": "string" }, { "name": "ipaddress", "description": "public IP address", "type": "string" }, { "name": "accountid", "description": "the account ID the portable IP address is associated with", "type": "string" }, { "name": "vpcid", "description": "VPC the ip belongs to", "type": "string" }, { "name": "zoneid", "description": "the ID of the zone the public IP address belongs to", "type": "string" }, { "name": "regionid", "description": "Region Id in which global load balancer is created", "type": "integer" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "allocated", "description": "date the portal IP address was acquired", "type": "date" }, { "name": "state", "description": "State of the ip address. Can be: Allocatin, Allocated and Releasing", "type": "string" } ] }, { }, { "name": "gateway", "description": "the gateway of the VLAN IP range", "type": "string" }, { "name": "regionid", "description": "Region Id in which portable ip range is provisioned", "type": "integer" }, { "name": "netmask", "description": "the netmask of the VLAN IP range", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "startip", "description": "the start ip of the portable IP range", "type": "string" }, { "name": "id", "description": "portable IP range ID", "type": "string" }, { "name": "vlan", "description": "the ID or VID of the VLAN.", "type": "string" } ] }, { "name": "updateCluster", "description": "Updates an existing cluster", "isasync": false, "related": "addCluster", "params": [ { "name": "managedstate", "description": "whether this cluster is managed by cloudstack", "type": "string", "length": 255, "required": false }, { "name": "clustername", "description": "the cluster name", "type": "string", "length": 255, "required": false }, { "name": "allocationstate", "description": "Allocation state of this cluster for allocation of new resources", "type": "string", "length": 255, "required": false }, { "name": "clustertype", "description": "hypervisor type of the cluster", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the ID of the Cluster", "type": "uuid", "length": 255, "required": true, "related": "addCluster,updateCluster" }, { "name": "hypervisor", "description": "hypervisor type of the cluster", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "capacity", "description": "the capacity of the Cluster", "type": "list", "response": [ { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "name", "description": "the capacity name", "type": "string" } ] }, { "name": "memoryovercommitratio", "description": "The memory overcommit ratio of the cluster", "type": "string" }, { "name": "allocationstate", "description": "the allocation state of the cluster", "type": "string" }, { "name": "id", "description": "the cluster ID", "type": "string" }, { "name": "podid", "description": "the Pod ID of the cluster", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "ovm3vip", "description": "Ovm3 VIP to use for pooling and/or clustering", "type": "string" }, { "name": "hypervisortype", "description": "the hypervisor type of the cluster", "type": "string" }, { "name": "cpuovercommitratio", "description": "The cpu overcommit ratio of the cluster", "type": "string" }, { "name": "managedstate", "description": "whether this cluster is managed by cloudstack", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the cluster", "type": "string" }, { }, { "name": "zonename", "description": "the Zone name of the cluster", "type": "string" }, { "name": "podname", "description": "the Pod name of the cluster", "type": "string" }, { "name": "name", "description": "the cluster name", "type": "string" }, { }, { "name": "clustertype", "description": "the type of the cluster", "type": "string" }, { "name": "resourcedetails", "description": "Meta data associated with the zone (key/value pairs)", "type": "map" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listStorageProviders", "description": "Lists storage providers.", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "type", "description": "the type of storage provider: either primary or image", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "name", "description": "the name of the storage provider", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "type", "description": "the type of the storage provider: primary or image provider", "type": "string" } ] }, { "name": "listUcsProfiles", "description": "List profile in ucs manager", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "ucsmanagerid", "description": "the id for the ucs manager", "type": "uuid", "length": 255, "required": true, "related": "addUcsManager" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "ucsdn", "description": "ucs profile dn", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "getUserKeys", "description": "This command allows the user to query the seceret and API keys for the account", "since": "4.10.0", "isasync": false, "related": "registerUserKeys", "params": [ { "name": "id", "description": "ID of the user whose keys are required", "type": "uuid", "length": 255, "required": true, "related": "updateUser,lockUser,getUser,enableUser,listUsers,createUser,disableUser" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "secretkey", "description": "the secret key of the registered user", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "apikey", "description": "the api key of the registered user", "type": "string" }, { } ] }, { "name": "updateGlobalLoadBalancerRule", "description": "update global load balancer rules.", "isasync": true, "related": "", "params": [ { "name": "id", "description": "the ID of the global load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "updateGlobalLoadBalancerRule" }, { "name": "gslbstickysessionmethodname", "description": "session sticky method (sourceip) if not specified defaults to sourceip", "type": "string", "length": 255, "required": false }, { "name": "description", "description": "the description of the load balancer rule", "type": "string", "length": 4096, "required": false }, { "name": "gslblbmethod", "description": "load balancer algorithm (roundrobin, leastconn, proximity) that is used to distributed traffic across the zones participating in global server load balancing, if not specified defaults to 'round robin'", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "projectid", "description": "the project id of the load balancer", "type": "string" }, { "name": "account", "description": "the account of the load balancer rule", "type": "string" }, { "name": "loadbalancerrule", "description": "List of load balancer rules that are part of GSLB rule", "type": "list", "response": [ { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with load balancer", "type": "list", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "algorithm", "description": "the load balancer algorithm (source, roundrobin, leastconn)", "type": "string" }, { "name": "domainid", "description": "the domain ID of the load balancer rule", "type": "string" }, { "name": "publicipid", "description": "the public ip address id", "type": "string" }, { "name": "networkid", "description": "the id of the guest network the lb rule belongs to", "type": "string" }, { "name": "publicip", "description": "the public ip address", "type": "string" }, { "name": "project", "description": "the project name of the load balancer", "type": "string" }, { "name": "publicport", "description": "the public port", "type": "string" }, { "name": "id", "description": "the load balancer rule ID", "type": "string" }, { "name": "name", "description": "the name of the load balancer", "type": "string" }, { "name": "privateport", "description": "the private port", "type": "string" }, { "name": "zoneid", "description": "the id of the zone the rule belongs to", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "zonename", "description": "the name of the zone the load balancer rule belongs to", "type": "string" }, { "name": "domain", "description": "the domain of the load balancer rule", "type": "string" }, { "name": "account", "description": "the account of the load balancer rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the loadbalanacer rule", "type": "string" }, { "name": "projectid", "description": "the project id of the load balancer", "type": "string" }, { "name": "description", "description": "the description of the load balancer", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" } ] }, { "name": "domainid", "description": "the domain ID of the load balancer rule", "type": "string" }, { "name": "gslbservicetype", "description": "GSLB service type", "type": "string" }, { "name": "project", "description": "the project name of the load balancer", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domain", "description": "the domain of the load balancer rule", "type": "string" }, { "name": "name", "description": "name of the global load balancer rule", "type": "string" }, { }, { "name": "description", "description": "the description of the global load balancer rule", "type": "string" }, { }, { "name": "gslbdomainname", "description": "DNS domain name given for the global load balancer", "type": "string" }, { "name": "gslblbmethod", "description": "Load balancing method used for the global load balancer", "type": "string" }, { "name": "id", "description": "global load balancer rule ID", "type": "string" }, { "name": "gslbstickysessionmethodname", "description": "session persistence method used for the global load balancer", "type": "string" }, { "name": "regionid", "description": "Region Id in which global load balancer is created", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listProjects", "description": "Lists projects and provides detailed information for listed projects", "since": "3.0.0", "isasync": false, "related": "listProjectAccounts,activateProject,updateProject,suspendProject", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "id", "description": "list projects by project ID", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,listProjects,activateProject,updateProject,suspendProject" }, { "name": "tags", "description": "List projects by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "list projects by name", "type": "string", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "state", "description": "list projects by state", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "displaytext", "description": "list projects by display text", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this project", "type": "long" }, { "name": "iplimit", "description": "the total number of public ip addresses this project can acquire", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by project", "type": "long" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this project", "type": "string" }, { "name": "id", "description": "the id of the project", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this project", "type": "integer" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this project", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the project can own", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by project", "type": "long" }, { "name": "networklimit", "description": "the total number of networks the project can own", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the project can own", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this project", "type": "string" }, { "name": "projectaccountname", "description": "the project account name of the project", "type": "string" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this project", "type": "string" }, { "name": "domain", "description": "the domain name where the project belongs to", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by project", "type": "long" }, { "name": "state", "description": "the state of the project", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by project", "type": "long" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this project", "type": "long" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this project to acquire", "type": "string" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this project", "type": "integer" }, { }, { "name": "memorytotal", "description": "the total memory (in MB) owned by project", "type": "long" }, { "name": "volumetotal", "description": "the total volume being used by this project", "type": "long" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this project", "type": "string" }, { "name": "name", "description": "the name of the project", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the project", "type": "string" }, { "name": "volumelimit", "description": "the total volume which can be used by this project", "type": "string" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this project to acquire", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this project", "type": "string" }, { "name": "memorylimit", "description": "the total memory (in MB) the project can own", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this project", "type": "string" }, { "name": "domainid", "description": "the domain id the project belongs to", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the project can own", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by project", "type": "float" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this project", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this project", "type": "string" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this project", "type": "long" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this project", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with vm", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this project", "type": "long" }, { "name": "vpclimit", "description": "the total number of vpcs the project can own", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "account", "description": "the account name of the project's owner", "type": "string" } ] }, { "name": "createCondition", "description": "Creates a condition", "isasync": true, "related": "", "params": [ { "name": "domainid", "description": "the domain ID of the account.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "account", "description": "the account of the condition. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "counterid", "description": "ID of the Counter.", "type": "uuid", "length": 255, "required": true, "related": "listCounters,createCounter" }, { "name": "relationaloperator", "description": "Relational Operator to be used with threshold.", "type": "string", "length": 255, "required": true }, { "name": "threshold", "description": "Threshold value.", "type": "long", "length": 255, "required": true } ], "response": [ { "name": "zoneid", "description": "zone id of counter", "type": "string" }, { "name": "project", "description": "the project name of the Condition", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "projectid", "description": "the project id of the Condition.", "type": "string" }, { "name": "domainid", "description": "the domain id of the Condition owner", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "counter", "description": "Details of the Counter.", "type": "list" }, { "name": "id", "description": "the id of the Condition", "type": "string" }, { }, { "name": "account", "description": "the owner of the Condition.", "type": "string" }, { }, { "name": "domain", "description": "the domain name of the owner.", "type": "string" }, { "name": "threshold", "description": "Threshold Value for the counter.", "type": "long" }, { "name": "relationaloperator", "description": "Relational Operator to be used with threshold.", "type": "string" } ] }, { "name": "createAccount", "description": "Creates an account", "isasync": false, "related": "enableAccount,listAccounts,listAccounts", "params": [ { "name": "domainid", "description": "Creates the user under the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "accountid", "description": "Account UUID, required for adding account from external provisioning system", "type": "string", "length": 255, "required": false }, { "name": "networkdomain", "description": "Network domain for the account's networks", "type": "string", "length": 255, "required": false }, { "name": "email", "description": "email", "type": "string", "length": 255, "required": true }, { "name": "roleid", "description": "Creates the account under the specified role.", "type": "uuid", "length": 255, "required": false, "related": "updateRole,listRoles" }, { "name": "account", "description": "Creates the user under the specified account. If no account is specified, the username will be used as the account name.", "type": "string", "length": 255, "required": false }, { "name": "timezone", "description": "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.", "type": "string", "length": 255, "required": false }, { "name": "username", "description": "Unique username.", "type": "string", "length": 255, "required": true }, { "name": "userid", "description": "User UUID, required for adding account from external provisioning system", "type": "string", "length": 255, "required": false }, { "name": "password", "description": "Clear text password (Default hashed to SHA256SALT). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.", "type": "string", "length": 255, "required": true }, { "name": "lastname", "description": "lastname", "type": "string", "length": 255, "required": true }, { "name": "accountdetails", "description": "details for account used to store specific parameters", "type": "map", "length": 255, "required": false }, { "name": "firstname", "description": "firstname", "type": "string", "length": 255, "required": true }, { "name": "accounttype", "description": "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin", "type": "short", "length": 255, "required": false } ], "response": [ { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the account can own", "type": "string" }, { }, { "name": "volumeavailable", "description": "the total volume available for this account", "type": "string" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by account", "type": "long" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this account", "type": "string" }, { "name": "isdefault", "description": "true if account is default, false otherwise", "type": "boolean" }, { "name": "iscleanuprequired", "description": "true if the account requires cleanup", "type": "boolean" }, { "name": "domain", "description": "name of the Domain the account belongs too", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by account", "type": "float" }, { "name": "receivedbytes", "description": "the total number of network traffic bytes received", "type": "long" }, { "name": "volumelimit", "description": "the total volume which can be used by this account", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this account to acquire", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this account", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "memorylimit", "description": "the total memory (in MB) the account can own", "type": "string" }, { "name": "id", "description": "the id of the account", "type": "string" }, { "name": "groups", "description": "the list of acl groups that account belongs to", "type": "list" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this account", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the account can own", "type": "string" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "accountdetails", "description": "details for the account", "type": "map" }, { }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this account", "type": "long" }, { "name": "vpclimit", "description": "the total number of vpcs the account can own", "type": "string" }, { "name": "defaultzoneid", "description": "the default zone of the account", "type": "string" }, { "name": "roletype", "description": "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by account", "type": "long" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this account", "type": "string" }, { "name": "domainid", "description": "id of the Domain the account belongs too", "type": "string" }, { "name": "user", "description": "the list of users associated with account", "type": "list", "response": [ { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" } ] }, { "name": "cpulimit", "description": "the total number of cpu cores the account can own", "type": "string" }, { "name": "iplimit", "description": "the total number of public ip addresses this account can acquire", "type": "string" }, { "name": "state", "description": "the state of the account", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this account", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this account", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by account", "type": "long" }, { "name": "projectlimit", "description": "the total number of projects the account can own", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by account", "type": "long" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this account", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this account", "type": "integer" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the account can own", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this account", "type": "string" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this account", "type": "long" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this account", "type": "string" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this account", "type": "long" }, { "name": "accounttype", "description": "account type (admin, domain-admin, user)", "type": "short" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "sentbytes", "description": "the total number of network traffic bytes sent", "type": "long" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this account", "type": "integer" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this account", "type": "long" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this account", "type": "string" }, { "name": "volumetotal", "description": "the total volume being used by this account", "type": "long" }, { "name": "name", "description": "the name of the account", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by account", "type": "long" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this account to acquire", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "projecttotal", "description": "the total number of projects being administrated by this account", "type": "long" } ] }, { "name": "revertToVMSnapshot", "description": "Revert VM from a vmsnapshot.", "since": "4.2.0", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,deployVirtualMachine,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "vmsnapshotid", "description": "The ID of the vm snapshot", "type": "uuid", "length": 255, "required": true, "related": "createVMSnapshot,listVMSnapshot" } ], "response": [ { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" } ] }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "account", "description": "account owning the security group rule", "type": "string" } ] }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" } ] }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" } ] }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" } ] }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" } ] }, { "name": "addGuestOs", "description": "Add a new guest OS type", "since": "4.4.0", "isasync": true, "related": "", "params": [ { "name": "oscategoryid", "description": "ID of Guest OS category", "type": "uuid", "length": 255, "required": true, "related": "listOsCategories" }, { "name": "name", "description": "Optional name for Guest OS", "type": "string", "length": 255, "required": false }, { "name": "osdisplayname", "description": "Unique display name for Guest OS", "type": "string", "length": 255, "required": true }, { "name": "details", "description": "Map of (key/value pairs)", "type": "map", "length": 255, "required": true } ], "response": [ { "name": "description", "description": "the name/description of the OS type", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "oscategoryid", "description": "the ID of the OS category", "type": "string" }, { "name": "id", "description": "the ID of the OS type", "type": "string" }, { "name": "isuserdefined", "description": "is the guest OS user defined", "type": "boolean" }, { } ] }, { "name": "listHostTags", "description": "Lists host tags", "isasync": false, "related": "", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { }, { "name": "id", "description": "the ID of the host tag", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hostid", "description": "the host ID of the host tag", "type": "long" }, { "name": "name", "description": "the name of the host tag", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "addAnnotation", "description": "add an annotation.", "since": "4.11", "isasync": false, "related": "removeAnnotation", "params": [ { "name": "entitytype", "description": "the entity type (only HOST is allowed atm)", "type": "string", "length": 255, "required": false }, { "name": "entityid", "description": "the id of the entity to annotate", "type": "string", "length": 255, "required": false }, { "name": "annotation", "description": "the annotation text", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "annotation", "description": "the contents of the annotation", "type": "string" }, { "name": "id", "description": "the (uu)id of the annotation", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "created", "description": "the creation timestamp for this annotation", "type": "date" }, { "name": "userid", "description": "The (uu)id of the user that entered the annotation", "type": "string" }, { "name": "removed", "description": "the removal timestamp for this annotation", "type": "date" }, { }, { "name": "entitytype", "description": "the type of the annotated entity", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "entityid", "description": "the (uu)id of the entitiy to which this annotation pertains", "type": "string" } ] }, { "name": "removeGuestOsMapping", "description": "Removes a Guest OS Mapping.", "since": "4.4.0", "isasync": true, "params": [ { "name": "id", "description": "ID of the guest OS mapping", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "registerIso", "description": "Registers an existing ISO into the CloudStack Cloud.", "isasync": false, "related": "listIsos,registerTemplate,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates", "params": [ { "name": "ostypeid", "description": "the ID of the OS type that best represents the OS of this ISO. If the ISO is bootable this parameter needs to be passed", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "projectid", "description": "Register ISO for the project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,activateProject,updateProject,suspendProject" }, { "name": "isextractable", "description": "true if the ISO or its derivatives are extractable; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "ispublic", "description": "true if you want to register the ISO to be publicly available to all users, false otherwise.", "type": "boolean", "length": 255, "required": false }, { "name": "displaytext", "description": "the display text of the ISO. This is usually used for display purposes.", "type": "string", "length": 4096, "required": true }, { "name": "account", "description": "an optional account name. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "isfeatured", "description": "true if you want this ISO to be featured", "type": "boolean", "length": 255, "required": false }, { "name": "bootable", "description": "true if this ISO is bootable. If not passed explicitly its assumed to be true", "type": "boolean", "length": 255, "required": false }, { "name": "name", "description": "the name of the ISO", "type": "string", "length": 255, "required": true }, { "name": "url", "description": "the URL to where the ISO is currently being hosted", "type": "string", "length": 2048, "required": true }, { "name": "checksum", "description": "the checksum value of this ISO. The parameter containing the checksum will be considered a MD5sum if it is not prefixed\n and just a plain ascii/utf8 representation of a hexadecimal string. If it is required to\n use another algorithm the hexadecimal string is to be prefixed with a string of the form,\n \"{}\", not including the double quotes. In this is the exact string\n representing the java supported algorithm, i.e. MD5 or SHA-256. Note that java does not\n contain an algorithm called SHA256 or one called sha-256, only SHA-256.", "type": "string", "length": 255, "required": false }, { "name": "directdownload", "description": "true if ISO should bypass Secondary Storage and be downloaded to Primary Storage on deployment", "type": "boolean", "length": 255, "required": false }, { "name": "isdynamicallyscalable", "description": "true if ISO contains XS/VMWare tools inorder to support dynamic scaling of VM CPU/memory", "type": "boolean", "length": 255, "required": false }, { "name": "passwordenabled", "description": "true if password reset feature is supported; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "zoneid", "description": "the ID of the zone you wish to register the ISO to.", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "imagestoreuuid", "description": "Image store UUID", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "an optional domainId. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" } ], "response": [ { "name": "format", "description": "the format of the template.", "type": "imageformat" }, { "name": "projectid", "description": "the project id of the template", "type": "string" }, { }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "crossZones", "description": "true if the template is managed across all Zones, false otherwise", "type": "boolean" }, { "name": "directdownload", "description": "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage", "type": "boolean" }, { "name": "hostname", "description": "the name of the secondary storage host for the template", "type": "string" }, { "name": "checksum", "description": "checksum of the template", "type": "string" }, { "name": "size", "description": "the size of the template", "type": "long" }, { }, { "name": "isextractable", "description": "true if the template is extractable, false otherwise", "type": "boolean" }, { "name": "templatetag", "description": "the tag of this template", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "physicalsize", "description": "the physical size of the template", "type": "long" }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" }, { "name": "zonename", "description": "the name of the zone for this template", "type": "string" }, { "name": "account", "description": "the account name to which the template belongs", "type": "string" }, { "name": "sourcetemplateid", "description": "the template ID of the parent template if present", "type": "string" }, { "name": "isready", "description": "true if the template is ready to be deployed from, false otherwise.", "type": "boolean" }, { "name": "sshkeyenabled", "description": "true if template is sshkey enabled, false otherwise", "type": "boolean" }, { "name": "templatetype", "description": "the type of the template", "type": "string" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { "name": "created", "description": "the date this template was created", "type": "date" }, { "name": "displaytext", "description": "the template display text", "type": "string" }, { "name": "zoneid", "description": "the ID of the zone for this template", "type": "string" }, { "name": "removed", "description": "the date this template was removed", "type": "date" }, { "name": "bits", "description": "the processor bit size", "type": "int" }, { "name": "domain", "description": "the name of the domain to which the template belongs", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "status", "description": "the status of the template", "type": "string" }, { "name": "ostypename", "description": "the name of the OS type for this template.", "type": "string" }, { "name": "passwordenabled", "description": "true if the reset password feature is enabled, false otherwise", "type": "boolean" }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean" }, { "name": "project", "description": "the project name of the template", "type": "string" }, { "name": "childtemplates", "description": "if root disk template, then ids of the datas disk templates this template owns", "type": "set" }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "parenttemplateid", "description": "if Datadisk template, then id of the root disk template this template belongs to", "type": "string" }, { "name": "requireshvm", "description": "true if template requires HVM enabled, false otherwise", "type": "boolean" }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hostid", "description": "the ID of the secondary storage host for the template", "type": "string" }, { "name": "name", "description": "the template name", "type": "string" }, { "name": "ostypeid", "description": "the ID of the OS type for this template.", "type": "string" }, { "name": "accountid", "description": "the account id to which the template belongs", "type": "string" }, { "name": "details", "description": "additional key/value details tied with template", "type": "map" } ] }, { "name": "deployNetscalerVpx", "description": "Creates new NS Vpx", "isasync": true, "related": "addNetscalerLoadBalancer,listNetscalerLoadBalancers,registerNetscalerControlCenter", "params": [ { "name": "networkid", "description": "The network this ip address should be associated to.", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "zoneid", "description": "availability zone for the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "templateid", "description": "the ID of the template for the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "listIsos,registerTemplate,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "serviceofferingid", "description": "the ID of the service offering for the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "listServiceOfferings,updateServiceOffering" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "lbdevicename", "description": "device name", "type": "string" }, { "name": "privateinterface", "description": "the private interface of the load balancer", "type": "string" }, { "name": "lbdeviceid", "description": "device id of the netscaler load balancer", "type": "string" }, { "name": "gslbproviderpublicip", "description": "public IP of the NetScaler representing GSLB site", "type": "string" }, { }, { "name": "isexclusivegslbprovider", "description": "true if NetScaler device is provisioned exclusively to be a GSLB service provider", "type": "boolean" }, { "name": "gslbproviderprivateip", "description": "private IP of the NetScaler representing GSLB site", "type": "string" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { }, { "name": "physicalnetworkid", "description": "the physical network to which this netscaler device belongs to", "type": "string" }, { "name": "gslbprovider", "description": "true if NetScaler device is provisioned to be a GSLB service provider", "type": "boolean" }, { "name": "lbdevicededicated", "description": "true if device is dedicated for an account", "type": "boolean" }, { "name": "podids", "description": "Used when NetScaler device is provider of EIP service. This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to route pod's subnet IP to a NetScaler device.", "type": "list" }, { "name": "lbdevicestate", "description": "device state", "type": "string" }, { "name": "lbdevicecapacity", "description": "device capacity", "type": "long" }, { "name": "ipaddress", "description": "the management IP address of the external load balancer", "type": "string" }, { "name": "publicinterface", "description": "the public interface of the load balancer", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listElastistorVolume", "description": "Lists the volumes of elastistor", "isasync": false, "related": "", "params": [ { "name": "id", "description": "the ID of the account", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "compression", "description": "compression", "type": "string" }, { "name": "sync", "description": "syncronization", "type": "string" }, { }, { }, { "name": "name", "description": "the name of the volume", "type": "string" }, { "name": "graceallowed", "description": "graceallowed", "type": "string" }, { "name": "deduplication", "description": "deduplication", "type": "string" }, { "name": "id", "description": "the id of the volume", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deletePortableIpRange", "description": "deletes a range of portable public IP's associated with a region", "isasync": true, "params": [ { "name": "id", "description": "Id of the portable ip range", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "addBaremetalPxeKickStartServer", "description": "add a baremetal pxe server", "isasync": true, "related": "", "params": [ { "name": "password", "description": "Credentials to reach external pxe device", "type": "string", "length": 255, "required": true }, { "name": "tftpdir", "description": "Tftp root directory of PXE server", "type": "string", "length": 255, "required": true }, { "name": "pxeservertype", "description": "type of pxe device", "type": "string", "length": 255, "required": true }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" }, { "name": "username", "description": "Credentials to reach external pxe device", "type": "string", "length": 255, "required": true }, { "name": "podid", "description": "Pod Id", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "url", "description": "URL of the external pxe device", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "url", "description": "url", "type": "string" }, { "name": "tftpdir", "description": "Tftp root directory of PXE server", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "device id of ", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this external dhcp device belongs to", "type": "string" }, { } ] }, { "name": "listNiciraNvpDevices", "description": "Lists Nicira NVP devices", "isasync": false, "related": "addNiciraNvpDevice", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "nvpdeviceid", "description": "nicira nvp device ID", "type": "uuid", "length": 255, "required": false, "related": "addNiciraNvpDevice,listNiciraNvpDevices" }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "l2gatewayserviceuuid", "description": "this L2 gateway service Uuid", "type": "string" }, { }, { "name": "physicalnetworkid", "description": "the physical network to which this Nirica Nvp belongs to", "type": "string" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "transportzoneuuid", "description": "the transport zone Uuid", "type": "string" }, { "name": "hostname", "description": "the controller Ip address", "type": "string" }, { "name": "nvpdeviceid", "description": "device id of the Nicire Nvp", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "niciradevicename", "description": "device name", "type": "string" }, { "name": "l3gatewayserviceuuid", "description": "this L3 gateway service Uuid", "type": "string" } ] }, { "name": "listAlerts", "description": "Lists all alerts.", "isasync": false, "related": "", "params": [ { "name": "id", "description": "the ID of the alert", "type": "uuid", "length": 255, "required": false, "related": "listAlerts" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "list by alert name", "type": "string", "length": 255, "required": false, "since": "4.3" }, { "name": "type", "description": "list by alert type", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "sent", "description": "the date and time the alert was sent", "type": "date" }, { }, { "name": "name", "description": "the name of the alert", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "description", "description": "description of the alert", "type": "string" }, { }, { "name": "type", "description": "One of the following alert types: MEMORY = 0, CPU = 1, STORAGE = 2, STORAGE_ALLOCATED = 3, PUBLIC_IP = 4, PRIVATE_IP = 5, SECONDARY_STORAGE = 6, HOST = 7, USERVM = 8, DOMAIN_ROUTER = 9, CONSOLE_PROXY = 10, ROUTING = 11: lost connection to default route (to the gateway), STORAGE_MISC = 12, USAGE_SERVER = 13, MANAGMENT_NODE = 14, DOMAIN_ROUTER_MIGRATE = 15, CONSOLE_PROXY_MIGRATE = 16, USERVM_MIGRATE = 17, VLAN = 18, SSVM = 19, USAGE_SERVER_RESULT = 20, STORAGE_DELETE = 21, UPDATE_RESOURCE_COUNT = 22, USAGE_SANITY_RESULT = 23, DIRECT_ATTACHED_PUBLIC_IP = 24, LOCAL_STORAGE = 25, RESOURCE_LIMIT_EXCEEDED = 26, SYNC = 27, UPLOAD_FAILED = 28, OOBM_AUTH_ERROR = 29", "type": "short" }, { "name": "id", "description": "the id of the alert", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "deployVirtualMachine", "description": "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", "isasync": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "keypair", "description": "name of the ssh key pair used to login to the virtual machine", "type": "string", "length": 255, "required": false }, { "name": "securitygroupids", "description": "comma separated list of security groups id that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupnames parameter", "type": "list", "length": 255, "required": false, "related": "createSecurityGroup" }, { "name": "serviceofferingid", "description": "the ID of the service offering for the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "listServiceOfferings,updateServiceOffering" }, { "name": "userdata", "description": "an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.", "type": "string", "length": 32768, "required": false }, { "name": "account", "description": "an optional account for the virtual machine. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "Deploy vm for the project", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,activateProject,updateProject,suspendProject" }, { "name": "startvm", "description": "true if start vm after creating; defaulted to true if not specified", "type": "boolean", "length": 255, "required": false }, { "name": "name", "description": "host name for the virtual machine", "type": "string", "length": 255, "required": false }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false }, { "name": "displayvm", "description": "an optional field, whether to the display the vm to the end user or not.", "type": "boolean", "length": 255, "required": false, "since": "4.2" }, { "name": "keyboard", "description": "an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us", "type": "string", "length": 255, "required": false }, { "name": "affinitygroupnames", "description": "comma separated list of affinity groups names that are going to be applied to the virtual machine.Mutually exclusive with affinitygroupids parameter", "type": "list", "length": 255, "required": false, "related": "" }, { "name": "affinitygroupids", "description": "comma separated list of affinity groups id that are going to be applied to the virtual machine. Mutually exclusive with affinitygroupnames parameter", "type": "list", "length": 255, "required": false, "related": "" }, { "name": "displayname", "description": "an optional user generated name for the virtual machine", "type": "string", "length": 255, "required": false }, { "name": "datadiskofferinglist", "description": "datadisk template to disk-offering mapping; an optional parameter used to create additional data disks from datadisk templates; can't be specified with diskOfferingId parameter", "type": "map", "length": 255, "required": false, "since": "4.11" }, { "name": "networkids", "description": "list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter", "type": "list", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "dhcpoptionsnetworklist", "description": "DHCP options which are passed to the VM on start up Example: dhcpoptionsnetworklist[0].dhcp:114=url&dhcpoptionsetworklist[0].networkid=networkid&dhcpoptionsetworklist[0].dhcp:66=www.test.com", "type": "map", "length": 255, "required": false }, { "name": "templateid", "description": "the ID of the template for the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "listIsos,registerTemplate,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "diskofferingid", "description": "the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume. If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created.", "type": "uuid", "length": 255, "required": false, "related": "createDiskOffering" }, { "name": "ip6address", "description": "the ipv6 address for default vm's network", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "availability zone for the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "extraconfig", "description": "an optional URL encoded string that can be passed to the virtual machine upon successful deployment", "type": "string", "length": 5120, "required": false, "since": "4.12" }, { "name": "deploymentplanner", "description": "Deployment planner to use for vm allocation. Available to ROOT admin only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "group", "description": "an optional group for the virtual machine", "type": "string", "length": 255, "required": false }, { "name": "macaddress", "description": "the mac address for default vm's network", "type": "string", "length": 255, "required": false }, { "name": "securitygroupnames", "description": "comma separated list of security groups names that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter", "type": "list", "length": 255, "required": false, "related": "createSecurityGroup" }, { "name": "iptonetworklist", "description": "ip to network mapping. Can't be specified with networkIds parameter. Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid&iptonetworklist[0].mac=aa:bb:cc:dd:ee::ff - requests to use ip 10.10.10.11 in network id=uuid", "type": "map", "length": 255, "required": false }, { "name": "domainid", "description": "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "hypervisor", "description": "the hypervisor on which to deploy the virtual machine. The parameter is required and respected only when hypervisor info is not set on the ISO/Template passed to the call", "type": "string", "length": 255, "required": false }, { "name": "details", "description": "used to specify the custom parameters.", "type": "map", "length": 255, "required": false, "since": "4.3" }, { "name": "hostid", "description": "destination Host ID to deploy the VM to - parameter available for root admin only", "type": "uuid", "length": 255, "required": false, "related": "cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" }, { "name": "size", "description": "the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId", "type": "long", "length": 255, "required": false }, { "name": "ipaddress", "description": "the ip address for default vm's network", "type": "string", "length": 255, "required": false }, { "name": "rootdisksize", "description": "Optional field to resize root disk on deploy. Value is in GB. Only applies to template-based deployments. Analogous to details[0].rootdisksize, which takes precedence over this parameter if both are provided", "type": "long", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" } ] }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" } ] }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" } ] } ] }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" } ] }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" } ] }, { "name": "upgradeRouterTemplate", "description": "Upgrades router to use newer template", "isasync": false, "related": "listNuageVspGlobalDomainTemplate", "params": [ { "name": "account", "description": "upgrades all routers owned by the specified account", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "upgrades router with the specified Id", "type": "uuid", "length": 255, "required": false, "related": "listRouters,destroyRouter" }, { "name": "zoneid", "description": "upgrades all routers within the specified zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "domainid", "description": "upgrades all routers owned by the specified domain", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "podid", "description": "upgrades all routers within the specified pod", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "clusterid", "description": "upgrades all routers within the specified cluster", "type": "uuid", "length": 255, "required": false, "related": "addCluster" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "cancelHostMaintenance", "description": "Cancels host maintenance.", "isasync": true, "related": "addHost,reconnectHost,addBaremetalHost", "params": [ { "name": "id", "description": "the host ID", "type": "uuid", "length": 255, "required": true, "related": "cancelHostMaintenance,addHost,reconnectHost,addBaremetalHost" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "gpugroup", "description": "GPU cards present in the host", "type": "list", "response": [ { "name": "gpugroupname", "description": "GPU cards present in the host", "type": "string" }, { "name": "vgpu", "description": "the list of enabled vGPUs", "type": "list", "response": [ { "name": "maxvgpuperpgpu", "description": "Maximum no. of vgpu per gpu card (pgpu)", "type": "long" }, { "name": "maxcapacity", "description": "Maximum vgpu can be created with this vgpu type on the given gpu group", "type": "long" }, { "name": "remainingcapacity", "description": "Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type", "type": "long" }, { "name": "vgputype", "description": "Model Name of vGPU", "type": "string" }, { "name": "videoram", "description": "Video RAM for this vGPU type", "type": "long" }, { "name": "maxresolutionx", "description": "Maximum X resolution per display", "type": "long" }, { "name": "maxresolutiony", "description": "Maximum Y resolution per display", "type": "long" }, { "name": "maxheads", "description": "Maximum displays per user", "type": "long" } ] } ] }, { "name": "cpuspeed", "description": "the CPU speed of the host", "type": "long" }, { "name": "cpusockets", "description": "the number of CPU sockets on the host", "type": "integer" }, { "name": "lastpinged", "description": "the date and time the host was last pinged", "type": "date" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { }, { "name": "outofbandmanagement", "description": "the host out-of-band management information", "type": "outofbandmanagementresponse" }, { "name": "state", "description": "the state of the host", "type": "status" }, { "name": "username", "description": "the admin that annotated this host", "type": "string" }, { "name": "islocalstorageactive", "description": "true if local storage is active, false otherwise", "type": "boolean" }, { "name": "clusterid", "description": "the cluster ID of the host", "type": "string" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "memoryused", "description": "the amount of the host's memory currently used", "type": "long" }, { "name": "events", "description": "events available for the host", "type": "string" }, { "name": "clustername", "description": "the cluster name of the host", "type": "string" }, { "name": "lastannotated", "description": "the last time this host was annotated", "type": "date" }, { "name": "cpuwithoverprovisioning", "description": "the amount of the host's CPU after applying the cpu.overprovisioning.factor ", "type": "string" }, { "name": "zonename", "description": "the Zone name of the host", "type": "string" }, { "name": "version", "description": "the host version", "type": "string" }, { "name": "podname", "description": "the Pod name of the host", "type": "string" }, { "name": "oscategoryname", "description": "the OS category name of the host", "type": "string" }, { "name": "disksizetotal", "description": "the total disk size of the host", "type": "long" }, { "name": "averageload", "description": "the cpu average load on the host", "type": "long" }, { "name": "ipaddress", "description": "the IP address of the host", "type": "string" }, { "name": "capabilities", "description": "capabilities of the host", "type": "string" }, { "name": "hypervisor", "description": "the host hypervisor", "type": "hypervisortype" }, { "name": "managementserverid", "description": "the management server ID of the host", "type": "long" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "networkkbsread", "description": "the incoming network traffic on the host", "type": "long" }, { "name": "cpuallocated", "description": "the amount of the host's CPU currently allocated", "type": "string" }, { "name": "type", "description": "the host type", "type": "type" }, { "name": "memoryallocated", "description": "the amount of the host's memory currently allocated", "type": "long" }, { "name": "cpunumber", "description": "the CPU number of the host", "type": "integer" }, { "name": "hasenoughcapacity", "description": "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise", "type": "boolean" }, { "name": "name", "description": "the name of the host", "type": "string" }, { "name": "cpuused", "description": "the amount of the host's CPU currently used", "type": "string" }, { "name": "suitableformigration", "description": "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise", "type": "boolean" }, { "name": "oscategoryid", "description": "the OS category ID of the host", "type": "string" }, { "name": "hahost", "description": "true if the host is Ha host (dedicated to vms started by HA process; false otherwise", "type": "boolean" }, { "name": "details", "description": "Host details in key/value pairs.", "type": "map" }, { "name": "hosttags", "description": "comma-separated list of tags for the host", "type": "string" }, { "name": "clustertype", "description": "the cluster type of the cluster that host belongs to", "type": "string" }, { "name": "resourcestate", "description": "the resource state of the host", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "zoneid", "description": "the Zone ID of the host", "type": "string" }, { "name": "memorytotal", "description": "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning", "type": "long" }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "annotation", "description": "the last annotation set on this host by an admin", "type": "string" }, { "name": "hostha", "description": "the host HA information information", "type": "hostharesponse" }, { "name": "disconnected", "description": "true if the host is disconnected. False otherwise.", "type": "date" }, { }, { "name": "podid", "description": "the Pod ID of the host", "type": "string" }, { "name": "id", "description": "the ID of the host", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "memorywithoverprovisioning", "description": "the amount of the host's memory after applying the mem.overprovisioning.factor", "type": "string" } ] }, { "name": "listVlanIpRanges", "description": "Lists all VLAN IP ranges.", "isasync": false, "related": "dedicatePublicIpRange", "params": [ { "name": "podid", "description": "the Pod ID of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "zoneid", "description": "the Zone ID of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "createZone,updateZone,listZones,listZones" }, { "name": "vlan", "description": "the ID or VID of the VLAN. Default is an \"untagged\" VLAN.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "the account with which the VLAN IP range is associated. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "forvirtualnetwork", "description": "true if VLAN is of Virtual type, false if Direct", "type": "boolean", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the domain ID with which the VLAN IP range is associated. If used with the account parameter, returns all VLAN IP ranges for that account in the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "projectid", "description": "project who will own the VLAN", "type": "uuid", "length": 255, "required": false, "related": "listProjectAccounts,activateProject,updateProject,suspendProject" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "networkid", "description": "network id of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "physicalnetworkid", "description": "physical network id of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "id", "description": "the ID of the VLAN IP range", "type": "uuid", "length": 255, "required": false, "related": "listVlanIpRanges,dedicatePublicIpRange" } ], "response": [ { "name": "podname", "description": "the Pod name for the VLAN IP range", "type": "string" }, { "name": "endipv6", "description": "the end ipv6 of the VLAN IP range", "type": "string" }, { "name": "startip", "description": "the start ip of the VLAN IP range", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the VLAN IP range", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the VLAN IP range", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "startipv6", "description": "the start ipv6 of the VLAN IP range", "type": "string" }, { }, { "name": "project", "description": "the project name of the vlan range", "type": "string" }, { "name": "projectid", "description": "the project id of the vlan range", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "domain", "description": "the domain name of the VLAN IP range", "type": "string" }, { "name": "vlan", "description": "the ID or VID of the VLAN.", "type": "string" }, { "name": "endip", "description": "the end ip of the VLAN IP range", "type": "string" }, { "name": "id", "description": "the ID of the VLAN IP range", "type": "string" }, { "name": "account", "description": "the account of the VLAN IP range", "type": "string" }, { "name": "networkid", "description": "the network id of vlan range", "type": "string" }, { "name": "description", "description": "the description of the VLAN IP range", "type": "string" }, { "name": "netmask", "description": "the netmask of the VLAN IP range", "type": "string" }, { "name": "podid", "description": "the Pod ID for the VLAN IP range", "type": "string" }, { "name": "domainid", "description": "the domain ID of the VLAN IP range", "type": "string" }, { "name": "forsystemvms", "description": "indicates whether VLAN IP range is dedicated to system vms or not", "type": "boolean" }, { "name": "gateway", "description": "the gateway of the VLAN IP range", "type": "string" } ] }, { "name": "extractVolume", "description": "Extracts volume", "isasync": true, "related": "extractTemplate", "params": [ { "name": "url", "description": "the url to which the volume would be extracted", "type": "string", "length": 2048, "required": false }, { "name": "zoneid", "description": "the ID of the zone where the volume is located", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "id", "description": "the ID of the volume", "type": "uuid", "length": 255, "required": true, "related": "attachVolume,createVolume,createVolume,listVolumes,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "mode", "description": "the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "status", "description": "the status of the extraction", "type": "string" }, { "name": "accountid", "description": "the account id to which the extracted object belongs", "type": "string" }, { "name": "uploadpercentage", "description": "the percentage of the entity uploaded to the specified location", "type": "integer" }, { "name": "id", "description": "the id of extracted object", "type": "string" }, { "name": "url", "description": "if mode = upload then url of the uploaded entity. if mode = download the url from which the entity can be downloaded", "type": "string" }, { "name": "zoneid", "description": "zone ID the object was extracted from", "type": "string" }, { }, { "name": "state", "description": "the state of the extracted object", "type": "string" }, { "name": "storagetype", "description": "type of the storage", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "extractMode", "description": "the mode of extraction - upload or download", "type": "string" }, { "name": "resultstring", "description": "", "type": "string" }, { "name": "name", "description": "the name of the extracted object", "type": "string" }, { }, { "name": "extractId", "description": "the upload id of extracted object", "type": "string" }, { "name": "created", "description": "the time and date the object was created", "type": "date" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "zonename", "description": "zone name the object was extracted from", "type": "string" } ] }, { "name": "updateZone", "description": "Updates a Zone.", "isasync": false, "related": "createZone,listZones,listZones", "params": [ { "name": "dnssearchorder", "description": "the dns search order list", "type": "list", "length": 255, "required": false }, { "name": "dhcpprovider", "description": "the dhcp Provider for the Zone", "type": "string", "length": 255, "required": false }, { "name": "ispublic", "description": "updates a private zone to public if set, but not vice-versa", "type": "boolean", "length": 255, "required": false }, { "name": "dns2", "description": "the second DNS for the Zone", "type": "string", "length": 255, "required": false }, { "name": "ip6dns2", "description": "the second DNS for IPv6 network in the Zone", "type": "string", "length": 255, "required": false }, { "name": "internaldns1", "description": "the first internal DNS for the Zone", "type": "string", "length": 255, "required": false }, { "name": "domain", "description": "Network domain name for the networks in the zone; empty string will update domain with NULL value", "type": "string", "length": 255, "required": false }, { "name": "localstorageenabled", "description": "true if local storage offering enabled, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "dns1", "description": "the first DNS for the Zone", "type": "string", "length": 255, "required": false }, { "name": "ip6dns1", "description": "the first DNS for IPv6 network in the Zone", "type": "string", "length": 255, "required": false }, { "name": "guestcidraddress", "description": "the guest CIDR address for the Zone", "type": "string", "length": 255, "required": false }, { "name": "internaldns2", "description": "the second internal DNS for the Zone", "type": "string", "length": 255, "required": false }, { "name": "details", "description": "the details for the Zone", "type": "map", "length": 255, "required": false }, { "name": "id", "description": "the ID of the Zone", "type": "uuid", "length": 255, "required": true, "related": "createZone,updateZone,listZones,listZones" }, { "name": "allocationstate", "description": "Allocation state of this cluster for allocation of new resources", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "the name of the Zone", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "ip6dns2", "description": "the second IPv6 DNS for the Zone", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "internaldns2", "description": "the second internal DNS for the Zone", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "allocationstate", "description": "the allocation state of the cluster", "type": "string" }, { "name": "zonetoken", "description": "Zone Token", "type": "string" }, { "name": "localstorageenabled", "description": "true if local storage offering enabled, false otherwise", "type": "boolean" }, { }, { "name": "tags", "description": "the list of resource tags associated with zone.", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "description", "description": "Zone description", "type": "string" }, { "name": "internaldns1", "description": "the first internal DNS for the Zone", "type": "string" }, { "name": "securitygroupsenabled", "description": "true if security groups support is enabled, false otherwise", "type": "boolean" }, { "name": "dns1", "description": "the first DNS for the Zone", "type": "string" }, { "name": "dns2", "description": "the second DNS for the Zone", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the Zone", "type": "string" }, { "name": "domainid", "description": "the UUID of the containing domain, null for public zones", "type": "string" }, { "name": "name", "description": "Zone name", "type": "string" }, { "name": "dhcpprovider", "description": "the dhcp Provider for the Zone", "type": "string" }, { "name": "resourcedetails", "description": "Meta data associated with the zone (key/value pairs)", "type": "map" }, { "name": "networktype", "description": "the network type of the zone; can be Basic or Advanced", "type": "string" }, { }, { "name": "capacity", "description": "the capacity of the Zone", "type": "list", "response": [ { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "name", "description": "the capacity name", "type": "string" }, { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "clustername", "description": "the Cluster name", "type": "string" } ] }, { "name": "domainname", "description": "the name of the containing domain, null for public zones", "type": "string" }, { "name": "domain", "description": "Network domain name for the networks in the zone", "type": "string" }, { "name": "guestcidraddress", "description": "the guest CIDR address for the Zone", "type": "string" }, { "name": "displaytext", "description": "the display text of the zone", "type": "string" }, { "name": "id", "description": "Zone id", "type": "string" } ] }, { "name": "listNuageVspDevices", "description": "Lists Nuage VSP devices", "since": "4.5", "isasync": false, "related": "updateNuageVspDevice", "params": [ { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "vspdeviceid", "description": "the Nuage VSP device ID", "type": "uuid", "length": 255, "required": false, "related": "updateNuageVspDevice,listNuageVspDevices" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "retrycount", "description": "the number of retries on failure to communicate to Nuage VSD", "type": "int" }, { }, { "name": "apiversion", "description": "the version of the API to use to communicate to Nuage VSD", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "physicalnetworkid", "description": "the ID of the physical network to which this Nuage VSP belongs to", "type": "string" }, { "name": "retryinterval", "description": "the time to wait after failure before retrying to communicate to Nuage VSD", "type": "long" }, { "name": "hostname", "description": "the hostname of the Nuage VSD", "type": "string" }, { "name": "port", "description": "the port to communicate to Nuage VSD", "type": "int" }, { }, { "name": "vspdeviceid", "description": "the device id of the Nuage VSD", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "nuagedevicename", "description": "the name of the Nuage VSP device", "type": "string" }, { "name": "provider", "description": "the service provider name corresponding to this Nuage VSP device", "type": "string" }, { "name": "cmsid", "description": "the CMS ID generated by the Nuage VSD", "type": "string" } ] }, { "name": "listProjectAccounts", "description": "Lists project's accounts", "since": "3.0.0", "isasync": false, "related": "activateProject,updateProject,suspendProject", "params": [ { "name": "projectid", "description": "ID of the project", "type": "uuid", "length": 255, "required": true, "related": "listProjectAccounts,activateProject,updateProject,suspendProject" }, { "name": "account", "description": "list accounts of the project by account name", "type": "string", "length": 255, "required": false }, { "name": "role", "description": "list accounts of the project by role", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "vmavailable", "description": "the total number of virtual machines available for this project to acquire", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by project", "type": "long" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this project", "type": "long" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this project", "type": "long" }, { }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this project", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this project", "type": "integer" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this project", "type": "string" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the project can own", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this project", "type": "string" }, { "name": "volumetotal", "description": "the total volume being used by this project", "type": "long" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by project", "type": "long" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by project", "type": "long" }, { "name": "projectaccountname", "description": "the project account name of the project", "type": "string" }, { "name": "domainid", "description": "the domain id the project belongs to", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this project", "type": "long" }, { "name": "id", "description": "the id of the project", "type": "string" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this project", "type": "integer" }, { "name": "volumelimit", "description": "the total volume which can be used by this project", "type": "string" }, { "name": "iplimit", "description": "the total number of public ip addresses this project can acquire", "type": "string" }, { "name": "vpclimit", "description": "the total number of vpcs the project can own", "type": "string" }, { "name": "account", "description": "the account name of the project's owner", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this project", "type": "string" }, { "name": "name", "description": "the name of the project", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this project", "type": "string" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this project", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by project", "type": "float" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the project can own", "type": "string" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this project", "type": "string" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this project", "type": "long" }, { "name": "displaytext", "description": "the displaytext of the project", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the project can own", "type": "string" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this project", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this project to acquire", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this project", "type": "string" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this project", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by project", "type": "long" }, { "name": "cpulimit", "description": "the total number of cpu cores the project can own", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by project", "type": "long" }, { "name": "domain", "description": "the domain name where the project belongs to", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with vm", "type": "list", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "state", "description": "the state of the project", "type": "string" }, { }, { "name": "memorylimit", "description": "the total memory (in MB) the project can own", "type": "string" } ] }, { "name": "updateAutoScalePolicy", "description": "Updates an existing autoscale policy.", "isasync": true, "related": "listAutoScalePolicies", "params": [ { "name": "conditionids", "description": "the list of IDs of the conditions that are being evaluated on every interval", "type": "list", "length": 255, "required": false, "related": "" }, { "name": "quiettime", "description": "the cool down period for which the policy should not be evaluated after the action has been taken", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "the ID of the autoscale policy", "type": "uuid", "length": 255, "required": true, "related": "updateAutoScalePolicy,listAutoScalePolicies" }, { "name": "duration", "description": "the duration for which the conditions have to be true before action is taken", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "domainid", "description": "the domain ID of the autoscale policy", "type": "string" }, { "name": "id", "description": "the autoscale policy ID", "type": "string" }, { "name": "projectid", "description": "the project id autoscale policy", "type": "string" }, { "name": "project", "description": "the project name of the autoscale policy", "type": "string" }, { }, { "name": "conditions", "description": "the list of IDs of the conditions that are being evaluated on every interval", "type": "list" }, { "name": "duration", "description": "the duration for which the conditions have to be true before action is taken", "type": "integer" }, { "name": "action", "description": "the action to be executed if all the conditions evaluate to true for the specified duration.", "type": "string" }, { "name": "quiettime", "description": "the cool down period for which the policy should not be evaluated after the action has been taken", "type": "integer" }, { "name": "account", "description": "the account owning the autoscale policy", "type": "string" }, { "name": "domain", "description": "the domain name of the autoscale policy", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "createDiskOffering", "description": "Creates a disk offering.", "isasync": false, "related": "", "params": [ { "name": "bytesreadrate", "description": "bytes read rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "byteswriteratemax", "description": "burst bytes write rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "customizediops", "description": "whether disk offering iops is custom or not", "type": "boolean", "length": 255, "required": false }, { "name": "iopswriterate", "description": "io requests write rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "domainid", "description": "the ID of the containing domain, null for public offerings", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "tags", "description": "tags for the disk offering", "type": "string", "length": 4096, "required": false }, { "name": "disksize", "description": "size of the disk offering in GB (1GB = 1,073,741,824 bytes)", "type": "long", "length": 255, "required": false }, { "name": "iopsreadratemaxlength", "description": "length (in seconds) of the burst", "type": "long", "length": 255, "required": false }, { "name": "byteswriteratemaxlength", "description": "length (in seconds) of the burst", "type": "long", "length": 255, "required": false }, { "name": "provisioningtype", "description": "provisioning type used to create volumes. Valid values are thin, sparse, fat.", "type": "string", "length": 255, "required": false }, { "name": "displaytext", "description": "alternate display text of the disk offering", "type": "string", "length": 4096, "required": true }, { "name": "name", "description": "name of the disk offering", "type": "string", "length": 255, "required": true }, { "name": "iopswriteratemaxlength", "description": "length (in seconds) of the burst", "type": "long", "length": 255, "required": false }, { "name": "byteswriterate", "description": "bytes write rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "iopsreadrate", "description": "io requests read rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "customized", "description": "whether disk offering size is custom or not", "type": "boolean", "length": 255, "required": false }, { "name": "storagetype", "description": "the storage type of the disk offering. Values are local and shared.", "type": "string", "length": 255, "required": false }, { "name": "miniops", "description": "min iops of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "iopsreadratemax", "description": "burst requests read rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "maxiops", "description": "max iops of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "bytesreadratemax", "description": "burst bytes read rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "hypervisorsnapshotreserve", "description": "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", "type": "integer", "length": 255, "required": false }, { "name": "iopswriteratemax", "description": "burst io requests write rate of the disk offering", "type": "long", "length": 255, "required": false }, { "name": "bytesreadratemaxlength", "description": "length (in seconds) of the burst", "type": "long", "length": 255, "required": false }, { "name": "displayoffering", "description": "an optional field, whether to display the offering to the end user or not.", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "displayoffering", "description": "whether to display the offering to the end user or not.", "type": "boolean" }, { "name": "maxiops", "description": "the max iops of the disk offering", "type": "long" }, { "name": "diskIopsWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "domain", "description": "the domain name this disk offering belongs to. Ignore this information as it is not currently applicable.", "type": "string" }, { "name": "diskBytesReadRateMax", "description": "burst bytes read rate of the disk offering", "type": "long" }, { "name": "hypervisorsnapshotreserve", "description": "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", "type": "integer" }, { "name": "displaytext", "description": "an alternate display text of the disk offering.", "type": "string" }, { "name": "storagetype", "description": "the storage type for this disk offering", "type": "string" }, { "name": "iscustomizediops", "description": "true if disk offering uses custom iops, false otherwise", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "iscustomized", "description": "true if disk offering uses custom size, false otherwise", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "name", "description": "the name of the disk offering", "type": "string" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk offering", "type": "long" }, { }, { "name": "provisioningtype", "description": "provisioning type used to create volumes. Valid values are thin, sparse, fat.", "type": "string" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk offering", "type": "long" }, { "name": "created", "description": "the date this disk offering was created", "type": "date" }, { "name": "diskBytesReadRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "tags", "description": "the tags for the disk offering", "type": "string" }, { "name": "diskIopsWriteRateMax", "description": "burst io requests write rate of the disk offering", "type": "long" }, { "name": "domainid", "description": "the domain ID this disk offering belongs to. Ignore this information as it is not currently applicable.", "type": "string" }, { "name": "diskBytesWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "miniops", "description": "the min iops of the disk offering", "type": "long" }, { "name": "id", "description": "unique ID of the disk offering", "type": "string" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk offering", "type": "long" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk offering", "type": "long" }, { "name": "diskIopsReadRateMaxLength", "description": "length (in second) of the burst", "type": "long" }, { "name": "disksize", "description": "the size of the disk offering in GB", "type": "long" }, { "name": "cacheMode", "description": "the cache mode to use for this disk offering. none, writeback or writethrough", "type": "string" }, { "name": "diskBytesWriteRateMax", "description": "burst bytes write rate of the disk offering", "type": "long" }, { "name": "diskIopsReadRateMax", "description": "burst io requests read rate of the disk offering", "type": "long" } ] }, { "name": "listVolumes", "description": "Lists all volumes.", "isasync": false, "related": "attachVolume,createVolume,createVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume", "params": [ { "name": "virtualmachineid", "description": "the ID of the virtual machine", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,updateProject,suspendProject" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "displayvolume", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "zoneid", "description": "the ID of the availability zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones,listZones" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "storageid", "description": "the ID of the storage pool, available to ROOT admin only", "type": "string", "length": 255, "required": false, "since": "4.3", "related": "findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "name", "description": "the name of the disk volume", "type": "string", "length": 255, "required": false }, { "name": "podid", "description": "the pod id the disk volume belongs to", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "id", "description": "the ID of the disk volume", "type": "uuid", "length": 255, "required": false, "related": "attachVolume,createVolume,createVolume,listVolumes,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "ids", "description": "the IDs of the volumes, mutually exclusive with id", "type": "list", "length": 255, "required": false, "since": "4.9", "related": "attachVolume,createVolume,createVolume,listVolumes,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "clusterid", "description": "the cluster id the disk volume belongs to", "type": "uuid", "length": 255, "required": false, "related": "addCluster" }, { "name": "type", "description": "the type of disk volume", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "diskofferingid", "description": "list volumes by disk offering", "type": "uuid", "length": 255, "required": false, "since": "4.4", "related": "" }, { "name": "hostid", "description": "list volumes on specified host", "type": "uuid", "length": 255, "required": false, "related": "addHost,reconnectHost,addBaremetalHost" } ], "response": [ { "name": "clusterid", "description": "cluster id of the volume", "type": "string" }, { "name": "virtualmachineid", "description": "id of the virtual machine", "type": "string" }, { "name": "clustername", "description": "cluster name where the volume is allocated", "type": "string" }, { "name": "hypervisor", "description": "Hypervisor the volume belongs to", "type": "string" }, { "name": "vmdisplayname", "description": "display name of the virtual machine", "type": "string" }, { "name": "podname", "description": "pod name of the volume", "type": "string" }, { "name": "diskofferingid", "description": "ID of the disk offering", "type": "string" }, { "name": "storage", "description": "name of the primary storage hosting the disk volume", "type": "string" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk volume", "type": "long" }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "virtualsize", "description": "the bytes actually consumed on disk", "type": "long" }, { "name": "created", "description": "the date the disk volume was created", "type": "date" }, { "name": "podid", "description": "pod id of the volume", "type": "string" }, { "name": "destroyed", "description": "the boolean state of whether the volume is destroyed or not", "type": "boolean" }, { "name": "serviceofferingid", "description": "ID of the service offering for root disk", "type": "string" }, { "name": "zonename", "description": "name of the availability zone", "type": "string" }, { "name": "physicalsize", "description": "the bytes alloaated", "type": "long" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk volume", "type": "long" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk volume", "type": "long" }, { "name": "path", "description": "the path of the volume", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "attached", "description": "the date the volume was attached to a VM instance", "type": "date" }, { }, { }, { "name": "quiescevm", "description": "need quiesce vm or not when taking snapshot", "type": "boolean" }, { "name": "serviceofferingdisplaytext", "description": "the display text of the service offering for root disk", "type": "string" }, { "name": "storageid", "description": "id of the primary storage hosting the disk volume; returned to admin user only", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "snapshotid", "description": "ID of the snapshot from which this volume was created", "type": "string" }, { "name": "diskofferingdisplaytext", "description": "the display text of the disk offering", "type": "string" }, { "name": "status", "description": "the status of the volume", "type": "string" }, { "name": "type", "description": "type of the disk volume (ROOT or DATADISK)", "type": "string" }, { "name": "id", "description": "ID of the disk volume", "type": "string" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes.", "type": "string" }, { "name": "vmstate", "description": "state of the virtual machine", "type": "string" }, { "name": "isextractable", "description": "true if the volume is extractable, false otherwise", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "utilization", "description": "the disk utilization", "type": "string" }, { "name": "zoneid", "description": "ID of the availability zone", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "size", "description": "size of the disk volume", "type": "long" }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "deviceid", "description": "the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached.", "type": "long" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk volume", "type": "long" }, { "name": "storagetype", "description": "shared or local storage", "type": "string" }, { "name": "displayvolume", "description": "an optional field whether to the display the volume to the end user or not.", "type": "boolean" }, { "name": "state", "description": "the state of the disk volume", "type": "string" }, { "name": "chaininfo", "description": "the chain info of the volume", "type": "string" }, { "name": "name", "description": "name of the disk volume", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "vmname", "description": "name of the virtual machine", "type": "string" }, { "name": "miniops", "description": "min iops of the disk volume", "type": "long" }, { "name": "maxiops", "description": "max iops of the disk volume", "type": "long" }, { "name": "serviceofferingname", "description": "name of the service offering for root disk", "type": "string" }, { "name": "diskofferingname", "description": "name of the disk offering", "type": "string" } ] }, { "name": "createLBHealthCheckPolicy", "description": "Creates a load balancer health check policy", "since": "4.2.0", "isasync": true, "related": "listLBHealthCheckPolicies", "params": [ { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "responsetimeout", "description": "Time to wait when receiving a response from the health check (2sec - 60 sec)", "type": "integer", "length": 255, "required": false }, { "name": "healthythreshold", "description": "Number of consecutive health check success before declaring an instance healthy", "type": "integer", "length": 255, "required": false }, { "name": "unhealthythreshold", "description": "Number of consecutive health check failures before declaring an instance unhealthy", "type": "integer", "length": 255, "required": false }, { "name": "lbruleid", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "intervaltime", "description": "Amount of time between health checks (1 sec - 20940 sec)", "type": "integer", "length": 255, "required": false }, { "name": "description", "description": "the description of the load balancer health check policy", "type": "string", "length": 255, "required": false }, { "name": "pingpath", "description": "HTTP ping path", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "domain", "description": "the domain of the HealthCheck policy", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "account", "description": "the account of the HealthCheck policy", "type": "string" }, { "name": "healthcheckpolicy", "description": "the list of healthcheckpolicies", "type": "list", "response": [ { "name": "pingpath", "description": "the pingpath of the healthcheck policy", "type": "string" }, { "name": "id", "description": "the LB HealthCheck policy ID", "type": "string" }, { "name": "healthcheckthresshold", "description": "Number of consecutive health check success before declaring an instance healthy", "type": "int" }, { "name": "unhealthcheckthresshold", "description": "Number of consecutive health check failures before declaring an instance unhealthy.", "type": "int" }, { "name": "healthcheckinterval", "description": "Amount of time between health checks", "type": "int" }, { "name": "state", "description": "the state of the policy", "type": "string" }, { "name": "fordisplay", "description": "is policy for display to the regular user", "type": "boolean" }, { "name": "description", "description": "the description of the healthcheck policy", "type": "string" }, { "name": "responsetime", "description": "Time to wait when receiving a response from the health check", "type": "int" } ] }, { "name": "zoneid", "description": "the id of the zone the HealthCheck policy belongs to", "type": "string" }, { "name": "domainid", "description": "the domain ID of the HealthCheck policy", "type": "string" }, { "name": "lbruleid", "description": "the LB rule ID", "type": "string" } ] }, { "name": "lockUser", "description": "Locks a user account", "isasync": false, "related": "updateUser,getUser,enableUser,listUsers,createUser,disableUser", "params": [ { "name": "id", "description": "Locks user by user ID.", "type": "uuid", "length": 255, "required": true, "related": "updateUser,lockUser,getUser,enableUser,listUsers,createUser,disableUser" } ], "response": [ { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "username", "description": "the user name", "type": "string" }, { }, { }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" } ] }, { "name": "cloudianIsEnabled", "description": "Checks if the Cloudian Connector is enabled", "since": "4.11.0", "isasync": false, "related": "", "params": [ ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "url", "description": "the Cloudian Management Console base URL", "type": "string" }, { "name": "enabled", "description": "the Cloudian connector enabled state", "type": "boolean" } ] }, { "name": "listNetworkOfferings", "description": "Lists all available network offerings.", "isasync": false, "related": "", "params": [ { "name": "sourcenatsupported", "description": "true if need to list only netwok offerings where source NAT is supported, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "displaytext", "description": "list network offerings by display text", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "networkid", "description": "the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork,createNetwork" }, { "name": "istagged", "description": "true if offering has tags specified", "type": "boolean", "length": 255, "required": false }, { "name": "state", "description": "list network offerings by state", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "traffictype", "description": "list by traffic type", "type": "string", "length": 255, "required": false }, { "name": "guestiptype", "description": "list network offerings by guest type: shared or isolated", "type": "string", "length": 255, "required": false }, { "name": "availability", "description": "the availability of network offering. Default value is required", "type": "string", "length": 255, "required": false }, { "name": "supportedservices", "description": "list network offerings supporting certain services", "type": "list", "length": 255, "required": false }, { "name": "specifyvlan", "description": "the tags for the network offering.", "type": "boolean", "length": 255, "required": false }, { "name": "isdefault", "description": "true if need to list only default network offerings. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "tags", "description": "list network offerings by tags", "type": "string", "length": 4096, "required": false }, { "name": "zoneid", "description": "list network offerings available for network creation in specific zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones,listZones" }, { "name": "id", "description": "list network offerings by ID", "type": "uuid", "length": 255, "required": false, "related": "listNetworkOfferings" }, { "name": "name", "description": "list network offerings by name", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "forvpc", "description": "the network offering can be used only for network creation inside the VPC", "type": "boolean", "length": 255, "required": false }, { "name": "specifyipranges", "description": "true if need to list only network offerings which support specifying ip ranges", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "traffictype", "description": "the traffic type for the network offering, supported types are Public, Management, Control, Guest, Vlan or Storage.", "type": "string" }, { "name": "guestiptype", "description": "guest type of the network offering, can be Shared or Isolated", "type": "string" }, { "name": "supportspublicaccess", "description": "true if network offering supports public access for guest networks", "type": "boolean" }, { "name": "availability", "description": "availability of the network offering", "type": "string" }, { "name": "state", "description": "state of the network offering. Can be Disabled/Enabled/Inactive", "type": "string" }, { "name": "name", "description": "the name of the network offering", "type": "string" }, { }, { "name": "isdefault", "description": "true if network offering is default, false otherwise", "type": "boolean" }, { "name": "tags", "description": "the tags for the network offering", "type": "string" }, { "name": "maxconnections", "description": "maximum number of concurrents connections to be handled by lb", "type": "integer" }, { "name": "displaytext", "description": "an alternate display text of the network offering.", "type": "string" }, { "name": "details", "description": "additional key/value details tied with network offering", "type": "map" }, { }, { "name": "supportsstrechedl2subnet", "description": "true if network offering supports network that span multiple zones", "type": "boolean" }, { "name": "networkrate", "description": "data transfer rate in megabits per second allowed.", "type": "integer" }, { "name": "egressdefaultpolicy", "description": "true if guest network default egress policy is allow; false if default egress policy is deny", "type": "boolean" }, { "name": "conservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" } ] }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" } ] }, { "name": "id", "description": "the id of the network offering", "type": "string" }, { "name": "forvpc", "description": "true if network offering can be used by VPC networks only", "type": "boolean" }, { "name": "specifyipranges", "description": "true if network offering supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "serviceofferingid", "description": "the ID of the service offering used by virtual router provider", "type": "string" }, { "name": "ispersistent", "description": "true if network offering supports persistent networks, false otherwise", "type": "boolean" }, { "name": "created", "description": "the date this network offering was created", "type": "date" }, { "name": "specifyvlan", "description": "true if network offering supports vlans, false otherwise", "type": "boolean" } ] }, { "name": "listLBHealthCheckPolicies", "description": "Lists load balancer health check policies.", "since": "4.2.0", "isasync": false, "related": "", "params": [ { "name": "id", "description": "the ID of the health check policy", "type": "uuid", "length": 255, "required": false, "since": "4.4", "related": "listLBHealthCheckPolicies" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "lbruleid", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { }, { "name": "healthcheckpolicy", "description": "the list of healthcheckpolicies", "type": "list", "response": [ { "name": "healthcheckthresshold", "description": "Number of consecutive health check success before declaring an instance healthy", "type": "int" }, { "name": "pingpath", "description": "the pingpath of the healthcheck policy", "type": "string" }, { "name": "fordisplay", "description": "is policy for display to the regular user", "type": "boolean" }, { "name": "unhealthcheckthresshold", "description": "Number of consecutive health check failures before declaring an instance unhealthy.", "type": "int" }, { "name": "state", "description": "the state of the policy", "type": "string" }, { "name": "id", "description": "the LB HealthCheck policy ID", "type": "string" }, { "name": "description", "description": "the description of the healthcheck policy", "type": "string" }, { "name": "responsetime", "description": "Time to wait when receiving a response from the health check", "type": "int" }, { "name": "healthcheckinterval", "description": "Amount of time between health checks", "type": "int" } ] }, { "name": "domainid", "description": "the domain ID of the HealthCheck policy", "type": "string" }, { }, { "name": "account", "description": "the account of the HealthCheck policy", "type": "string" }, { "name": "lbruleid", "description": "the LB rule ID", "type": "string" }, { "name": "domain", "description": "the domain of the HealthCheck policy", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "zoneid", "description": "the id of the zone the HealthCheck policy belongs to", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "createNetwork", "description": "Creates a network", "isasync": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork", "params": [ { "name": "vpcid", "description": "the VPC network belongs to", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,listVPCs,restartVPC,createVPC,updateVPC" }, { "name": "endipv6", "description": "the ending IPv6 address in the IPv6 network range", "type": "string", "length": 255, "required": false }, { "name": "subdomainaccess", "description": "Defines whether to allow subdomains to use networks dedicated to their parent domain(s). Should be used with aclType=Domain, defaulted to allow.subdomain.network.access global config if not specified", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "account that will own the network", "type": "string", "length": 255, "required": false }, { "name": "networkofferingid", "description": "the network offering ID", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "gateway", "description": "the gateway of the network. Required for shared networks and isolated networks when it belongs to VPC", "type": "string", "length": 255, "required": false }, { "name": "displaytext", "description": "the display text of the network", "type": "string", "length": 255, "required": true }, { "name": "ip6gateway", "description": "the gateway of the IPv6 network. Required for Shared networks", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "an optional project for the SSH key", "type": "uuid", "length": 255, "required": false, "related": "activateProject,updateProject,suspendProject" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean", "length": 255, "required": false }, { "name": "domainid", "description": "domain ID of the account owning a network", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "isolatedpvlan", "description": "the isolated private VLAN for this network", "type": "string", "length": 255, "required": false }, { "name": "startipv6", "description": "the beginning IPv6 address in the IPv6 network range", "type": "string", "length": 255, "required": false }, { "name": "networkdomain", "description": "network domain", "type": "string", "length": 255, "required": false }, { "name": "vlan", "description": "the ID or VID of the network", "type": "string", "length": 255, "required": false }, { "name": "ip6cidr", "description": "the CIDR of IPv6 network, must be at least /64", "type": "string", "length": 255, "required": false }, { "name": "startip", "description": "the beginning IP address in the network IP range", "type": "string", "length": 255, "required": false }, { "name": "netmask", "description": "the netmask of the network. Required for shared networks and isolated networks when it belongs to VPC", "type": "string", "length": 255, "required": false }, { "name": "bypassvlanoverlapcheck", "description": "when true bypasses VLAN id/range overlap check during network creation for shared and L2 networks", "type": "boolean", "length": 255, "required": false }, { "name": "name", "description": "the name of the network", "type": "string", "length": 255, "required": true }, { "name": "aclid", "description": "Network ACL ID associated for the network", "type": "uuid", "length": 255, "required": false, "related": "createNetworkACLList" }, { "name": "physicalnetworkid", "description": "the physical network ID the network belongs to", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "zoneid", "description": "the zone ID for the network", "type": "uuid", "length": 255, "required": true, "related": "createZone,listZones,listZones" }, { "name": "acltype", "description": "Access control type; supported values are account and domain. In 3.0 all shared networks should have aclType=Domain, and all isolated networks - Account. Account means that only the account owner can use the network, domain - all accounts in the domain can use the network", "type": "string", "length": 255, "required": false }, { "name": "externalid", "description": "ID of the network in an external system.", "type": "string", "length": 255, "required": false }, { "name": "endip", "description": "the ending IP address in the network IP range. If not specified, will be defaulted to startIP", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "name", "description": "the capability name", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "value", "description": "the capability value", "type": "string" } ] }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" } ] }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" } ] }, { "name": "listDedicatedPods", "description": "Lists dedicated pods.", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "domainid", "description": "the ID of the domain associated with the pod", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "affinitygroupid", "description": "list dedicated pods by affinity group", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "podid", "description": "the ID of the pod", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "account", "description": "the name of the account associated with the pod. Must be used with domainId.", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "podname", "description": "the Name of the Pod", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the domain ID to which the Pod is dedicated", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "accountid", "description": "the Account Id to which the Pod is dedicated", "type": "string" }, { "name": "id", "description": "the ID of the dedicated resource", "type": "string" }, { "name": "podid", "description": "the ID of the Pod", "type": "string" }, { "name": "affinitygroupid", "description": "the Dedication Affinity Group ID of the pod", "type": "string" } ] }, { "name": "migrateVirtualMachineWithVolume", "description": "Attempts Migration of a VM with its volumes to a different host", "isasync": true, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "migrateto", "description": "Storage to pool mapping. This parameter specifies the mapping between a volume and a pool where you want to migrate that volume. Format of this parameter: migrateto[volume-index].volume=&migrateto[volume-index].pool=Where, [volume-index] indicates the index to identify the volume that you want to migrate, volume= indicates the UUID of the volume that you want to migrate, and pool= indicates the UUID of the pool where you want to migrate the volume. Example: migrateto[0].volume=<71f43cd6-69b0-4d3b-9fbc-67f50963d60b>&migrateto[0].pool=&migrateto[1].volume=<88de0173-55c0-4c1c-a269-83d0279eeedf>&migrateto[1].pool=<95d6e97c-6766-4d67-9a30-c449c15011d1>&migrateto[2].volume=<1b331390-59f2-4796-9993-bf11c6e76225>&migrateto[2].pool=<41fdb564-9d3b-447d-88ed-7628f7640cbc>", "type": "map", "length": 255, "required": false }, { "name": "hostid", "description": "Destination Host ID to migrate VM to.", "type": "uuid", "length": 255, "required": true, "related": "addHost,reconnectHost,addBaremetalHost" }, { "name": "virtualmachineid", "description": "the ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,migrateVirtualMachineWithVolume,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" } ] }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" } ] }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" } ] }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" } ] }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" } ] }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" } ] }, { "name": "listVPCs", "description": "Lists VPCs", "isasync": false, "related": "migrateVPC,listVPCs,restartVPC,createVPC,updateVPC", "params": [ { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "state", "description": "list VPCs by state", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "list by name of the VPC", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "supportedservices", "description": "list VPC supporting certain services", "type": "list", "length": 255, "required": false }, { "name": "id", "description": "list VPC by id", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,listVPCs,restartVPC,createVPC,updateVPC" }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "cidr", "description": "list by cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR", "type": "string", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "restartrequired", "description": "list VPCs by restartRequired option", "type": "boolean", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "displaytext", "description": "List by display text of the VPC", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "zoneid", "description": "list by zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones,listZones" }, { "name": "vpcofferingid", "description": "list by ID of the VPC offering", "type": "uuid", "length": 255, "required": false, "related": "updateVPCOffering" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,updateProject,suspendProject" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "name", "description": "the name of the VPC", "type": "string" }, { "name": "regionlevelvpc", "description": "true if VPC is region level", "type": "boolean" }, { "name": "displaytext", "description": "an alternate display text of the VPC.", "type": "string" }, { "name": "created", "description": "the date this VPC was created", "type": "date" }, { "name": "redundantvpcrouter", "description": "if this VPC has redundant router", "type": "boolean" }, { "name": "domainid", "description": "the domain id of the VPC owner", "type": "string" }, { "name": "restartrequired", "description": "true VPC requires restart", "type": "boolean" }, { "name": "project", "description": "the project name of the VPC", "type": "string" }, { }, { "name": "state", "description": "state of the VPC. Can be Inactive/Enabled", "type": "string" }, { }, { "name": "tags", "description": "the list of resource tags associated with the project", "type": "list", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "networkdomain", "description": "the network domain of the VPC", "type": "string" }, { "name": "cidr", "description": "the cidr the VPC", "type": "string" }, { "name": "id", "description": "the id of the VPC", "type": "string" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "distributedvpcrouter", "description": "is VPC uses distributed router for one hop forwarding and host based network ACL's", "type": "boolean" }, { "name": "network", "description": "the list of networks belongign to the VPC", "type": "list", "response": [ { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "name", "description": "the service name", "type": "string" }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" } ] }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "value", "description": "the capability value", "type": "string" }, { "name": "name", "description": "the capability name", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" } ] } ] }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" } ] }, { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "name", "description": "the service name", "type": "string" }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" } ] }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "name", "description": "the provider name", "type": "string" } ] } ] }, { "name": "zonename", "description": "the name of the zone the VPC belongs to", "type": "string" }, { "name": "zoneid", "description": "zone id of the vpc", "type": "string" }, { "name": "projectid", "description": "the project id of the VPC", "type": "string" }, { "name": "fordisplay", "description": "is vpc for display to the regular user", "type": "boolean" }, { "name": "account", "description": "the owner of the VPC", "type": "string" }, { "name": "vpcofferingid", "description": "vpc offering id the VPC is created from", "type": "string" } ] }, { "name": "runDiagnostics", "description": "Execute network-utility command (ping/arping/tracert) on system VMs remotely", "since": "4.12.0.0", "isasync": true, "related": "", "params": [ { "name": "ipaddress", "description": "The IP/Domain address to test connection to", "type": "string", "length": 255, "required": true }, { "name": "targetid", "description": "The ID of the system VM instance to diagnose", "type": "uuid", "length": 255, "required": true, "related": "migrateSystemVm,startSystemVm" }, { "name": "params", "description": "Additional command line options that apply for each command", "type": "string", "length": 255, "required": false }, { "name": "type", "description": "The system VM diagnostics type valid options are: ping, traceroute, arping", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "stderr", "description": "the standard error output from the command execution", "type": "string" }, { }, { "name": "stdout", "description": "the standard output from the command execution", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "exitcode", "description": "the command execution return code", "type": "string" } ] }, { "name": "addNetworkDevice", "description": "Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer", "isasync": false, "related": "", "params": [ { "name": "networkdevicetype", "description": "Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall, PaloAltoFirewall", "type": "string", "length": 255, "required": false }, { "name": "networkdeviceparameterlist", "description": "parameters for network device", "type": "map", "length": 255, "required": false } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the network device", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "updateUser", "description": "Updates a user account", "isasync": false, "related": "getUser,enableUser,listUsers,createUser,disableUser", "params": [ { "name": "email", "description": "email", "type": "string", "length": 255, "required": false }, { "name": "password", "description": "Clear text password (default hashed to SHA256SALT). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter. Can't be passed when command is executed via integration.api.port", "type": "string", "length": 255, "required": false }, { "name": "usersecretkey", "description": "The secret key for the user. Must be specified with userApiKey", "type": "string", "length": 255, "required": false }, { "name": "username", "description": "Unique username", "type": "string", "length": 255, "required": false }, { "name": "userapikey", "description": "The API key for the user. Must be specified with userSecretKey", "type": "string", "length": 255, "required": false }, { "name": "lastname", "description": "last name", "type": "string", "length": 255, "required": false }, { "name": "firstname", "description": "first name", "type": "string", "length": 255, "required": false }, { "name": "timezone", "description": "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "User uuid", "type": "uuid", "length": 255, "required": true, "related": "updateUser,getUser,enableUser,listUsers,createUser,disableUser" }, { "name": "currentpassword", "description": "Current password that was being used by the user. You must inform the current password when updating the password.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "username", "description": "the user name", "type": "string" } ] }, { "name": "restartVPC", "description": "Restarts a VPC", "isasync": true, "related": "migrateVPC,listVPCs,createVPC,updateVPC", "params": [ { "name": "id", "description": "the id of the VPC", "type": "uuid", "length": 255, "required": true, "related": "migrateVPC,listVPCs,restartVPC,createVPC,updateVPC" }, { "name": "cleanup", "description": "If cleanup old network elements", "type": "boolean", "length": 255, "required": false }, { "name": "makeredundant", "description": "Turn a single VPC into a redundant one.", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the domain id of the VPC owner", "type": "string" }, { }, { "name": "vpcofferingid", "description": "vpc offering id the VPC is created from", "type": "string" }, { "name": "redundantvpcrouter", "description": "if this VPC has redundant router", "type": "boolean" }, { "name": "project", "description": "the project name of the VPC", "type": "string" }, { "name": "state", "description": "state of the VPC. Can be Inactive/Enabled", "type": "string" }, { "name": "name", "description": "the name of the VPC", "type": "string" }, { "name": "zonename", "description": "the name of the zone the VPC belongs to", "type": "string" }, { "name": "networkdomain", "description": "the network domain of the VPC", "type": "string" }, { "name": "displaytext", "description": "an alternate display text of the VPC.", "type": "string" }, { "name": "created", "description": "the date this VPC was created", "type": "date" }, { "name": "cidr", "description": "the cidr the VPC", "type": "string" }, { "name": "zoneid", "description": "zone id of the vpc", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "restartrequired", "description": "true VPC requires restart", "type": "boolean" }, { "name": "network", "description": "the list of networks belongign to the VPC", "type": "list", "response": [ { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "name", "description": "the capability name", "type": "string" } ] }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "name", "description": "the provider name", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" } ] }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "netmask", "description": "the network's netmask", "type": "string" } ] }, { "name": "fordisplay", "description": "is vpc for display to the regular user", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated with the project", "type": "list", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "distributedvpcrouter", "description": "is VPC uses distributed router for one hop forwarding and host based network ACL's", "type": "boolean" }, { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "name", "description": "the service name", "type": "string" }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "name", "description": "the provider name", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" } ] }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "name", "description": "the capability name", "type": "string" } ] } ] }, { "name": "regionlevelvpc", "description": "true if VPC is region level", "type": "boolean" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "account", "description": "the owner of the VPC", "type": "string" }, { "name": "projectid", "description": "the project id of the VPC", "type": "string" }, { "name": "id", "description": "the id of the VPC", "type": "string" } ] }, { "name": "cleanupSimulatorMock", "description": "cleanup simulator mock", "isasync": false, "params": [ { "name": "id", "description": "id of the configured mock", "type": "long", "length": 255, "required": false } ], "response": [ { }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "removeCertFromLoadBalancer", "description": "Removes a certificate from a load balancer rule", "isasync": true, "params": [ { "name": "lbruleid", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "attachVolume", "description": "Attaches a disk volume to a virtual machine.", "isasync": true, "related": "createVolume,createVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume", "params": [ { "name": "deviceid", "description": "the ID of the device to map the volume to within the guest OS. If no deviceId is passed in, the next available deviceId will be chosen. Possible values for a Linux OS are:* 0 - /dev/xvda* 1 - /dev/xvdb* 2 - /dev/xvdc* 4 - /dev/xvde* 5 - /dev/xvdf* 6 - /dev/xvdg* 7 - /dev/xvdh* 8 - /dev/xvdi* 9 - /dev/xvdj", "type": "long", "length": 255, "required": false }, { "name": "virtualmachineid", "description": " the ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "id", "description": "the ID of the disk volume", "type": "uuid", "length": 255, "required": true, "related": "attachVolume,createVolume,createVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "virtualmachineid", "description": "id of the virtual machine", "type": "string" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk volume", "type": "long" }, { "name": "serviceofferingname", "description": "name of the service offering for root disk", "type": "string" }, { "name": "status", "description": "the status of the volume", "type": "string" }, { "name": "state", "description": "the state of the disk volume", "type": "string" }, { "name": "physicalsize", "description": "the bytes alloaated", "type": "long" }, { "name": "storage", "description": "name of the primary storage hosting the disk volume", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk volume", "type": "long" }, { "name": "clusterid", "description": "cluster id of the volume", "type": "string" }, { "name": "maxiops", "description": "max iops of the disk volume", "type": "long" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes.", "type": "string" }, { "name": "clustername", "description": "cluster name where the volume is allocated", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "isextractable", "description": "true if the volume is extractable, false otherwise", "type": "boolean" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "deviceid", "description": "the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached.", "type": "long" }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "serviceofferingid", "description": "ID of the service offering for root disk", "type": "string" }, { "name": "storagetype", "description": "shared or local storage", "type": "string" }, { "name": "destroyed", "description": "the boolean state of whether the volume is destroyed or not", "type": "boolean" }, { "name": "quiescevm", "description": "need quiesce vm or not when taking snapshot", "type": "boolean" }, { "name": "serviceofferingdisplaytext", "description": "the display text of the service offering for root disk", "type": "string" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk volume", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "zoneid", "description": "ID of the availability zone", "type": "string" }, { "name": "diskofferingdisplaytext", "description": "the display text of the disk offering", "type": "string" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk volume", "type": "long" }, { }, { "name": "name", "description": "name of the disk volume", "type": "string" }, { "name": "zonename", "description": "name of the availability zone", "type": "string" }, { "name": "chaininfo", "description": "the chain info of the volume", "type": "string" }, { "name": "podname", "description": "pod name of the volume", "type": "string" }, { "name": "created", "description": "the date the disk volume was created", "type": "date" }, { "name": "displayvolume", "description": "an optional field whether to the display the volume to the end user or not.", "type": "boolean" }, { "name": "virtualsize", "description": "the bytes actually consumed on disk", "type": "long" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "type", "description": "type of the disk volume (ROOT or DATADISK)", "type": "string" }, { "name": "size", "description": "size of the disk volume", "type": "long" }, { "name": "storageid", "description": "id of the primary storage hosting the disk volume; returned to admin user only", "type": "string" }, { "name": "path", "description": "the path of the volume", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "name of the disk offering", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "vmstate", "description": "state of the virtual machine", "type": "string" }, { "name": "id", "description": "ID of the disk volume", "type": "string" }, { "name": "attached", "description": "the date the volume was attached to a VM instance", "type": "date" }, { "name": "vmdisplayname", "description": "display name of the virtual machine", "type": "string" }, { }, { "name": "hypervisor", "description": "Hypervisor the volume belongs to", "type": "string" }, { "name": "utilization", "description": "the disk utilization", "type": "string" }, { "name": "vmname", "description": "name of the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "diskofferingid", "description": "ID of the disk offering", "type": "string" }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "miniops", "description": "min iops of the disk volume", "type": "long" }, { "name": "podid", "description": "pod id of the volume", "type": "string" }, { "name": "snapshotid", "description": "ID of the snapshot from which this volume was created", "type": "string" } ] }, { "name": "addHost", "description": "Adds a new host.", "isasync": false, "related": "reconnectHost,addBaremetalHost", "params": [ { "name": "password", "description": "the password for the host", "type": "string", "length": 255, "required": true }, { "name": "hosttags", "description": "list of tags to be added to the host", "type": "list", "length": 255, "required": false }, { "name": "allocationstate", "description": "Allocation state of this Host for allocation of new resources", "type": "string", "length": 255, "required": false }, { "name": "hypervisor", "description": "hypervisor type of the host", "type": "string", "length": 255, "required": true }, { "name": "clustername", "description": "the cluster name for the host", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID for the host", "type": "uuid", "length": 255, "required": true, "related": "createZone,listZones,listZones" }, { "name": "url", "description": "the host URL", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "the username for the host", "type": "string", "length": 255, "required": true }, { "name": "podid", "description": "the Pod ID for the host", "type": "uuid", "length": 255, "required": true, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "clusterid", "description": "the cluster ID for the host", "type": "uuid", "length": 255, "required": false, "related": "addCluster" } ], "response": [ { "name": "lastannotated", "description": "the last time this host was annotated", "type": "date" }, { "name": "clusterid", "description": "the cluster ID of the host", "type": "string" }, { "name": "type", "description": "the host type", "type": "type" }, { "name": "resourcestate", "description": "the resource state of the host", "type": "string" }, { "name": "memorytotal", "description": "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning", "type": "long" }, { "name": "cpuspeed", "description": "the CPU speed of the host", "type": "long" }, { "name": "disksizetotal", "description": "the total disk size of the host", "type": "long" }, { "name": "memoryallocated", "description": "the amount of the host's memory currently allocated", "type": "long" }, { "name": "gpugroup", "description": "GPU cards present in the host", "type": "list", "response": [ { "name": "vgpu", "description": "the list of enabled vGPUs", "type": "list", "response": [ { "name": "maxresolutionx", "description": "Maximum X resolution per display", "type": "long" }, { "name": "maxvgpuperpgpu", "description": "Maximum no. of vgpu per gpu card (pgpu)", "type": "long" }, { "name": "remainingcapacity", "description": "Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type", "type": "long" }, { "name": "maxheads", "description": "Maximum displays per user", "type": "long" }, { "name": "videoram", "description": "Video RAM for this vGPU type", "type": "long" }, { "name": "vgputype", "description": "Model Name of vGPU", "type": "string" }, { "name": "maxcapacity", "description": "Maximum vgpu can be created with this vgpu type on the given gpu group", "type": "long" }, { "name": "maxresolutiony", "description": "Maximum Y resolution per display", "type": "long" } ] }, { "name": "gpugroupname", "description": "GPU cards present in the host", "type": "string" } ] }, { "name": "clustertype", "description": "the cluster type of the cluster that host belongs to", "type": "string" }, { "name": "memoryused", "description": "the amount of the host's memory currently used", "type": "long" }, { "name": "events", "description": "events available for the host", "type": "string" }, { "name": "cpuallocated", "description": "the amount of the host's CPU currently allocated", "type": "string" }, { "name": "username", "description": "the admin that annotated this host", "type": "string" }, { "name": "id", "description": "the ID of the host", "type": "string" }, { "name": "state", "description": "the state of the host", "type": "status" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "outofbandmanagement", "description": "the host out-of-band management information", "type": "outofbandmanagementresponse" }, { "name": "islocalstorageactive", "description": "true if local storage is active, false otherwise", "type": "boolean" }, { "name": "hahost", "description": "true if the host is Ha host (dedicated to vms started by HA process; false otherwise", "type": "boolean" }, { "name": "hypervisor", "description": "the host hypervisor", "type": "hypervisortype" }, { "name": "name", "description": "the name of the host", "type": "string" }, { "name": "disconnected", "description": "true if the host is disconnected. False otherwise.", "type": "date" }, { "name": "annotation", "description": "the last annotation set on this host by an admin", "type": "string" }, { "name": "details", "description": "Host details in key/value pairs.", "type": "map" }, { }, { "name": "cpuwithoverprovisioning", "description": "the amount of the host's CPU after applying the cpu.overprovisioning.factor ", "type": "string" }, { "name": "cpunumber", "description": "the CPU number of the host", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hosttags", "description": "comma-separated list of tags for the host", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the host", "type": "long" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "zoneid", "description": "the Zone ID of the host", "type": "string" }, { "name": "clustername", "description": "the cluster name of the host", "type": "string" }, { "name": "zonename", "description": "the Zone name of the host", "type": "string" }, { "name": "podid", "description": "the Pod ID of the host", "type": "string" }, { "name": "capabilities", "description": "capabilities of the host", "type": "string" }, { "name": "cpusockets", "description": "the number of CPU sockets on the host", "type": "integer" }, { "name": "lastpinged", "description": "the date and time the host was last pinged", "type": "date" }, { "name": "cpuused", "description": "the amount of the host's CPU currently used", "type": "string" }, { "name": "oscategoryname", "description": "the OS category name of the host", "type": "string" }, { "name": "ipaddress", "description": "the IP address of the host", "type": "string" }, { "name": "memorywithoverprovisioning", "description": "the amount of the host's memory after applying the mem.overprovisioning.factor", "type": "string" }, { }, { "name": "managementserverid", "description": "the management server ID of the host", "type": "long" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "hasenoughcapacity", "description": "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise", "type": "boolean" }, { "name": "suitableformigration", "description": "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "podname", "description": "the Pod name of the host", "type": "string" }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "hostha", "description": "the host HA information information", "type": "hostharesponse" }, { "name": "averageload", "description": "the cpu average load on the host", "type": "long" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "oscategoryid", "description": "the OS category ID of the host", "type": "string" }, { "name": "version", "description": "the host version", "type": "string" } ] }, { "name": "addBaremetalDhcp", "description": "adds a baremetal dhcp server", "isasync": true, "related": "listBaremetalDhcp", "params": [ { "name": "url", "description": "URL of the external dhcp appliance.", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "Credentials to reach external dhcp device", "type": "string", "length": 255, "required": true }, { "name": "dhcpservertype", "description": "Type of dhcp device", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "Credentials to reach external dhcp device", "type": "string", "length": 255, "required": true }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" } ], "response": [ { "name": "url", "description": "url", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "id", "description": "device id of ", "type": "string" }, { }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this external dhcp device belongs to", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "dhcpservertype", "description": "name of the provider", "type": "string" } ] }, { "name": "addTrafficMonitor", "description": "Adds Traffic Monitor Host for Direct Network Usage", "isasync": false, "related": "", "params": [ { "name": "excludezones", "description": "Traffic going into the listed zones will not be metered", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "Zone in which to add the external firewall appliance.", "type": "uuid", "length": 255, "required": true, "related": "createZone,listZones,listZones" }, { "name": "url", "description": "URL of the traffic monitor Host", "type": "string", "length": 255, "required": true }, { "name": "includezones", "description": "Traffic going into the listed zones will be metered", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "zoneid", "description": "the zone ID of the external firewall", "type": "string" }, { }, { }, { "name": "ipaddress", "description": "the management IP address of the external firewall", "type": "string" }, { "name": "id", "description": "the ID of the external firewall", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "timeout", "description": "the timeout (in seconds) for requests to the external firewall", "type": "string" }, { "name": "numretries", "description": "the number of times to retry requests to the external firewall", "type": "string" } ] }, { "name": "updateProject", "description": "Updates a project", "since": "3.0.0", "isasync": true, "related": "activateProject,suspendProject", "params": [ { "name": "id", "description": "id of the project to be modified", "type": "uuid", "length": 255, "required": true, "related": "activateProject,updateProject,suspendProject" }, { "name": "account", "description": "new Admin account for the project", "type": "string", "length": 255, "required": false }, { "name": "displaytext", "description": "display text of the project", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this project", "type": "string" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this project", "type": "long" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this project", "type": "integer" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by project", "type": "long" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this project", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the project can own", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the project can own", "type": "string" }, { "name": "projectaccountname", "description": "the project account name of the project", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this project to acquire", "type": "string" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this project", "type": "string" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this project", "type": "integer" }, { "name": "account", "description": "the account name of the project's owner", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the project", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this project", "type": "long" }, { "name": "tags", "description": "the list of resource tags associated with vm", "type": "list", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this project", "type": "string" }, { "name": "id", "description": "the id of the project", "type": "string" }, { }, { "name": "state", "description": "the state of the project", "type": "string" }, { "name": "memorylimit", "description": "the total memory (in MB) the project can own", "type": "string" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this project to acquire", "type": "string" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by project", "type": "long" }, { "name": "volumetotal", "description": "the total volume being used by this project", "type": "long" }, { "name": "vpclimit", "description": "the total number of vpcs the project can own", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by project", "type": "float" }, { "name": "name", "description": "the name of the project", "type": "string" }, { "name": "domainid", "description": "the domain id the project belongs to", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by project", "type": "long" }, { "name": "volumeavailable", "description": "the total volume available for this project", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "networktotal", "description": "the total number of networks owned by project", "type": "long" }, { "name": "iplimit", "description": "the total number of public ip addresses this project can acquire", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this project", "type": "string" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this project", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this project", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by project", "type": "long" }, { "name": "domain", "description": "the domain name where the project belongs to", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this project", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this project", "type": "long" }, { "name": "networklimit", "description": "the total number of networks the project can own", "type": "string" }, { "name": "volumelimit", "description": "the total volume which can be used by this project", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the project can own", "type": "string" }, { }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this project", "type": "long" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this project", "type": "string" } ] }, { "name": "listLoadBalancers", "description": "Lists load balancers", "since": "4.2.0", "isasync": false, "related": "createLoadBalancer", "params": [ { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "name", "description": "the name of the load balancer", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "sourceipaddress", "description": "the source IP address of the load balancer", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the ID of the load balancer", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "networkid", "description": "the network ID of the load balancer", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork" }, { "name": "sourceipaddressnetworkid", "description": "the network ID of the source IP address", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "scheme", "description": "the scheme of the load balancer. Supported value is internal in the current release", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "project", "description": "the project name of the Load Balancer", "type": "string" }, { "name": "sourceipaddressnetworkid", "description": "Load Balancer source ip network id", "type": "string" }, { }, { "name": "account", "description": "the account of the Load Balancer", "type": "string" }, { "name": "networkid", "description": "Load Balancer network id", "type": "string" }, { "name": "algorithm", "description": "the load balancer algorithm (source, roundrobin, leastconn)", "type": "string" }, { "name": "loadbalancerinstance", "description": "the list of instances associated with the Load Balancer", "type": "list", "response": [ { "name": "name", "description": "the name of the instance", "type": "string" }, { "name": "state", "description": "the state of the instance", "type": "string" }, { "name": "id", "description": "the instance ID", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the instance", "type": "string" } ] }, { "name": "id", "description": "the Load Balancer ID", "type": "string" }, { }, { "name": "name", "description": "the name of the Load Balancer", "type": "string" }, { "name": "sourceipaddress", "description": "Load Balancer source ip", "type": "string" }, { "name": "description", "description": "the description of the Load Balancer", "type": "string" }, { "name": "projectid", "description": "the project id of the Load Balancer", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the Load Balancer", "type": "list", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the domain ID of the Load Balancer", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domain", "description": "the domain of the Load Balancer", "type": "string" }, { "name": "loadbalancerrule", "description": "the list of rules associated with the Load Balancer", "type": "list", "response": [ { "name": "instanceport", "description": "instance port of the load balancer rule", "type": "integer" }, { "name": "state", "description": "the state of the load balancer rule", "type": "string" }, { "name": "sourceport", "description": "source port of the load balancer rule", "type": "integer" } ] } ] }, { "name": "deleteLBStickinessPolicy", "description": "Deletes a load balancer stickiness policy.", "since": "3.0.0", "isasync": true, "params": [ { "name": "id", "description": "the ID of the LB stickiness policy", "type": "uuid", "length": 255, "required": true, "related": "createLBStickinessPolicy,listLBStickinessPolicies" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "registerUserKeys", "description": "This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user", "isasync": false, "related": "", "params": [ { "name": "id", "description": "User id", "type": "uuid", "length": 255, "required": true, "related": "getUser,enableUser,listUsers,createUser,disableUser" } ], "response": [ { "name": "apikey", "description": "the api key of the registered user", "type": "string" }, { }, { "name": "secretkey", "description": "the secret key of the registered user", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listUsers", "description": "Lists user accounts", "isasync": false, "related": "getUser,enableUser,createUser,disableUser", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "id", "description": "List user by ID.", "type": "uuid", "length": 255, "required": false, "related": "getUser,enableUser,listUsers,createUser,disableUser" }, { "name": "username", "description": "List user by the username", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "accounttype", "description": "List users by account type. Valid types include admin, domain-admin, read-only-admin, or user.", "type": "long", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "state", "description": "List users by state of the user account.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" } ] }, { "name": "listVpnConnections", "description": "Lists site to site vpn connection gateways", "isasync": false, "related": "createVpnConnection", "params": [ { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "id", "description": "id of the vpn connection", "type": "uuid", "length": 255, "required": false, "related": "createVpnConnection,listVpnConnections" }, { "name": "vpcid", "description": "id of vpc", "type": "uuid", "length": 255, "required": false, "related": "migrateVPC,listVPCs,createVPC,updateVPC" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "project", "description": "the project name", "type": "string" }, { }, { "name": "s2scustomergatewayid", "description": "the customer gateway ID", "type": "string" }, { "name": "ikelifetime", "description": "Lifetime of IKE SA of customer gateway", "type": "long" }, { "name": "passive", "description": "State of vpn connection", "type": "boolean" }, { "name": "projectid", "description": "the project id", "type": "string" }, { "name": "domainid", "description": "the domain id of the owner", "type": "string" }, { "name": "state", "description": "State of vpn connection", "type": "string" }, { "name": "publicip", "description": "the public IP address", "type": "string" }, { "name": "esplifetime", "description": "Lifetime of ESP SA of customer gateway", "type": "long" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "forceencap", "description": "if Force NAT Encapsulation is enabled for customer gateway", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "dpd", "description": "if DPD is enabled for customer gateway", "type": "boolean" }, { "name": "account", "description": "the owner", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "fordisplay", "description": "is connection for display to the regular user", "type": "boolean" }, { "name": "id", "description": "the connection ID", "type": "string" }, { "name": "gateway", "description": "public ip address id of the customer gateway", "type": "string" }, { "name": "cidrlist", "description": "guest cidr list of the customer gateway", "type": "string" }, { "name": "ipsecpsk", "description": "IPsec Preshared-Key of the customer gateway", "type": "string" }, { "name": "s2svpngatewayid", "description": "the vpn gateway ID", "type": "string" }, { }, { "name": "esppolicy", "description": "ESP policy of the customer gateway", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "ikepolicy", "description": "IKE policy of the customer gateway", "type": "string" } ] }, { "name": "listResourceLimits", "description": "Lists resource limits.", "isasync": false, "related": "", "params": [ { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "resourcetype", "description": "Type of resource. Values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 and 11. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses an account can own. 2 - Volume. Number of disk volumes an account can own. 3 - Snapshot. Number of snapshots an account can own. 4 - Template. Number of templates an account can register/create. 5 - Project. Number of projects an account can own. 6 - Network. Number of networks an account can own. 7 - VPC. Number of VPC an account can own. 8 - CPU. Number of CPU an account can allocate for his resources. 9 - Memory. Amount of RAM an account can allocate for his resources. 10 - PrimaryStorage. Total primary storage space (in GiB) a user can use. 11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. ", "type": "integer", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "resourcetypename", "description": "Type of resource (wins over resourceType if both are provided). Values are: user_vm - Instance. Number of instances a user can create. public_ip - IP. Number of public IP addresses an account can own. volume - Volume. Number of disk volumes an account can own. snapshot - Snapshot. Number of snapshots an account can own. template - Template. Number of templates an account can register/create. project - Project. Number of projects an account can own. network - Network. Number of networks an account can own. vpc - VPC. Number of VPC an account can own. cpu - CPU. Number of CPU an account can allocate for his resources. memory - Memory. Amount of RAM an account can allocate for his resources. primary_storage - PrimaryStorage. Total primary storage space (in GiB) a user can use. secondary_storage - SecondaryStorage. Total secondary storage space (in GiB) a user can use. ", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "Lists resource limits by ID.", "type": "long", "length": 255, "required": false } ], "response": [ { "name": "projectid", "description": "the project id of the resource limit", "type": "string" }, { "name": "domain", "description": "the domain name of the resource limit", "type": "string" }, { "name": "resourcetypename", "description": "resource type name. Values include user_vm, public_ip, volume, snapshot, template, project, network, vpc, cpu, memory, primary_storage, secondary_storage.", "type": "string" }, { "name": "account", "description": "the account of the resource limit", "type": "string" }, { "name": "max", "description": "the maximum number of the resource. A -1 means the resource currently has no limit.", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "resourcetype", "description": "resource type. Values include 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.", "type": "string" }, { "name": "domainid", "description": "the domain ID of the resource limit", "type": "string" }, { }, { }, { "name": "project", "description": "the project name of the resource limit", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "disableUser", "description": "Disables a user account", "isasync": true, "related": "getUser,enableUser,createUser", "params": [ { "name": "id", "description": "Disables user by user ID.", "type": "uuid", "length": 255, "required": true, "related": "getUser,enableUser,createUser,disableUser" } ], "response": [ { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" } ] }, { "name": "listIsos", "description": "Lists all available ISO files.", "isasync": false, "related": "registerTemplate,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates", "params": [ { "name": "showremoved", "description": "show removed ISOs as well", "type": "boolean", "length": 255, "required": false }, { "name": "isready", "description": "true if this ISO is ready to be deployed", "type": "boolean", "length": 255, "required": false }, { "name": "name", "description": "list all ISOs by name", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "list ISO by ID", "type": "uuid", "length": 255, "required": false, "related": "listIsos,registerTemplate,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "ispublic", "description": "true if the ISO is publicly available to all users, false otherwise.", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "zoneid", "description": "the ID of the zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones,listZones" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "isofilter", "description": "possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins).", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "hypervisor", "description": "the hypervisor for which to restrict the search", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "project", "description": "the project name of the template", "type": "string" }, { "name": "accountid", "description": "the account id to which the template belongs", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "created", "description": "the date this template was created", "type": "date" }, { "name": "ostypename", "description": "the name of the OS type for this template.", "type": "string" }, { "name": "details", "description": "additional key/value details tied with template", "type": "map" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "physicalsize", "description": "the physical size of the template", "type": "long" }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" }, { "name": "zoneid", "description": "the ID of the zone for this template", "type": "string" }, { "name": "ostypeid", "description": "the ID of the OS type for this template.", "type": "string" }, { "name": "childtemplates", "description": "if root disk template, then ids of the datas disk templates this template owns", "type": "set" }, { "name": "sourcetemplateid", "description": "the template ID of the parent template if present", "type": "string" }, { "name": "checksum", "description": "checksum of the template", "type": "string" }, { "name": "zonename", "description": "the name of the zone for this template", "type": "string" }, { "name": "status", "description": "the status of the template", "type": "string" }, { "name": "projectid", "description": "the project id of the template", "type": "string" }, { "name": "hostname", "description": "the name of the secondary storage host for the template", "type": "string" }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean" }, { "name": "format", "description": "the format of the template.", "type": "imageformat" }, { }, { "name": "domain", "description": "the name of the domain to which the template belongs", "type": "string" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { "name": "templatetag", "description": "the tag of this template", "type": "string" }, { "name": "passwordenabled", "description": "true if the reset password feature is enabled, false otherwise", "type": "boolean" }, { "name": "displaytext", "description": "the template display text", "type": "string" }, { }, { "name": "isready", "description": "true if the template is ready to be deployed from, false otherwise.", "type": "boolean" }, { "name": "size", "description": "the size of the template", "type": "long" }, { "name": "bits", "description": "the processor bit size", "type": "int" }, { "name": "templatetype", "description": "the type of the template", "type": "string" }, { "name": "isextractable", "description": "true if the template is extractable, false otherwise", "type": "boolean" }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "name", "description": "the template name", "type": "string" }, { "name": "parenttemplateid", "description": "if Datadisk template, then id of the root disk template this template belongs to", "type": "string" }, { "name": "requireshvm", "description": "true if template requires HVM enabled, false otherwise", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "account", "description": "the account name to which the template belongs", "type": "string" }, { "name": "crossZones", "description": "true if the template is managed across all Zones, false otherwise", "type": "boolean" }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "removed", "description": "the date this template was removed", "type": "date" }, { "name": "sshkeyenabled", "description": "true if template is sshkey enabled, false otherwise", "type": "boolean" }, { "name": "hostid", "description": "the ID of the secondary storage host for the template", "type": "string" }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean" }, { "name": "directdownload", "description": "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage", "type": "boolean" } ] }, { "name": "updateCloudToUseObjectStore", "description": "Migrate current NFS secondary storages to use object store.", "since": "4.3.0", "isasync": false, "related": "listImageStores,listSwifts,addImageStoreS3", "params": [ { "name": "details", "description": "the details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss", "type": "map", "length": 255, "required": false }, { "name": "url", "description": "the URL for the image store", "type": "string", "length": 255, "required": false }, { "name": "provider", "description": "the image store provider name", "type": "string", "length": 255, "required": true }, { "name": "name", "description": "the name for the image store", "type": "string", "length": 255, "required": false } ], "response": [ { }, { }, { "name": "protocol", "description": "the protocol of the image store", "type": "string" }, { "name": "scope", "description": "the scope of the image store", "type": "scopetype" }, { "name": "url", "description": "the url of the image store", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "providername", "description": "the provider name of the image store", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the image store", "type": "string" }, { "name": "zonename", "description": "the Zone name of the image store", "type": "string" }, { "name": "id", "description": "the ID of the image store", "type": "string" }, { "name": "name", "description": "the name of the image store", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listAutoScalePolicies", "description": "Lists autoscale policies.", "isasync": false, "related": "", "params": [ { "name": "id", "description": "the ID of the autoscale policy", "type": "uuid", "length": 255, "required": false, "related": "listAutoScalePolicies" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "vmgroupid", "description": "the ID of the autoscale vm group", "type": "uuid", "length": 255, "required": false, "related": "listAutoScaleVmGroups" }, { "name": "action", "description": "the action to be executed if all the conditions evaluate to true for the specified duration.", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "conditionid", "description": "the ID of the condition of the policy", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "conditions", "description": "the list of IDs of the conditions that are being evaluated on every interval", "type": "list" }, { "name": "action", "description": "the action to be executed if all the conditions evaluate to true for the specified duration.", "type": "string" }, { "name": "projectid", "description": "the project id autoscale policy", "type": "string" }, { "name": "account", "description": "the account owning the autoscale policy", "type": "string" }, { "name": "domainid", "description": "the domain ID of the autoscale policy", "type": "string" }, { "name": "quiettime", "description": "the cool down period for which the policy should not be evaluated after the action has been taken", "type": "integer" }, { "name": "project", "description": "the project name of the autoscale policy", "type": "string" }, { "name": "id", "description": "the autoscale policy ID", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domain", "description": "the domain name of the autoscale policy", "type": "string" }, { "name": "duration", "description": "the duration for which the conditions have to be true before action is taken", "type": "integer" } ] }, { "name": "listNuageVspGlobalDomainTemplate", "description": "Lists Nuage VSP domain templates", "since": "4.11.0", "isasync": false, "related": "", "params": [ ], "response": [ { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "addBaremetalRct", "description": "adds baremetal rack configuration text", "isasync": true, "related": "", "params": [ { "name": "baremetalrcturl", "description": "http url to baremetal RCT configuration", "type": "object", "length": 255, "required": true } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "url", "description": "url", "type": "string" }, { "name": "id", "description": "id of rct", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "updateRole", "description": "Updates a role", "since": "4.9.0", "isasync": false, "related": "listRoles", "params": [ { "name": "description", "description": "The description of the role", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "ID of the role", "type": "uuid", "length": 255, "required": true, "related": "updateRole,listRoles" }, { "name": "name", "description": "creates a role with this unique name", "type": "string", "length": 255, "required": false }, { "name": "type", "description": "The type of the role, valid options are: Admin, ResourceAdmin, DomainAdmin, User", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "description", "description": "the description of the role", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "name", "description": "the name of the role", "type": "string" }, { "name": "id", "description": "the ID of the role", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "type", "description": "the type of the role", "type": "string" } ] }, { "name": "listZones", "description": "Lists zones", "isasync": false, "related": "createZone,listZones", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "tags", "description": "List zones by resource tags (key/value pairs)", "type": "map", "length": 255, "required": false, "since": "4.3" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the ID of the domain associated with the zone", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "id", "description": "the ID of the zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones,listZones" }, { "name": "showcapacities", "description": "flag to display the capacity of the zones", "type": "boolean", "length": 255, "required": false }, { "name": "networktype", "description": "the network type of the zone that the virtual machine belongs to", "type": "string", "length": 255, "required": false }, { "name": "available", "description": "true if you want to retrieve all available Zones. False if you only want to return the Zones from which you have at least one VM. Default is false.", "type": "boolean", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "the name of the zone", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "domain", "description": "Network domain name for the networks in the zone", "type": "string" }, { "name": "dns2", "description": "the second DNS for the Zone", "type": "string" }, { "name": "id", "description": "Zone id", "type": "string" }, { "name": "guestcidraddress", "description": "the guest CIDR address for the Zone", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with zone.", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "domainname", "description": "the name of the containing domain, null for public zones", "type": "string" }, { "name": "dhcpprovider", "description": "the dhcp Provider for the Zone", "type": "string" }, { "name": "internaldns2", "description": "the second internal DNS for the Zone", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the Zone", "type": "string" }, { }, { "name": "dns1", "description": "the first DNS for the Zone", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "description", "description": "Zone description", "type": "string" }, { }, { "name": "zonetoken", "description": "Zone Token", "type": "string" }, { "name": "displaytext", "description": "the display text of the zone", "type": "string" }, { "name": "name", "description": "Zone name", "type": "string" }, { "name": "allocationstate", "description": "the allocation state of the cluster", "type": "string" }, { "name": "securitygroupsenabled", "description": "true if security groups support is enabled, false otherwise", "type": "boolean" }, { "name": "capacity", "description": "the capacity of the Zone", "type": "list", "response": [ { "name": "name", "description": "the capacity name", "type": "string" }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" } ] }, { "name": "localstorageenabled", "description": "true if local storage offering enabled, false otherwise", "type": "boolean" }, { "name": "internaldns1", "description": "the first internal DNS for the Zone", "type": "string" }, { "name": "domainid", "description": "the UUID of the containing domain, null for public zones", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the Zone", "type": "string" }, { "name": "networktype", "description": "the network type of the zone; can be Basic or Advanced", "type": "string" }, { "name": "resourcedetails", "description": "Meta data associated with the zone (key/value pairs)", "type": "map" } ] }, { "name": "listRemoteAccessVpns", "description": "Lists remote access vpns", "isasync": false, "related": "updateRemoteAccessVpn", "params": [ { "name": "id", "description": "Lists remote access vpn rule with the specified ID", "type": "uuid", "length": 255, "required": false, "since": "4.3", "related": "updateRemoteAccessVpn,listRemoteAccessVpns" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "publicipid", "description": "public ip address id of the vpn server", "type": "uuid", "length": 255, "required": false, "related": "updateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "networkid", "description": "list remote access VPNs for ceratin network", "type": "uuid", "length": 255, "required": false, "since": "4.3", "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" } ], "response": [ { "name": "domain", "description": "the domain name of the account of the remote access vpn", "type": "string" }, { "name": "id", "description": "the id of the remote access vpn", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "iprange", "description": "the range of ips to allocate to the clients", "type": "string" }, { "name": "domainid", "description": "the domain id of the account of the remote access vpn", "type": "string" }, { "name": "account", "description": "the account of the remote access vpn", "type": "string" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "publicipid", "description": "the public ip address of the vpn server", "type": "string" }, { }, { "name": "presharedkey", "description": "the ipsec preshared key", "type": "string" }, { "name": "publicip", "description": "the public ip address of the vpn server", "type": "string" }, { "name": "fordisplay", "description": "is vpn for display to the regular user", "type": "boolean" } ] }, { "name": "deleteNetworkACLList", "description": "Deletes a network ACL", "isasync": true, "params": [ { "name": "id", "description": "the ID of the network ACL", "type": "uuid", "length": 255, "required": true, "related": "createNetworkACLList" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "createServiceInstance", "description": "Creates a system virtual-machine that implements network services", "isasync": true, "related": "", "params": [ { "name": "rightnetworkid", "description": "The right (outside) network ID for the service instance", "type": "uuid", "length": 255, "required": true, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork" }, { "name": "name", "description": "The name of the service instance", "type": "string", "length": 255, "required": true }, { "name": "serviceofferingid", "description": "The service offering ID that defines the resources consumed by the service appliance", "type": "uuid", "length": 255, "required": true, "related": "listServiceOfferings,updateServiceOffering" }, { "name": "account", "description": "An optional account for the virtual machine. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "An optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "projectid", "description": "Project ID for the service instance", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "templateid", "description": "The template ID that specifies the image for the service appliance", "type": "uuid", "length": 255, "required": true, "related": "registerTemplate,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "leftnetworkid", "description": "The left (inside) network for service instance", "type": "uuid", "length": 255, "required": true, "related": "migrateNetwork,listNetscalerLoadBalancerNetworks,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork" }, { "name": "zoneid", "description": "Availability zone for the service instance", "type": "uuid", "length": 255, "required": true, "related": "createZone,listZones" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" } ] }, { "name": "removeIpFromNic", "description": "Removes secondary IP from the NIC.", "isasync": true, "params": [ { "name": "id", "description": "the ID of the secondary ip address to nic", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "releasePublicIpRange", "description": "Releases a Public IP range back to the system pool", "isasync": false, "params": [ { "name": "id", "description": "the id of the Public IP range", "type": "uuid", "length": 255, "required": true, "related": "dedicatePublicIpRange" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listNetscalerLoadBalancerNetworks", "description": "lists network that are using a netscaler load balancer device", "isasync": false, "related": "migrateNetwork,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork", "params": [ { "name": "lbdeviceid", "description": "netscaler load balancer device ID", "type": "uuid", "length": 255, "required": true, "related": "addNetscalerLoadBalancer,listNetscalerLoadBalancers,registerNetscalerControlCenter" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "name", "description": "the service name", "type": "string" }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" } ] }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" } ] } ] }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" }, { }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" } ] }, { "name": "startSystemVm", "description": "Starts a system virtual machine.", "isasync": true, "related": "migrateSystemVm", "params": [ { "name": "id", "description": "The ID of the system virtual machine", "type": "uuid", "length": 255, "required": true, "related": "migrateSystemVm,startSystemVm" } ], "response": [ { "name": "state", "description": "the state of the system VM", "type": "string" }, { "name": "name", "description": "the name of the system VM", "type": "string" }, { "name": "privatenetmask", "description": "the private netmask for the system VM", "type": "string" }, { "name": "dns1", "description": "the first DNS for the system VM", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the system VM", "type": "string" }, { "name": "hostid", "description": "the host ID for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "integer" }, { }, { "name": "publicip", "description": "the public IP address for the system VM", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the system vm", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobid", "description": "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "string" }, { "name": "dns2", "description": "the second DNS for the system VM", "type": "string" }, { "name": "privatemacaddress", "description": "the private MAC address for the system VM", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the system vm", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the system VM", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the system vm", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the system VM", "type": "string" }, { "name": "zonename", "description": "the Zone name for the system VM", "type": "string" }, { "name": "podid", "description": "the Pod ID for the system VM", "type": "string" }, { "name": "hostname", "description": "the hostname for the system VM", "type": "string" }, { }, { "name": "zoneid", "description": "the Zone ID for the system VM", "type": "string" }, { "name": "gateway", "description": "the gateway for the system VM", "type": "string" }, { "name": "privateip", "description": "the private IP address for the system VM", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "created", "description": "the date and time the system VM was created", "type": "date" }, { "name": "templateid", "description": "the template ID for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "activeviewersessions", "description": "the number of active console sessions for the console proxy system vm", "type": "integer" }, { "name": "id", "description": "the ID of the system VM", "type": "string" }, { "name": "publicvlan", "description": "public vlan range", "type": "list" }, { "name": "systemvmtype", "description": "the system VM type", "type": "string" }, { "name": "guestvlan", "description": "guest vlan range", "type": "string" } ] }, { "name": "listNetworkIsolationMethods", "description": "Lists supported methods of network isolation", "since": "4.2.0", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "name", "description": "Network isolation method name", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listHostHAResources", "description": "Lists host HA resources", "since": "4.11", "isasync": false, "related": "listHostHAProviders,enableHAForHost,configureHAForHost,disableHAForHost", "params": [ { "name": "hostid", "description": "List by host ID", "type": "uuid", "length": 255, "required": false, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "haprovider", "description": "the host HA provider", "type": "string" }, { }, { "name": "status", "description": "operation status", "type": "boolean" }, { "name": "hastate", "description": "the HA state of the host", "type": "hastate" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "haenable", "description": "if host HA is enabled for the host", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listStorageNetworkIpRange", "description": "List a storage network IP range.", "since": "3.0.0", "isasync": false, "related": "createStorageNetworkIpRange", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "optional parameter. Storaget network IP range uuid, if specicied, using it to search the range.", "type": "uuid", "length": 255, "required": false, "related": "createStorageNetworkIpRange,listStorageNetworkIpRange" }, { "name": "podid", "description": "optional parameter. Pod uuid, if specicied and range uuid is absent, using it to search the range.", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "optional parameter. Zone uuid, if specicied and both pod uuid and range uuid are absent, using it to search the range.", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones" } ], "response": [ { "name": "zoneid", "description": "the Zone uuid of the storage network IP range", "type": "string" }, { "name": "podid", "description": "the Pod uuid for the storage network IP range", "type": "string" }, { "name": "netmask", "description": "the netmask of the storage network IP range", "type": "string" }, { "name": "endip", "description": "the end ip of the storage network IP range", "type": "string" }, { "name": "gateway", "description": "the gateway of the storage network IP range", "type": "string" }, { }, { "name": "startip", "description": "the start ip of the storage network IP range", "type": "string" }, { "name": "vlan", "description": "the ID or VID of the VLAN.", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "networkid", "description": "the network uuid of storage network IP range", "type": "string" }, { "name": "id", "description": "the uuid of storage network IP range.", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "enableHAForHost", "description": "Enables HA for a host", "since": "4.11", "isasync": true, "related": "listHostHAProviders,configureHAForHost,disableHAForHost", "params": [ { "name": "hostid", "description": "ID of the host", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hastate", "description": "the HA state of the host", "type": "hastate" }, { "name": "haenable", "description": "if host HA is enabled for the host", "type": "boolean" }, { "name": "status", "description": "operation status", "type": "boolean" }, { "name": "haprovider", "description": "the host HA provider", "type": "string" } ] }, { "name": "configureVirtualRouterElement", "description": "Configures a virtual router element.", "isasync": true, "related": "listVirtualRouterElements", "params": [ { "name": "id", "description": "the ID of the virtual router provider", "type": "uuid", "length": 255, "required": true, "related": "configureVirtualRouterElement,listVirtualRouterElements" }, { "name": "enabled", "description": "Enabled/Disabled the service provider", "type": "boolean", "length": 255, "required": true } ], "response": [ { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "domainid", "description": "the domain ID associated with the provider", "type": "string" }, { "name": "nspid", "description": "the physical network service provider id of the provider", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { }, { "name": "domain", "description": "the domain associated with the provider", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "enabled", "description": "Enabled/Disabled the service provider", "type": "boolean" }, { "name": "account", "description": "the account associated with the provider", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "deleteDomain", "description": "Deletes a specified domain", "isasync": true, "params": [ { "name": "id", "description": "ID of domain to delete", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomainChildren" }, { "name": "cleanup", "description": "true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { } ] }, { "name": "migrateVolume", "description": "Migrate volume", "since": "3.0.0", "isasync": true, "related": "createVolume,createVolume,listVolumes,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume", "params": [ { "name": "storageid", "description": "destination storage pool ID to migrate the volume to", "type": "uuid", "length": 255, "required": true, "related": "findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "livemigrate", "description": "if the volume should be live migrated when it is attached to a running vm", "type": "boolean", "length": 255, "required": false }, { "name": "volumeid", "description": "the ID of the volume", "type": "uuid", "length": 255, "required": true, "related": "createVolume,createVolume,listVolumes,migrateVolume,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "newdiskofferingid", "description": "The new disk offering ID that replaces the current one used by the volume. This new disk offering is used to better reflect the new storage where the volume is going to be migrated to.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk volume", "type": "long" }, { "name": "maxiops", "description": "max iops of the disk volume", "type": "long" }, { "name": "name", "description": "name of the disk volume", "type": "string" }, { "name": "storagetype", "description": "shared or local storage", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk volume", "type": "long" }, { "name": "miniops", "description": "min iops of the disk volume", "type": "long" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk volume", "type": "long" }, { "name": "id", "description": "ID of the disk volume", "type": "string" }, { "name": "utilization", "description": "the disk utilization", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "storage", "description": "name of the primary storage hosting the disk volume", "type": "string" }, { "name": "clustername", "description": "cluster name where the volume is allocated", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "created", "description": "the date the disk volume was created", "type": "date" }, { "name": "serviceofferingdisplaytext", "description": "the display text of the service offering for root disk", "type": "string" }, { "name": "size", "description": "size of the disk volume", "type": "long" }, { "name": "zonename", "description": "name of the availability zone", "type": "string" }, { "name": "state", "description": "the state of the disk volume", "type": "string" }, { "name": "status", "description": "the status of the volume", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "hypervisor", "description": "Hypervisor the volume belongs to", "type": "string" }, { "name": "zoneid", "description": "ID of the availability zone", "type": "string" }, { "name": "serviceofferingname", "description": "name of the service offering for root disk", "type": "string" }, { "name": "podname", "description": "pod name of the volume", "type": "string" }, { "name": "podid", "description": "pod id of the volume", "type": "string" }, { "name": "deviceid", "description": "the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached.", "type": "long" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "diskofferingname", "description": "name of the disk offering", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "vmstate", "description": "state of the virtual machine", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { }, { "name": "serviceofferingid", "description": "ID of the service offering for root disk", "type": "string" }, { "name": "virtualsize", "description": "the bytes actually consumed on disk", "type": "long" }, { "name": "quiescevm", "description": "need quiesce vm or not when taking snapshot", "type": "boolean" }, { "name": "attached", "description": "the date the volume was attached to a VM instance", "type": "date" }, { "name": "snapshotid", "description": "ID of the snapshot from which this volume was created", "type": "string" }, { "name": "storageid", "description": "id of the primary storage hosting the disk volume; returned to admin user only", "type": "string" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk volume", "type": "long" }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "diskofferingdisplaytext", "description": "the display text of the disk offering", "type": "string" }, { "name": "isextractable", "description": "true if the volume is extractable, false otherwise", "type": "boolean" }, { "name": "vmname", "description": "name of the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "displayvolume", "description": "an optional field whether to the display the volume to the end user or not.", "type": "boolean" }, { }, { "name": "type", "description": "type of the disk volume (ROOT or DATADISK)", "type": "string" }, { "name": "chaininfo", "description": "the chain info of the volume", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "vmdisplayname", "description": "display name of the virtual machine", "type": "string" }, { "name": "virtualmachineid", "description": "id of the virtual machine", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "clusterid", "description": "cluster id of the volume", "type": "string" }, { "name": "diskofferingid", "description": "ID of the disk offering", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "path", "description": "the path of the volume", "type": "string" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes.", "type": "string" }, { "name": "physicalsize", "description": "the bytes alloaated", "type": "long" }, { "name": "destroyed", "description": "the boolean state of whether the volume is destroyed or not", "type": "boolean" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" } ] }, { "name": "listEvents", "description": "A command to list events.", "isasync": false, "related": "", "params": [ { "name": "duration", "description": "the duration of the event", "type": "integer", "length": 255, "required": false }, { "name": "level", "description": "the event level (INFO, WARN, ERROR)", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "startdate", "description": "the start date range of the list you want to retrieve (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")", "type": "date", "length": 255, "required": false }, { "name": "startid", "description": "the parent/start ID of the event, when provided this will list all the events with the start/parent ID including the parent event", "type": "uuid", "length": 255, "required": false, "related": "listEvents" }, { "name": "type", "description": "the event type (see event types)", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "the ID of the event", "type": "uuid", "length": 255, "required": false, "related": "listEvents" }, { "name": "entrytime", "description": "the time the event was entered", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "enddate", "description": "the end date range of the list you want to retrieve (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")", "type": "date", "length": 255, "required": false } ], "response": [ { "name": "level", "description": "the event level (INFO, WARN, ERROR)", "type": "string" }, { }, { "name": "description", "description": "a brief description of the event", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "domain", "description": "the name of the account's domain", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "id", "description": "the ID of the event", "type": "string" }, { }, { "name": "domainid", "description": "the id of the account's domain", "type": "string" }, { "name": "created", "description": "the date the event was created", "type": "date" }, { "name": "parentid", "description": "whether the event is parented", "type": "string" }, { "name": "state", "description": "the state of the event", "type": "state" }, { "name": "username", "description": "the name of the user who performed the action (can be different from the account if an admin is performing an action for a user, e.g. starting/stopping a user's virtual machine)", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "account", "description": "the account name for the account that owns the object being acted on in the event (e.g. the owner of the virtual machine, ip address, or security group)", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "type", "description": "the type of the event (see event types)", "type": "string" } ] }, { "name": "listHostHAProviders", "description": "Lists HA providers", "since": "4.11", "isasync": false, "related": "configureHAForHost,disableHAForHost", "params": [ { "name": "hypervisor", "description": "Hypervisor type of the resource", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "status", "description": "operation status", "type": "boolean" }, { "name": "haprovider", "description": "the host HA provider", "type": "string" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "haenable", "description": "if host HA is enabled for the host", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hastate", "description": "the HA state of the host", "type": "hastate" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "updateVMAffinityGroup", "description": "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect.", "isasync": true, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "affinitygroupids", "description": "comma separated list of affinity groups id that are going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupnames parameter", "type": "list", "length": 255, "required": false, "related": "" }, { "name": "affinitygroupnames", "description": "comma separated list of affinity groups names that are going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter", "type": "list", "length": 255, "required": false, "related": "" }, { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,updateVMAffinityGroup,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" } ] }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] } ] }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" } ] }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" } ] }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" } ] }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" } ] }, { "name": "registerNetscalerServicePackage", "description": "Registers NCC Service Package", "isasync": false, "related": "listRegisteredServicePackages", "params": [ { "name": "description", "description": "Description of Service Package", "type": "string", "length": 255, "required": true }, { "name": "name", "description": "Name of the service Package.", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "description", "description": "Description of Service Package", "type": "string" }, { }, { "name": "id", "description": "Service Package UUID", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "name", "description": "Service Package Name", "type": "string" } ] }, { "name": "createTags", "description": "Creates resource tag(s)", "since": "4.0.0", "isasync": true, "params": [ { "name": "tags", "description": "Map of tags (key/value pairs)", "type": "map", "length": 255, "required": true }, { "name": "customer", "description": "identifies client specific tag. When the value is not null, the tag can't be used by cloudStack code internally", "type": "string", "length": 255, "required": false }, { "name": "resourcetype", "description": "type of the resource", "type": "string", "length": 255, "required": true }, { "name": "resourceids", "description": "list of resources to create the tags for", "type": "list", "length": 255, "required": true } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listCaCertificate", "description": "Lists the CA public certificate(s) as support by the configured/provided CA plugin", "since": "4.11.0", "isasync": false, "related": "", "params": [ { "name": "provider", "description": "Name of the CA service provider, otherwise the default configured provider plugin will be used", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "privatekey", "description": "Private key for the certificate", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "certificate", "description": "The client certificate", "type": "string" }, { "name": "cacertificates", "description": "The CA certificate(s)", "type": "string" } ] }, { "name": "createInternalLoadBalancerElement", "description": "Create an Internal Load Balancer element.", "since": "4.2.0", "isasync": true, "related": "configureInternalLoadBalancerElement", "params": [ { "name": "nspid", "description": "the network service provider ID of the internal load balancer element", "type": "uuid", "length": 255, "required": true, "related": "listNetworkServiceProviders" } ], "response": [ { "name": "id", "description": "the id of the internal load balancer element", "type": "string" }, { "name": "nspid", "description": "the physical network service provider id of the element", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "enabled", "description": "Enabled/Disabled the element", "type": "boolean" } ] }, { "name": "resetApiLimit", "description": "Reset api count", "isasync": false, "related": "getApiLimit", "params": [ { "name": "account", "description": "the ID of the acount whose limit to be reset", "type": "uuid", "length": 255, "required": false, "related": "enableAccount,listAccounts,listAccounts" } ], "response": [ { "name": "apiAllowed", "description": "currently allowed number of apis", "type": "int" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "expireAfter", "description": "seconds left to reset counters", "type": "long" }, { "name": "accountid", "description": "the account uuid of the api remaining count", "type": "string" }, { "name": "account", "description": "the account name of the api remaining count", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "apiIssued", "description": "number of api already issued", "type": "int" } ] }, { "name": "deleteVlanIpRange", "description": "Creates a VLAN IP range.", "isasync": false, "params": [ { "name": "id", "description": "the id of the VLAN IP range", "type": "uuid", "length": 255, "required": true, "related": "dedicatePublicIpRange" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "addLdapConfiguration", "description": "Add a new Ldap Configuration", "since": "4.2.0", "isasync": false, "related": "", "params": [ { "name": "port", "description": "Port", "type": "integer", "length": 255, "required": true }, { "name": "hostname", "description": "Hostname", "type": "string", "length": 255, "required": true }, { "name": "domainid", "description": "linked domain", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" } ], "response": [ { }, { "name": "port", "description": "port teh ldap server is running on", "type": "int" }, { "name": "hostname", "description": "name of the host running the ldap server", "type": "string" }, { "name": "domainid", "description": "linked domain", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "generateAlert", "description": "Generates an alert", "since": "4.3", "isasync": true, "params": [ { "name": "zoneid", "description": "Zone id for which alert is generated", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones" }, { "name": "name", "description": "Name of the alert", "type": "string", "length": 255, "required": true }, { "name": "description", "description": "Alert description", "type": "string", "length": 999, "required": true }, { "name": "type", "description": "Type of the alert", "type": "short", "length": 255, "required": true }, { "name": "podid", "description": "Pod id for which alert is generated", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "ldapConfig", "description": "(Deprecated, use addLdapConfiguration) Configure the LDAP context for this site.", "since": "3.0.0", "isasync": false, "related": "ldapRemove", "params": [ { "name": "binddn", "description": "Specify the distinguished name of a user with the search permission on the directory.", "type": "string", "length": 255, "required": false }, { "name": "ssl", "description": "Check Use SSL if the external LDAP server is configured for LDAP over SSL.", "type": "boolean", "length": 255, "required": false }, { "name": "hostname", "description": "Hostname or ip address of the ldap server eg: my.ldap.com", "type": "string", "length": 255, "required": false }, { "name": "queryfilter", "description": "You specify a query filter here, which narrows down the users, who can be part of this domain.", "type": "string", "length": 255, "required": false }, { "name": "port", "description": "Specify the LDAP port if required, default is 389.", "type": "integer", "length": 255, "required": false }, { "name": "listall", "description": "If true return current LDAP configuration", "type": "boolean", "length": 255, "required": false }, { "name": "bindpass", "description": "Enter the password.", "type": "string", "length": 255, "required": false }, { "name": "searchbase", "description": "The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.", "type": "string", "length": 255, "required": false }, { "name": "truststorepass", "description": "Enter the password for trust store.", "type": "string", "length": 255, "required": false }, { "name": "truststore", "description": "Enter the path to trust certificates store.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "ssl", "description": "Check Use SSL if the external LDAP server is configured for LDAP over SSL", "type": "string" }, { }, { }, { "name": "queryfilter", "description": "You specify a query filter here, which narrows down the users, who can be part of this domain", "type": "string" }, { "name": "hostname", "description": "Hostname or ip address of the ldap server eg: my.ldap.com", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "searchbase", "description": "The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com", "type": "string" }, { "name": "bindpass", "description": "DN password", "type": "string" }, { "name": "binddn", "description": "Specify the distinguished name of a user with the search permission on the directory", "type": "string" }, { "name": "port", "description": "Specify the LDAP port if required, default is 389", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "migrateVPC", "description": "moves a vpc to another physical network", "since": "4.11.0", "isasync": true, "related": "listVPCs,createVPC,updateVPC", "params": [ { "name": "resume", "description": "true if previous network migration cmd failed", "type": "boolean", "length": 255, "required": false }, { "name": "vpcid", "description": "the ID of the vpc", "type": "uuid", "length": 255, "required": true, "related": "migrateVPC,listVPCs,createVPC,updateVPC" }, { "name": "vpcofferingid", "description": "vpc offering ID", "type": "uuid", "length": 255, "required": true, "related": "updateVPCOffering" }, { "name": "tiernetworkofferings", "description": "network offering ids for each network in the vpc. Example: tierNetworkOfferings[0].networkId=networkId1&tierNetworkOfferings[0].networkOfferingId=newNetworkofferingId1&tierNetworkOfferings[1].networkId=networkId2&tierNetworkOfferings[1].networkOfferingId=newNetworkofferingId2", "type": "map", "length": 255, "required": false } ], "response": [ { "name": "tags", "description": "the list of resource tags associated with the project", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "vpcofferingid", "description": "vpc offering id the VPC is created from", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "an alternate display text of the VPC.", "type": "string" }, { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "name", "description": "the provider name", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" } ] }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "name", "description": "the capability name", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" } ] }, { "name": "redundantvpcrouter", "description": "if this VPC has redundant router", "type": "boolean" }, { "name": "state", "description": "state of the VPC. Can be Inactive/Enabled", "type": "string" }, { "name": "domainid", "description": "the domain id of the VPC owner", "type": "string" }, { "name": "id", "description": "the id of the VPC", "type": "string" }, { }, { "name": "distributedvpcrouter", "description": "is VPC uses distributed router for one hop forwarding and host based network ACL's", "type": "boolean" }, { "name": "projectid", "description": "the project id of the VPC", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "network", "description": "the list of networks belongign to the VPC", "type": "list", "response": [ { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "name", "description": "the provider name", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" } ] }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" } ] }, { "name": "name", "description": "the service name", "type": "string" } ] }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" } ] }, { "name": "regionlevelvpc", "description": "true if VPC is region level", "type": "boolean" }, { "name": "account", "description": "the owner of the VPC", "type": "string" }, { "name": "restartrequired", "description": "true VPC requires restart", "type": "boolean" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "zonename", "description": "the name of the zone the VPC belongs to", "type": "string" }, { "name": "cidr", "description": "the cidr the VPC", "type": "string" }, { "name": "fordisplay", "description": "is vpc for display to the regular user", "type": "boolean" }, { "name": "name", "description": "the name of the VPC", "type": "string" }, { "name": "project", "description": "the project name of the VPC", "type": "string" }, { }, { "name": "networkdomain", "description": "the network domain of the VPC", "type": "string" }, { "name": "created", "description": "the date this VPC was created", "type": "date" }, { "name": "zoneid", "description": "zone id of the vpc", "type": "string" } ] }, { "name": "deletePortForwardingRule", "description": "Deletes a port forwarding rule", "isasync": true, "params": [ { "name": "id", "description": "the ID of the port forwarding rule", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteGlobalLoadBalancerRule", "description": "Deletes a global load balancer rule.", "isasync": true, "params": [ { "name": "id", "description": "the ID of the global load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listBigSwitchBcfDevices", "description": "Lists BigSwitch BCF Controller devices", "since": "4.6.0", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "bcfdeviceid", "description": "bigswitch BCF controller device ID", "type": "uuid", "length": 255, "required": false, "related": "listBigSwitchBcfDevices" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "provider", "description": "name of the provider", "type": "string" }, { }, { "name": "physicalnetworkid", "description": "the physical network to which this BigSwitch BCF segment belongs to", "type": "string" }, { "name": "bigswitchdevicename", "description": "device name", "type": "string" }, { "name": "hostname", "description": "the controller Ip address", "type": "string" }, { "name": "bcfdeviceid", "description": "device id of the BigSwitch BCF Controller", "type": "string" }, { }, { "name": "password", "description": "the controller password", "type": "string" }, { "name": "username", "description": "the controller username", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "nat", "description": "NAT support", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "configureHAForHost", "description": "Configures HA for a host", "since": "4.11", "isasync": true, "related": "disableHAForHost", "params": [ { "name": "hostid", "description": "ID of the host", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" }, { "name": "provider", "description": "HA provider", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "haenable", "description": "if host HA is enabled for the host", "type": "boolean" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "status", "description": "operation status", "type": "boolean" }, { "name": "hastate", "description": "the HA state of the host", "type": "hastate" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "haprovider", "description": "the host HA provider", "type": "string" }, { }, { } ] }, { "name": "updateConfiguration", "description": "Updates a configuration.", "isasync": false, "related": "", "params": [ { "name": "domainid", "description": "the ID of the Domain to update the parameter value for corresponding domain", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "accountid", "description": "the ID of the Account to update the parameter value for corresponding account", "type": "uuid", "length": 255, "required": false, "related": "enableAccount,listAccounts,listAccounts" }, { "name": "storageid", "description": "the ID of the Storage pool to update the parameter value for corresponding storage pool", "type": "uuid", "length": 255, "required": false, "related": "findStoragePoolsForMigration,enableStorageMaintenance,cancelStorageMaintenance,createStoragePool" }, { "name": "value", "description": "the value of the configuration", "type": "string", "length": 4095, "required": false }, { "name": "imagestoreuuid", "description": "the ID of the Image Store to update the parameter value for corresponding image store", "type": "uuid", "length": 255, "required": false, "related": "listImageStores,listSwifts,addImageStoreS3" }, { "name": "clusterid", "description": "the ID of the Cluster to update the parameter value for corresponding cluster", "type": "uuid", "length": 255, "required": false, "related": "addCluster" }, { "name": "name", "description": "the name of the configuration", "type": "string", "length": 255, "required": true }, { "name": "zoneid", "description": "the ID of the Zone to update the parameter value for corresponding zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones" } ], "response": [ { "name": "value", "description": "the value of the configuration", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "id", "description": "the value of the configuration", "type": "long" }, { "name": "name", "description": "the name of the configuration", "type": "string" }, { "name": "description", "description": "the description of the configuration", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "category", "description": "the category of the configuration", "type": "string" }, { "name": "scope", "description": "scope(zone/cluster/pool/account) of the parameter that needs to be updated", "type": "string" }, { } ] }, { "name": "dedicatePublicIpRange", "description": "Dedicates a Public IP range to an account", "isasync": false, "related": "", "params": [ { "name": "account", "description": "account who will own the VLAN", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "project who will own the VLAN", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "id", "description": "the id of the VLAN IP range", "type": "uuid", "length": 255, "required": true, "related": "dedicatePublicIpRange" }, { "name": "domainid", "description": "domain ID of the account owning a VLAN", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomainChildren" } ], "response": [ { "name": "project", "description": "the project name of the vlan range", "type": "string" }, { "name": "forsystemvms", "description": "indicates whether VLAN IP range is dedicated to system vms or not", "type": "boolean" }, { "name": "vlan", "description": "the ID or VID of the VLAN.", "type": "string" }, { "name": "domainid", "description": "the domain ID of the VLAN IP range", "type": "string" }, { "name": "domain", "description": "the domain name of the VLAN IP range", "type": "string" }, { "name": "endip", "description": "the end ip of the VLAN IP range", "type": "string" }, { "name": "account", "description": "the account of the VLAN IP range", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "podname", "description": "the Pod name for the VLAN IP range", "type": "string" }, { "name": "startipv6", "description": "the start ipv6 of the VLAN IP range", "type": "string" }, { "name": "netmask", "description": "the netmask of the VLAN IP range", "type": "string" }, { "name": "id", "description": "the ID of the VLAN IP range", "type": "string" }, { "name": "startip", "description": "the start ip of the VLAN IP range", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the VLAN IP range", "type": "string" }, { }, { "name": "projectid", "description": "the project id of the vlan range", "type": "string" }, { "name": "podid", "description": "the Pod ID for the VLAN IP range", "type": "string" }, { "name": "description", "description": "the description of the VLAN IP range", "type": "string" }, { "name": "networkid", "description": "the network id of vlan range", "type": "string" }, { }, { "name": "forvirtualnetwork", "description": "the virtual network for the VLAN IP range", "type": "boolean" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "endipv6", "description": "the end ipv6 of the VLAN IP range", "type": "string" }, { "name": "gateway", "description": "the gateway of the VLAN IP range", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" } ] }, { "name": "listRegisteredServicePackages", "description": "lists registered service packages", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "name", "description": "Service Package Name", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "description", "description": "Description of Service Package", "type": "string" }, { "name": "id", "description": "Service Package UUID", "type": "string" }, { } ] }, { "name": "enableStaticNat", "description": "Enables static NAT for given IP address", "isasync": false, "params": [ { "name": "networkid", "description": "The network of the VM the static NAT will be enabled for. Required when public IP address is not associated with any guest network yet (VPC case)", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork" }, { "name": "ipaddressid", "description": "the public IP address ID for which static NAT feature is being enabled", "type": "uuid", "length": 255, "required": true, "related": "updateIpAddress,associateIpAddress,listPublicIpAddresses" }, { "name": "vmguestip", "description": "VM guest NIC secondary IP address for the port forwarding rule", "type": "string", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "the ID of the virtual machine for enabling static NAT feature", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteZone", "description": "Deletes a Zone.", "isasync": false, "params": [ { "name": "id", "description": "the ID of the Zone", "type": "uuid", "length": 255, "required": true, "related": "createZone,listZones" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "disableHAForCluster", "description": "Disables HA cluster-wide", "since": "4.11", "isasync": true, "params": [ { "name": "clusterid", "description": "ID of the cluster", "type": "uuid", "length": 255, "required": true, "related": "addCluster" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "recoverVirtualMachine", "description": "Recovers a virtual machine.", "isasync": false, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,recoverVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" } ] }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" } ] }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" } ] }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" } ] } ] }, { }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" } ] }, { "name": "getUploadParamsForTemplate", "description": "upload an existing template into the CloudStack cloud. ", "since": "4.6.0", "isasync": false, "related": "", "params": [ { "name": "projectid", "description": "Upload volume/template for the project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "passwordenabled", "description": "true if the template supports the password reset feature; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "hypervisor", "description": "the target hypervisor for the template", "type": "string", "length": 255, "required": true }, { "name": "ostypeid", "description": "the ID of the OS Type that best represents the OS of this template.", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "isrouting", "description": "true if the template type is routing i.e., if template is used to deploy router", "type": "boolean", "length": 255, "required": false }, { "name": "displaytext", "description": "the display text of the template. This is usually used for display purposes.", "type": "string", "length": 4096, "required": true }, { "name": "sshkeyenabled", "description": "true if the template supports the sshkey upload feature; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "name", "description": "the name of the volume/template", "type": "string", "length": 255, "required": true }, { "name": "requireshvm", "description": "true if this template requires HVM", "type": "boolean", "length": 255, "required": false }, { "name": "bits", "description": "32 or 64 bits support. 64 by default", "type": "integer", "length": 255, "required": false }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "an optional accountName. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "isextractable", "description": "true if the template or its derivatives are extractable; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "ispublic", "description": "true if the template is available to all accounts; default is true", "type": "boolean", "length": 255, "required": false }, { "name": "format", "description": "the format for the volume/template. Possible values include QCOW2, OVA, and VHD.", "type": "string", "length": 255, "required": true }, { "name": "domainid", "description": "an optional domainId. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "templatetag", "description": "the tag for this template.", "type": "string", "length": 255, "required": false }, { "name": "details", "description": "Template details in key/value pairs.", "type": "map", "length": 255, "required": false }, { "name": "zoneid", "description": "the ID of the zone the volume/template is to be hosted on", "type": "uuid", "length": 255, "required": true, "related": "createZone,listZones" }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean", "length": 255, "required": false }, { "name": "checksum", "description": "the checksum value of this volume/template The parameter containing the checksum will be considered a MD5sum if it is not prefixed\n and just a plain ascii/utf8 representation of a hexadecimal string. If it is required to\n use another algorithm the hexadecimal string is to be prefixed with a string of the form,\n \"{}\", not including the double quotes. In this is the exact string\n representing the java supported algorithm, i.e. MD5 or SHA-256. Note that java does not\n contain an algorithm called SHA256 or one called sha-256, only SHA-256.", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "id", "description": "the template/volume ID", "type": "uuid" }, { "name": "expires", "description": "the timestamp after which the signature expires", "type": "string" }, { "name": "postURL", "description": "POST url to upload the file to", "type": "url" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "metadata", "description": "encrypted data to be sent in the POST request.", "type": "string" }, { }, { "name": "signature", "description": "signature to be sent in the POST request.", "type": "string" } ] }, { "name": "releaseDedicatedHost", "description": "Release the dedication for host", "isasync": true, "params": [ { "name": "hostid", "description": "the ID of the host", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "updateProjectInvitation", "description": "Accepts or declines project invitation", "since": "3.0.0", "isasync": true, "params": [ { "name": "projectid", "description": "id of the project to join", "type": "uuid", "length": 255, "required": true, "related": "activateProject,suspendProject" }, { "name": "token", "description": "list invitations for specified account; this parameter has to be specified with domainId", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "account that is joining the project", "type": "string", "length": 255, "required": false }, { "name": "accept", "description": "if true, accept the invitation, decline if false. True by default", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "revertSnapshot", "description": "This is supposed to revert a volume snapshot. This command is only supported with KVM so far", "isasync": true, "related": "", "params": [ { "name": "id", "description": "The ID of the snapshot", "type": "uuid", "length": 255, "required": true, "related": "revertSnapshot" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "intervaltype", "description": "valid types are hourly, daily, weekly, monthy, template, and none.", "type": "string" }, { "name": "volumeid", "description": "ID of the disk volume", "type": "string" }, { }, { "name": "volumetype", "description": "type of the disk volume", "type": "string" }, { "name": "name", "description": "name of the snapshot", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "snapshottype", "description": "the type of the snapshot", "type": "string" }, { "name": "project", "description": "the project name of the snapshot", "type": "string" }, { "name": "projectid", "description": "the project id of the snapshot", "type": "string" }, { "name": "account", "description": "the account associated with the snapshot", "type": "string" }, { "name": "domainid", "description": "the domain ID of the snapshot's account", "type": "string" }, { }, { "name": "physicalsize", "description": "physical size of backedup snapshot on image store", "type": "long" }, { "name": "virtualsize", "description": "virtual size of backedup snapshot on image store", "type": "long" }, { "name": "domain", "description": "the domain name of the snapshot's account", "type": "string" }, { "name": "id", "description": "ID of the snapshot", "type": "string" }, { "name": "volumename", "description": "name of the disk volume", "type": "string" }, { "name": "state", "description": "the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage", "type": "state" }, { "name": "locationtype", "description": "valid location types are primary and secondary.", "type": "string" }, { "name": "osdisplayname", "description": "display name of the os on volume", "type": "string" }, { "name": "ostypeid", "description": "id of the os on volume", "type": "string" }, { "name": "revertable", "description": "indicates whether the underlying storage supports reverting the volume to this snapshot", "type": "boolean" }, { "name": "created", "description": " the date the snapshot was created", "type": "date" }, { "name": "tags", "description": "the list of resource tags associated with snapshot", "type": "list", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "zoneid", "description": "id of the availability zone", "type": "string" } ] }, { "name": "listRegions", "description": "Lists Regions", "isasync": false, "related": "addRegion", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "List Region by region ID.", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "List Region by region name.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "endpoint", "description": "the end point of the region", "type": "string" }, { "name": "name", "description": "the name of the region", "type": "string" }, { "name": "id", "description": "the ID of the region", "type": "integer" }, { }, { }, { "name": "portableipserviceenabled", "description": "true if security groups support is enabled, false otherwise", "type": "boolean" }, { "name": "gslbserviceenabled", "description": "true if GSLB service is enabled in the region, false otherwise", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "configureInternalLoadBalancerElement", "description": "Configures an Internal Load Balancer element.", "since": "4.2.0", "isasync": true, "related": "", "params": [ { "name": "id", "description": "the ID of the internal lb provider", "type": "uuid", "length": 255, "required": true, "related": "configureInternalLoadBalancerElement" }, { "name": "enabled", "description": "Enables/Disables the Internal Load Balancer element", "type": "boolean", "length": 255, "required": true } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "nspid", "description": "the physical network service provider id of the element", "type": "string" }, { "name": "id", "description": "the id of the internal load balancer element", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "enabled", "description": "Enabled/Disabled the element", "type": "boolean" }, { } ] }, { "name": "migrateSystemVm", "description": "Attempts Migration of a system virtual machine to the host specified.", "isasync": true, "related": "", "params": [ { "name": "virtualmachineid", "description": "the ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "migrateSystemVm" }, { "name": "hostid", "description": "destination Host ID to migrate VM to", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "templateid", "description": "the template ID for the system VM", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "name", "description": "the name of the system VM", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the system vm", "type": "string" }, { "name": "id", "description": "the ID of the system VM", "type": "string" }, { "name": "guestvlan", "description": "guest vlan range", "type": "string" }, { "name": "zonename", "description": "the Zone name for the system VM", "type": "string" }, { "name": "dns1", "description": "the first DNS for the system VM", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "integer" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the system vm", "type": "string" }, { "name": "hostid", "description": "the host ID for the system VM", "type": "string" }, { }, { "name": "jobid", "description": "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.", "type": "string" }, { "name": "privatemacaddress", "description": "the private MAC address for the system VM", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the system VM", "type": "string" }, { }, { "name": "systemvmtype", "description": "the system VM type", "type": "string" }, { "name": "activeviewersessions", "description": "the number of active console sessions for the console proxy system vm", "type": "integer" }, { "name": "podid", "description": "the Pod ID for the system VM", "type": "string" }, { "name": "state", "description": "the state of the system VM", "type": "string" }, { "name": "privateip", "description": "the private IP address for the system VM", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "dns2", "description": "the second DNS for the system VM", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hostname", "description": "the hostname for the system VM", "type": "string" }, { "name": "gateway", "description": "the gateway for the system VM", "type": "string" }, { "name": "publicip", "description": "the public IP address for the system VM", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the system vm", "type": "string" }, { "name": "privatenetmask", "description": "the private netmask for the system VM", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the system VM", "type": "string" }, { "name": "created", "description": "the date and time the system VM was created", "type": "date" }, { "name": "publicvlan", "description": "public vlan range", "type": "list" }, { "name": "publicmacaddress", "description": "the public MAC address for the system VM", "type": "string" } ] }, { "name": "listCounters", "description": "List the counters", "isasync": false, "related": "createCounter", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "ID of the Counter.", "type": "uuid", "length": 255, "required": false, "related": "listCounters,createCounter" }, { "name": "name", "description": "Name of the counter.", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "source", "description": "Source of the counter.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "source", "description": "Source of the counter.", "type": "string" }, { "name": "id", "description": "the id of the Counter", "type": "string" }, { "name": "name", "description": "Name of the counter.", "type": "string" }, { "name": "zoneid", "description": "zone id of counter", "type": "string" }, { "name": "value", "description": "Value in case of snmp or other specific counters.", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteSnapshotPolicies", "description": "Deletes snapshot policies for the account.", "isasync": false, "params": [ { "name": "ids", "description": "list of snapshots policy IDs separated by comma", "type": "list", "length": 255, "required": false, "related": "updateSnapshotPolicy" }, { "name": "id", "description": "the Id of the snapshot policy", "type": "uuid", "length": 255, "required": false, "related": "updateSnapshotPolicy" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listVirtualRouterElements", "description": "Lists all available virtual router elements.", "isasync": false, "related": "", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "enabled", "description": "list network offerings by enabled state", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "list virtual router elements by id", "type": "uuid", "length": 255, "required": false, "related": "listVirtualRouterElements" }, { "name": "nspid", "description": "list virtual router elements by network service provider id", "type": "uuid", "length": 255, "required": false, "related": "listNetworkServiceProviders" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "domainid", "description": "the domain ID associated with the provider", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "nspid", "description": "the physical network service provider id of the provider", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "account", "description": "the account associated with the provider", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "enabled", "description": "Enabled/Disabled the service provider", "type": "boolean" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "domain", "description": "the domain associated with the provider", "type": "string" } ] }, { "name": "listTrafficTypeImplementors", "description": "Lists implementors of implementor of a network traffic type or implementors of all network traffic types", "since": "3.0.0", "isasync": false, "related": "", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "traffictype", "description": "Optional. The network traffic type, if specified, return its implementor. Otherwise, return all traffic types with their implementor", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "traffictype", "description": "network traffic type", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "traffictypeimplementor", "description": "implementor of network traffic type", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "linkAccountToLdap", "description": "link a cloudstack account to a group or OU in ldap", "since": "4.11.0", "isasync": false, "related": "", "params": [ { "name": "admin", "description": "domain admin username in LDAP ", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "The id of the domain that is to contain the linked account.", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomainChildren" }, { "name": "account", "description": "name of the account, it will be created if it does not exist", "type": "string", "length": 255, "required": true }, { "name": "type", "description": "type of the ldap name. GROUP or OU, defaults to GROUP", "type": "string", "length": 255, "required": false }, { "name": "ldapdomain", "description": "name of the group or OU in LDAP", "type": "string", "length": 255, "required": true }, { "name": "accounttype", "description": "Type of the account to auto import. Specify 0 for user and 2 for domain admin", "type": "short", "length": 255, "required": true } ], "response": [ { "name": "accounttype", "description": "Type of the account to auto import", "type": "short" }, { "name": "ldapdomain", "description": "name of the group or OU in LDAP which is linked to the domain", "type": "string" }, { "name": "type", "description": "type of the name in LDAP which is linke to the domain", "type": "string" }, { }, { "name": "name", "description": "name of the group or OU in LDAP which is linked to the domain", "type": "string" }, { "name": "accountid", "description": "Domain Admin accountId that is created", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "id of the Domain which is linked to LDAP", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "deleteImageStore", "description": "Deletes an image store or Secondary Storage.", "since": "4.2.0", "isasync": false, "params": [ { "name": "id", "description": "The image store ID or Secondary Storage ID.", "type": "uuid", "length": 255, "required": true, "related": "listImageStores,listSwifts,addImageStoreS3" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listAutoScaleVmProfiles", "description": "Lists autoscale vm profiles.", "isasync": false, "related": "createAutoScaleVmProfile", "params": [ { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the ID of the autoscale vm profile", "type": "uuid", "length": 255, "required": false, "related": "listAutoScaleVmProfiles,createAutoScaleVmProfile" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "serviceofferingid", "description": "list profiles by service offering id", "type": "uuid", "length": 255, "required": false, "since": "4.4", "related": "listServiceOfferings,updateServiceOffering" }, { "name": "zoneid", "description": "availability zone for the auto deployed virtual machine", "type": "uuid", "length": 255, "required": false, "since": "4.4", "related": "createZone,listZones" }, { "name": "templateid", "description": "the templateid of the autoscale vm profile", "type": "uuid", "length": 255, "required": false, "related": "registerTemplate,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "otherdeployparams", "description": "the otherdeployparameters of the autoscale vm profile", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "destroyvmgraceperiod", "description": "the time allowed for existing connections to get closed before a vm is destroyed", "type": "integer" }, { "name": "project", "description": "the project name of the vm profile", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the autoscale vm profile ID", "type": "string" }, { "name": "zoneid", "description": "the availability zone to be used while deploying a virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the service offering to be used while deploying a virtual machine", "type": "string" }, { "name": "otherdeployparams", "description": "parameters other than zoneId/serviceOfferringId/templateId to be used while deploying a virtual machine", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { }, { "name": "projectid", "description": "the project id vm profile", "type": "string" }, { "name": "domainid", "description": "the domain ID of the vm profile", "type": "string" }, { "name": "fordisplay", "description": "is profile for display to the regular user", "type": "boolean" }, { "name": "autoscaleuserid", "description": "the ID of the user used to launch and destroy the VMs", "type": "string" }, { "name": "domain", "description": "the domain name of the vm profile", "type": "string" }, { }, { "name": "templateid", "description": "the template to be used while deploying a virtual machine", "type": "string" }, { } ] }, { "name": "disableOutOfBandManagementForHost", "description": "Disables out-of-band management for a host", "since": "4.9.0", "isasync": true, "related": "enableOutOfBandManagementForHost,disableOutOfBandManagementForCluster", "params": [ { "name": "hostid", "description": "the ID of the host", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "password", "description": "the out-of-band management interface password", "type": "string" }, { "name": "port", "description": "the out-of-band management interface port", "type": "string" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "username", "description": "the out-of-band management interface username", "type": "string" }, { "name": "powerstate", "description": "the out-of-band management interface powerState of the host", "type": "powerstate" }, { "name": "action", "description": "the out-of-band management action (if issued)", "type": "string" }, { "name": "enabled", "description": "true if out-of-band management is enabled for the host", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "driver", "description": "the out-of-band management driver for the host", "type": "string" }, { "name": "status", "description": "the operation result", "type": "boolean" }, { }, { "name": "address", "description": "the out-of-band management interface address", "type": "string" }, { }, { "name": "description", "description": "the operation result description", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "authorizeSecurityGroupIngress", "description": "Authorizes a particular ingress rule for this security group", "isasync": true, "related": "", "params": [ { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer", "length": 255, "required": false }, { "name": "startport", "description": "start port for this ingress rule", "type": "integer", "length": 255, "required": false }, { "name": "projectid", "description": "an optional project of the security group", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "securitygroupname", "description": "The name of the security group. Mutually exclusive with securityGroupId parameter", "type": "string", "length": 255, "required": false }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer", "length": 255, "required": false }, { "name": "cidrlist", "description": "the cidr list associated", "type": "list", "length": 255, "required": false }, { "name": "account", "description": "an optional account for the security group. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "usersecuritygrouplist", "description": "user to security group mapping", "type": "map", "length": 255, "required": false }, { "name": "domainid", "description": "an optional domainId for the security group. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "protocol", "description": "TCP is default. UDP is the other supported protocol", "type": "string", "length": 255, "required": false }, { "name": "endport", "description": "end port for this ingress rule", "type": "integer", "length": 255, "required": false }, { "name": "securitygroupid", "description": "The ID of the security group. Mutually exclusive with securityGroupName parameter", "type": "uuid", "length": 255, "required": false, "related": "createSecurityGroup" } ], "response": [ { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" } ] }, { "name": "createSecurityGroup", "description": "Creates a security group", "isasync": false, "related": "", "params": [ { "name": "name", "description": "name of the security group", "type": "string", "length": 255, "required": true }, { "name": "account", "description": "an optional account for the security group. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "Create security group for project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "description", "description": "the description of the security group", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "an optional domainId for the security group. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" } ], "response": [ { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" } ] }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "description", "description": "the description of the security group", "type": "string" }, { } ] }, { "name": "listVpnGateways", "description": "Lists site 2 site vpn gateways", "isasync": false, "related": "createVpnGateway", "params": [ { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "id of the vpn gateway", "type": "uuid", "length": 255, "required": false, "related": "createVpnGateway,listVpnGateways" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "vpcid", "description": "id of vpc", "type": "uuid", "length": 255, "required": false, "related": "listVPCs,createVPC,updateVPC" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "vpcid", "description": "the vpc id of this gateway", "type": "string" }, { "name": "publicip", "description": "the public IP address", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "id", "description": "the vpn gateway ID", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "account", "description": "the owner", "type": "string" }, { "name": "project", "description": "the project name", "type": "string" }, { "name": "projectid", "description": "the project id", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the domain id of the owner", "type": "string" }, { "name": "fordisplay", "description": "is vpn gateway for display to the regular user", "type": "boolean" }, { } ] }, { "name": "updateResourceCount", "description": "Recalculate and update resource count for an account or domain.", "isasync": false, "related": "", "params": [ { "name": "domainid", "description": "If account parameter specified then updates resource counts for a specified account in this domain else update resource counts for all accounts & child domains in specified domain.", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomainChildren" }, { "name": "account", "description": "Update resource count for a specified account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "Update resource limits for project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "resourcetype", "description": "Type of resource to update. If specifies valid values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and 11. If not specified will update all resource counts0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create. 3 - Snapshot. Number of snapshots a user can create. 4 - Template. Number of templates that a user can register/create. 5 - Project. Number of projects that a user can create. 6 - Network. Number of guest network a user can create. 7 - VPC. Number of VPC a user can create. 8 - CPU. Total number of CPU cores a user can use. 9 - Memory. Total Memory (in MB) a user can use. 10 - PrimaryStorage. Total primary storage space (in GiB) a user can use. 11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. ", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "project", "description": "the project name for which resource count's are updated", "type": "string" }, { "name": "resourcecount", "description": "resource count", "type": "long" }, { }, { "name": "domain", "description": "the domain name for which resource count's are updated", "type": "string" }, { "name": "projectid", "description": "the project id for which resource count's are updated", "type": "string" }, { "name": "domainid", "description": "the domain ID for which resource count's are updated", "type": "string" }, { }, { "name": "account", "description": "the account for which resource count's are updated", "type": "string" }, { "name": "resourcetype", "description": "resource type. Values include 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.", "type": "string" }, { "name": "resourcetypename", "description": "resource type name. Values include user_vm, public_ip, volume, snapshot, template, project, network, vpc, cpu, memory, primary_storage, secondary_storage.", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listRoles", "description": "Lists dynamic roles in CloudStack", "since": "4.9.0", "isasync": false, "related": "", "params": [ { "name": "name", "description": "List role by role name.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "List role by role ID.", "type": "uuid", "length": 255, "required": false, "related": "listRoles" }, { "name": "type", "description": "List role by role type, valid options are: Admin, ResourceAdmin, DomainAdmin, User.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "name", "description": "the name of the role", "type": "string" }, { }, { "name": "type", "description": "the type of the role", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "id", "description": "the ID of the role", "type": "string" }, { "name": "description", "description": "the description of the role", "type": "string" } ] }, { "name": "associateNuageVspDomainTemplate", "description": "associate a vpc with a domain template", "since": "4.11.0", "isasync": false, "params": [ { "name": "vpcid", "description": "VPC ID", "type": "uuid", "length": 255, "required": true, "related": "listVPCs,createVPC,updateVPC" }, { "name": "physicalnetworkid", "description": "the physical network ID", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "zoneid", "description": "the zone ID", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones" }, { "name": "domaintemplate", "description": "the name of the domain template", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { } ] }, { "name": "getCloudIdentifier", "description": "Retrieves a cloud identifier.", "isasync": false, "related": "", "params": [ { "name": "userid", "description": "the user ID for the cloud identifier", "type": "uuid", "length": 255, "required": true, "related": "getUser,enableUser,createUser" } ], "response": [ { "name": "cloudidentifier", "description": "the cloud identifier", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "signature", "description": "the signed response for the cloud identifier", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "userid", "description": "the user ID for the cloud identifier", "type": "string" } ] }, { "name": "createLBStickinessPolicy", "description": "Creates a load balancer stickiness policy ", "since": "3.0.0", "isasync": true, "related": "listLBStickinessPolicies", "params": [ { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "methodname", "description": "name of the load balancer stickiness policy method, possible values can be obtained from listNetworks API", "type": "string", "length": 255, "required": true }, { "name": "name", "description": "name of the load balancer stickiness policy", "type": "string", "length": 255, "required": true }, { "name": "lbruleid", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "description", "description": "the description of the load balancer stickiness policy", "type": "string", "length": 255, "required": false }, { "name": "param", "description": "param list. Example: param[0].name=cookiename¶m[0].value=LBCookie ", "type": "map", "length": 255, "required": false } ], "response": [ { }, { "name": "description", "description": "the description of the Stickiness policy", "type": "string" }, { "name": "state", "description": "the state of the policy", "type": "string" }, { }, { "name": "domain", "description": "the domain of the Stickiness policy", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "account", "description": "the account of the Stickiness policy", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the domain ID of the Stickiness policy", "type": "string" }, { "name": "zoneid", "description": "the id of the zone the Stickiness policy belongs to", "type": "string" }, { "name": "stickinesspolicy", "description": "the list of stickinesspolicies", "type": "list", "response": [ { "name": "fordisplay", "description": "is policy for display to the regular user", "type": "boolean" }, { "name": "methodname", "description": "the method name of the Stickiness policy", "type": "string" }, { "name": "description", "description": "the description of the Stickiness policy", "type": "string" }, { "name": "name", "description": "the name of the Stickiness policy", "type": "string" }, { "name": "params", "description": "the params of the policy", "type": "map" }, { "name": "id", "description": "the LB Stickiness policy ID", "type": "string" }, { "name": "state", "description": "the state of the policy", "type": "string" } ] }, { "name": "lbruleid", "description": "the LB rule ID", "type": "string" }, { "name": "name", "description": "the name of the Stickiness policy", "type": "string" } ] }, { "name": "configurePaloAltoFirewall", "description": "Configures a Palo Alto firewall device", "isasync": true, "related": "listPaloAltoFirewalls,addPaloAltoFirewall", "params": [ { "name": "fwdevicecapacity", "description": "capacity of the firewall device, Capacity will be interpreted as number of networks device can handle", "type": "long", "length": 255, "required": false }, { "name": "fwdeviceid", "description": "Palo Alto firewall device ID", "type": "uuid", "length": 255, "required": true, "related": "listPaloAltoFirewalls,configurePaloAltoFirewall,addPaloAltoFirewall" } ], "response": [ { "name": "privatezone", "description": "the private security zone of the external firewall", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this Palo Alto firewall belongs to", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "numretries", "description": "the number of times to retry requests to the external firewall", "type": "string" }, { "name": "username", "description": "the username that's used to log in to the external firewall", "type": "string" }, { "name": "fwdeviceid", "description": "device id of the Palo Alto firewall", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "fwdevicecapacity", "description": "device capacity", "type": "long" }, { "name": "zoneid", "description": "the zone ID of the external firewall", "type": "string" }, { "name": "ipaddress", "description": "the management IP address of the external firewall", "type": "string" }, { "name": "fwdevicename", "description": "device name", "type": "string" }, { "name": "publiczone", "description": "the public security zone of the external firewall", "type": "string" }, { "name": "privateinterface", "description": "the private interface of the external firewall", "type": "string" }, { }, { "name": "usageinterface", "description": "the usage interface of the external firewall", "type": "string" }, { "name": "fwdevicestate", "description": "device state", "type": "string" }, { }, { "name": "timeout", "description": "the timeout (in seconds) for requests to the external firewall", "type": "string" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "publicinterface", "description": "the public interface of the external firewall", "type": "string" } ] }, { "name": "updateNetworkACLItem", "description": "Updates ACL item with specified ID", "isasync": true, "related": "moveNetworkAclItem", "params": [ { "name": "protocol", "description": "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number", "type": "string", "length": 255, "required": false }, { "name": "cidrlist", "description": "the cidr list to allow traffic from/to", "type": "list", "length": 255, "required": false }, { "name": "startport", "description": "the starting port of ACL", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "the ID of the network ACL item", "type": "uuid", "length": 255, "required": true, "related": "moveNetworkAclItem,updateNetworkACLItem" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "icmptype", "description": "type of the ICMP message being sent", "type": "integer", "length": 255, "required": false }, { "name": "endport", "description": "the ending port of ACL", "type": "integer", "length": 255, "required": false }, { "name": "icmpcode", "description": "error code for this ICMP message", "type": "integer", "length": 255, "required": false }, { "name": "action", "description": "scl entry action, allow or deny", "type": "string", "length": 255, "required": false }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "number", "description": "The network of the vm the ACL will be created for", "type": "integer", "length": 255, "required": false }, { "name": "partialupgrade", "description": "Indicates if the ACL rule is to be updated partially (merging the parameters sent with current configuration) or completely (disconsidering all of the current configurations). The default value is 'true'.", "type": "boolean", "length": 255, "required": false }, { "name": "reason", "description": "A description indicating why the ACL rule is required.", "type": "string", "length": 255, "required": false }, { "name": "traffictype", "description": "the traffic type for the ACL, can be Ingress or Egress, defaulted to Ingress if not specified", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "protocol", "description": "the protocol of the ACL", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "action", "description": "Action of ACL Item. Allow/Deny", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the network ACLs", "type": "list", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "startport", "description": "the starting port of ACL's port range", "type": "string" }, { "name": "endport", "description": "the ending port of ACL's port range", "type": "string" }, { }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer" }, { "name": "reason", "description": "an explanation on why this ACL rule is being applied", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "traffictype", "description": "the traffic type for the ACL", "type": "string" }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "number", "description": "Number of the ACL Item", "type": "integer" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "id", "description": "the ID of the ACL Item", "type": "string" }, { "name": "aclid", "description": "the ID of the ACL this item belongs to", "type": "string" }, { } ] }, { "name": "moveUser", "description": "Moves a user to another account", "since": "4.11", "isasync": false, "params": [ { "name": "account", "description": "Creates the user under the specified account. If no account is specified, the username will be used as the account name.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "id of the user to be deleted", "type": "uuid", "length": 255, "required": true, "related": "getUser,enableUser,createUser" }, { "name": "accountid", "description": "Creates the user under the specified domain. Has to be accompanied with the account parameter", "type": "uuid", "length": 255, "required": false, "related": "enableAccount,listAccounts,listAccounts" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "listRouters", "description": "List routers.", "isasync": false, "related": "destroyRouter", "params": [ { "name": "vpcid", "description": "List networks by VPC", "type": "uuid", "length": 255, "required": false, "related": "listVPCs,createVPC,updateVPC" }, { "name": "networkid", "description": "list by network id", "type": "uuid", "length": 255, "required": false, "related": "migrateNetwork,listBrocadeVcsDeviceNetworks,listNetworks,updateNetwork,createNetwork" }, { "name": "podid", "description": "the Pod ID of the router", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID of the router", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones" }, { "name": "forvpc", "description": "if true is passed for this parameter, list only VPC routers", "type": "boolean", "length": 255, "required": false }, { "name": "version", "description": "list virtual router elements by version", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "hostid", "description": "the host ID of the router", "type": "uuid", "length": 255, "required": false, "related": "reconnectHost,addBaremetalHost" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the ID of the disk router", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "name", "description": "the name of the router", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "clusterid", "description": "the cluster ID of the router", "type": "uuid", "length": 255, "required": false, "related": "addCluster" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "state", "description": "the state of the router", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "role", "description": "role of the domain router", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the router", "type": "string" }, { "name": "dns1", "description": "the first DNS for the router", "type": "string" }, { }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "zonename", "description": "the Zone name for the router", "type": "string" }, { "name": "guestnetworkid", "description": "the ID of the corresponding guest network", "type": "string" }, { "name": "dns2", "description": "the second DNS for the router", "type": "string" }, { "name": "linklocalnetworkid", "description": "the ID of the corresponding link local network", "type": "string" }, { "name": "nic", "description": "the list of nics associated with the router", "type": "set", "response": [ { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" } ] }, { "name": "publicnetworkid", "description": "the ID of the corresponding public network", "type": "string" }, { "name": "publicmacaddress", "description": "the public MAC address for the router", "type": "string" }, { "name": "hostid", "description": "the host ID for the router", "type": "string" }, { "name": "vpcname", "description": "the name of VPC the router belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the router", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the router", "type": "string" }, { "name": "version", "description": "the version of template", "type": "string" }, { "name": "guestmacaddress", "description": "the guest MAC address for the router", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { }, { "name": "domainid", "description": "the domain ID associated with the router", "type": "string" }, { "name": "requiresupgrade", "description": "true if the router template requires upgrader", "type": "boolean" }, { "name": "guestipaddress", "description": "the guest IP address for the router", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the router", "type": "string" }, { "name": "name", "description": "the name of the router", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the router", "type": "string" }, { "name": "guestnetmask", "description": "the guest netmask for the router", "type": "string" }, { "name": "scriptsversion", "description": "the version of scripts", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the router", "type": "state" }, { "name": "redundantstate", "description": "the state of redundant virtual router", "type": "string" }, { "name": "guestnetworkname", "description": "the name of the corresponding guest network", "type": "string" }, { "name": "domain", "description": "the domain associated with the router", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the router", "type": "string" }, { "name": "gateway", "description": "the gateway for the router", "type": "string" }, { "name": "podid", "description": "the Pod ID for the router", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the router", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "linklocalip", "description": "the link local IP address for the router", "type": "string" }, { "name": "publicip", "description": "the public IP address for the router", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the router", "type": "string" }, { "name": "vpcid", "description": "VPC the router belongs to", "type": "string" }, { "name": "templateid", "description": "the template ID for the router", "type": "string" }, { "name": "created", "description": "the date and time the router was created", "type": "date" }, { "name": "isredundantrouter", "description": "if this router is an redundant virtual router", "type": "boolean" }, { "name": "hostname", "description": "the hostname for the router", "type": "string" } ] }, { "name": "releaseHostReservation", "description": "Releases host reservation.", "isasync": true, "params": [ { "name": "id", "description": "the host ID", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "createVpnConnection", "description": "Create site to site vpn connection", "isasync": true, "related": "", "params": [ { "name": "passive", "description": "connection is passive or not", "type": "boolean", "length": 255, "required": false }, { "name": "s2svpngatewayid", "description": "id of the vpn gateway", "type": "uuid", "length": 255, "required": true, "related": "createVpnGateway" }, { "name": "fordisplay", "description": "an optional field, whether to the display the vpn to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "s2scustomergatewayid", "description": "id of the customer gateway", "type": "uuid", "length": 255, "required": true, "related": "createVpnCustomerGateway" } ], "response": [ { "name": "id", "description": "the connection ID", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "gateway", "description": "public ip address id of the customer gateway", "type": "string" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "projectid", "description": "the project id", "type": "string" }, { "name": "ipsecpsk", "description": "IPsec Preshared-Key of the customer gateway", "type": "string" }, { "name": "s2svpngatewayid", "description": "the vpn gateway ID", "type": "string" }, { "name": "esppolicy", "description": "ESP policy of the customer gateway", "type": "string" }, { "name": "account", "description": "the owner", "type": "string" }, { "name": "passive", "description": "State of vpn connection", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the domain id of the owner", "type": "string" }, { "name": "cidrlist", "description": "guest cidr list of the customer gateway", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "publicip", "description": "the public IP address", "type": "string" }, { "name": "esplifetime", "description": "Lifetime of ESP SA of customer gateway", "type": "long" }, { "name": "ikepolicy", "description": "IKE policy of the customer gateway", "type": "string" }, { "name": "dpd", "description": "if DPD is enabled for customer gateway", "type": "boolean" }, { "name": "forceencap", "description": "if Force NAT Encapsulation is enabled for customer gateway", "type": "boolean" }, { "name": "ikelifetime", "description": "Lifetime of IKE SA of customer gateway", "type": "long" }, { "name": "state", "description": "State of vpn connection", "type": "string" }, { }, { }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "s2scustomergatewayid", "description": "the customer gateway ID", "type": "string" }, { "name": "fordisplay", "description": "is connection for display to the regular user", "type": "boolean" }, { "name": "project", "description": "the project name", "type": "string" } ] }, { "name": "listBrocadeVcsDeviceNetworks", "description": "lists network that are using a brocade vcs switch", "isasync": false, "related": "migrateNetwork,listNetworks,updateNetwork,createNetwork", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "vcsdeviceid", "description": "brocade vcs switch ID", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" } ] }, { "name": "name", "description": "the service name", "type": "string" }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "name", "description": "the capability name", "type": "string" } ] } ] }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" } ] }, { "name": "deletePhysicalNetwork", "description": "Deletes a Physical Network.", "since": "3.0.0", "isasync": true, "params": [ { "name": "id", "description": "the ID of the Physical network", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "dedicateHost", "description": "Dedicates a host.", "isasync": true, "related": "listDedicatedHosts", "params": [ { "name": "account", "description": "the name of the account which needs dedication. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "the ID of the containing domain", "type": "uuid", "length": 255, "required": true, "related": "listDomains,listDomainChildren" }, { "name": "hostid", "description": "the ID of the host to update", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "domainid", "description": "the domain ID of the host", "type": "string" }, { }, { "name": "hostname", "description": "the name of the host", "type": "string" }, { "name": "accountid", "description": "the Account ID of the host", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "affinitygroupid", "description": "the Dedication Affinity Group ID of the host", "type": "string" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "id", "description": "the ID of the dedicated resource", "type": "string" }, { } ] }, { "name": "removeVpnUser", "description": "Removes vpn user", "isasync": true, "params": [ { "name": "domainid", "description": "an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "username", "description": "username for the vpn user", "type": "string", "length": 255, "required": true }, { "name": "account", "description": "an optional account for the vpn user. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "remove vpn user from the project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "addGloboDnsHost", "description": "Adds the GloboDNS external host", "since": "4.5.0", "isasync": true, "params": [ { "name": "url", "description": "GloboDNS url", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "Password for GloboDNS", "type": "string", "length": 255, "required": true }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" }, { "name": "username", "description": "Username for GloboDNS", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { } ] }, { "name": "logout", "description": "Logs out the user", "isasync": false, "related": "", "params": [ ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "description", "description": "Response description", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "deleteLBHealthCheckPolicy", "description": "Deletes a load balancer health check policy.", "since": "4.2.0", "isasync": true, "params": [ { "name": "id", "description": "the ID of the load balancer health check policy", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "listSwifts", "description": "List Swift.", "since": "3.0.0", "isasync": false, "related": "listImageStores,addImageStoreS3", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the id of the swift", "type": "long", "length": 255, "required": false } ], "response": [ { }, { "name": "protocol", "description": "the protocol of the image store", "type": "string" }, { "name": "zonename", "description": "the Zone name of the image store", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "name", "description": "the name of the image store", "type": "string" }, { "name": "id", "description": "the ID of the image store", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the image store", "type": "string" }, { "name": "scope", "description": "the scope of the image store", "type": "scopetype" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "url", "description": "the url of the image store", "type": "string" }, { "name": "providername", "description": "the provider name of the image store", "type": "string" } ] }, { "name": "disableHAForHost", "description": "Disables HA for a host", "since": "4.11", "isasync": true, "related": "", "params": [ { "name": "hostid", "description": "ID of the host", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "status", "description": "operation status", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "haprovider", "description": "the host HA provider", "type": "string" }, { "name": "hastate", "description": "the HA state of the host", "type": "hastate" }, { }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "haenable", "description": "if host HA is enabled for the host", "type": "boolean" } ] }, { "name": "enableOutOfBandManagementForHost", "description": "Enables out-of-band management for a host", "since": "4.9.0", "isasync": true, "related": "disableOutOfBandManagementForCluster", "params": [ { "name": "hostid", "description": "the ID of the host", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "username", "description": "the out-of-band management interface username", "type": "string" }, { "name": "action", "description": "the out-of-band management action (if issued)", "type": "string" }, { "name": "status", "description": "the operation result", "type": "boolean" }, { "name": "enabled", "description": "true if out-of-band management is enabled for the host", "type": "boolean" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "powerstate", "description": "the out-of-band management interface powerState of the host", "type": "powerstate" }, { "name": "address", "description": "the out-of-band management interface address", "type": "string" }, { "name": "password", "description": "the out-of-band management interface password", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "description", "description": "the operation result description", "type": "string" }, { "name": "port", "description": "the out-of-band management interface port", "type": "string" }, { "name": "driver", "description": "the out-of-band management driver for the host", "type": "string" }, { } ] }, { "name": "deleteServiceOffering", "description": "Deletes a service offering.", "isasync": false, "params": [ { "name": "id", "description": "the ID of the service offering", "type": "uuid", "length": 255, "required": true, "related": "listServiceOfferings,updateServiceOffering" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "addNiciraNvpDevice", "description": "Adds a Nicira NVP device", "isasync": true, "related": "", "params": [ { "name": "l2gatewayserviceuuid", "description": "The L2 Gateway Service UUID configured on the Nicira Controller", "type": "string", "length": 255, "required": false }, { "name": "username", "description": "Credentials to access the Nicira Controller API", "type": "string", "length": 255, "required": true }, { "name": "l3gatewayserviceuuid", "description": "The L3 Gateway Service UUID configured on the Nicira Controller", "type": "string", "length": 255, "required": false }, { "name": "transportzoneuuid", "description": "The Transportzone UUID configured on the Nicira Controller", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "Credentials to access the Nicira Controller API", "type": "string", "length": 255, "required": true }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" }, { "name": "hostname", "description": "Hostname of ip address of the Nicira NVP Controller.", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "physicalnetworkid", "description": "the physical network to which this Nirica Nvp belongs to", "type": "string" }, { "name": "hostname", "description": "the controller Ip address", "type": "string" }, { "name": "l3gatewayserviceuuid", "description": "this L3 gateway service Uuid", "type": "string" }, { }, { }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "nvpdeviceid", "description": "device id of the Nicire Nvp", "type": "string" }, { "name": "l2gatewayserviceuuid", "description": "this L2 gateway service Uuid", "type": "string" }, { "name": "niciradevicename", "description": "device name", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "transportzoneuuid", "description": "the transport zone Uuid", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listNetworkServiceProviders", "description": "Lists network serviceproviders for a given physical network.", "since": "3.0.0", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": false, "related": "createPhysicalNetwork" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "list providers by name", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "state", "description": "list providers by state", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "state", "description": "state of the network provider", "type": "string" }, { }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" } ] }, { "name": "listInfrastructure", "description": "Lists infrastructure", "since": "4.9.3", "isasync": false, "related": "", "params": [ ], "response": [ { }, { "name": "clusters", "description": "Number of clusters", "type": "integer" }, { "name": "zones", "description": "Number of zones", "type": "integer" }, { "name": "systemvms", "description": "Number of systemvms", "type": "integer" }, { "name": "routers", "description": "Number of routers", "type": "integer" }, { "name": "managementservers", "description": "Number of management servers", "type": "integer" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "imagestores", "description": "Number of images stores", "type": "integer" }, { "name": "storagepools", "description": "Number of storage pools", "type": "integer" }, { "name": "cpusockets", "description": "Number of cpu sockets", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hosts", "description": "Number of hypervisor hosts", "type": "integer" }, { "name": "pods", "description": "Number of pods", "type": "integer" }, { } ] }, { "name": "listUsageRecords", "description": "Lists usage records for accounts", "isasync": false, "related": "", "params": [ { "name": "startdate", "description": "Start date range for usage record query (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\", e.g. startDate=2015-01-01 or startdate=2015-01-01 11:00:00).", "type": "date", "length": 255, "required": true }, { "name": "accountid", "description": "List usage records for the specified account", "type": "uuid", "length": 255, "required": false, "related": "enableAccount,listAccounts,listAccounts" }, { "name": "includetags", "description": "Flag to enable display of Tags for a resource", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "List usage records for the specified user.", "type": "string", "length": 255, "required": false }, { "name": "usageid", "description": "List usage records for the specified usage UUID. Can be used only together with TYPE parameter.", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "List usage records for specified project", "type": "uuid", "length": 255, "required": false, "related": "activateProject,suspendProject" }, { "name": "enddate", "description": "End date range for usage record query (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\", e.g. startDate=2015-01-01 or startdate=2015-01-01 10:30:00).", "type": "date", "length": 255, "required": true }, { "name": "type", "description": "List usage records for the specified usage type", "type": "long", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "List usage records for the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" } ], "response": [ { "name": "cpuspeed", "description": "speed of each cpu of resource", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "virtualmachineid", "description": "virtual machine ID", "type": "string" }, { "name": "domain", "description": "the domain the resource is associated with", "type": "string" }, { "name": "issourcenat", "description": "True if the IPAddress is source NAT", "type": "boolean" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "name", "description": "virtual machine name", "type": "string" }, { "name": "templateid", "description": "template ID", "type": "string" }, { "name": "startdate", "description": "start date of the usage record", "type": "string" }, { }, { "name": "networkid", "description": "id of the network", "type": "string" }, { "name": "virtualsize", "description": "virtual size of resource", "type": "long" }, { "name": "description", "description": "description of the usage record", "type": "string" }, { "name": "memory", "description": "memory allocated for the resource", "type": "long" }, { "name": "project", "description": "the project name of the resource", "type": "string" }, { "name": "offeringid", "description": "offering ID", "type": "string" }, { "name": "issystem", "description": "True if the IPAddress is system IP - allocated during vm deploy or lb rule create", "type": "boolean" }, { "name": "usage", "description": "usage in hours", "type": "string" }, { "name": "cpunumber", "description": "number of cpu of resource", "type": "long" }, { "name": "rawusage", "description": "raw usage in hours", "type": "string" }, { }, { "name": "size", "description": "resource size", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "usageid", "description": "id of the resource", "type": "string" }, { "name": "usagetype", "description": "usage type ID", "type": "integer" }, { "name": "enddate", "description": "end date of the usage record", "type": "string" }, { "name": "accountid", "description": "the user account Id", "type": "string" }, { "name": "domainid", "description": "the domain ID", "type": "string" }, { "name": "zoneid", "description": "the zone ID", "type": "string" }, { "name": "isdefault", "description": "True if the resource is default", "type": "boolean" }, { "name": "projectid", "description": "the project id of the resource", "type": "string" }, { "name": "type", "description": "resource type", "type": "string" }, { "name": "account", "description": "the user account name", "type": "string" } ] }, { "name": "deleteNetscalerControlCenter", "description": "Delete Netscaler Control Center", "isasync": false, "params": [ { "name": "id", "description": "Netscaler Control Center ID", "type": "string", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "deleteVolume", "description": "Deletes a detached disk volume.", "isasync": false, "params": [ { "name": "id", "description": "The ID of the disk volume", "type": "uuid", "length": 255, "required": true, "related": "createVolume,createVolume,listVolumes,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "listZonesMetrics", "description": "Lists zone metrics", "since": "4.9.3", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "networktype", "description": "the network type of the zone that the virtual machine belongs to", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the ID of the zone", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones" }, { "name": "name", "description": "the name of the zone", "type": "string", "length": 255, "required": false }, { "name": "available", "description": "true if you want to retrieve all available Zones. False if you only want to return the Zones from which you have at least one VM. Default is false.", "type": "boolean", "length": 255, "required": false }, { "name": "tags", "description": "List zones by resource tags (key/value pairs)", "type": "map", "length": 255, "required": false, "since": "4.3" }, { "name": "showcapacities", "description": "flag to display the capacity of the zones", "type": "boolean", "length": 255, "required": false }, { "name": "domainid", "description": "the ID of the domain associated with the zone", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "memorydisablethreshold", "description": "memory usage disable threshold exceeded", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "Zone id", "type": "string" }, { "name": "cputhreshold", "description": "cpu usage notification threshold exceeded", "type": "boolean" }, { "name": "domain", "description": "Network domain name for the networks in the zone", "type": "string" }, { "name": "displaytext", "description": "the display text of the zone", "type": "string" }, { "name": "internaldns2", "description": "the second internal DNS for the Zone", "type": "string" }, { }, { "name": "memoryallocatedthreshold", "description": "memory allocated notification threshold exceeded", "type": "boolean" }, { "name": "memorythreshold", "description": "memory usage notification threshold exceeded", "type": "boolean" }, { "name": "domainid", "description": "the UUID of the containing domain, null for public zones", "type": "string" }, { "name": "cpuallocatedthreshold", "description": "cpu allocated notification threshold exceeded", "type": "boolean" }, { "name": "domainname", "description": "the name of the containing domain, null for public zones", "type": "string" }, { "name": "zonetoken", "description": "Zone Token", "type": "string" }, { "name": "cpudisablethreshold", "description": "cpu usage disable threshold exceeded", "type": "boolean" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the Zone", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "Zone name", "type": "string" }, { "name": "dns1", "description": "the first DNS for the Zone", "type": "string" }, { "name": "capacity", "description": "the capacity of the Zone", "type": "list", "response": [ { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "name", "description": "the capacity name", "type": "string" }, { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "podid", "description": "the Pod ID", "type": "string" } ] }, { "name": "tags", "description": "the list of resource tags associated with zone.", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "allocationstate", "description": "the allocation state of the cluster", "type": "string" }, { "name": "description", "description": "Zone description", "type": "string" }, { "name": "cpumaxdeviation", "description": "the maximum cpu deviation", "type": "string" }, { }, { "name": "memoryallocated", "description": "the total cpu allocated in GiB", "type": "string" }, { "name": "guestcidraddress", "description": "the guest CIDR address for the Zone", "type": "string" }, { "name": "memorymaxdeviation", "description": "the maximum memory deviation", "type": "string" }, { "name": "memoryallocateddisablethreshold", "description": "memory allocated disable threshold exceeded", "type": "boolean" }, { "name": "memoryused", "description": "the total cpu used in GiB", "type": "string" }, { "name": "cpuallocateddisablethreshold", "description": "cpu allocated disable threshold exceeded", "type": "boolean" }, { "name": "clusters", "description": "healthy / total clusters in the zone", "type": "string" }, { "name": "networktype", "description": "the network type of the zone; can be Basic or Advanced", "type": "string" }, { "name": "cputotal", "description": "the total cpu capacity in Ghz", "type": "string" }, { "name": "state", "description": "state of the cluster", "type": "string" }, { "name": "dns2", "description": "the second DNS for the Zone", "type": "string" }, { "name": "resourcedetails", "description": "Meta data associated with the zone (key/value pairs)", "type": "map" }, { "name": "internaldns1", "description": "the first internal DNS for the Zone", "type": "string" }, { "name": "dhcpprovider", "description": "the dhcp Provider for the Zone", "type": "string" }, { "name": "cpuallocated", "description": "the total cpu allocated in Ghz", "type": "string" }, { "name": "memorytotal", "description": "the total cpu capacity in GiB", "type": "string" }, { "name": "securitygroupsenabled", "description": "true if security groups support is enabled, false otherwise", "type": "boolean" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the Zone", "type": "string" }, { "name": "localstorageenabled", "description": "true if local storage offering enabled, false otherwise", "type": "boolean" }, { "name": "cpuused", "description": "the total cpu used in Ghz", "type": "string" } ] }, { "name": "enableUser", "description": "Enables a user account", "isasync": false, "related": "getUser,createUser", "params": [ { "name": "id", "description": "Enables user by user ID.", "type": "uuid", "length": 255, "required": true, "related": "getUser,enableUser,createUser" } ], "response": [ { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" } ] }, { "name": "extractTemplate", "description": "Extracts a template", "isasync": true, "related": "", "params": [ { "name": "mode", "description": "the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD", "type": "string", "length": 255, "required": true }, { "name": "id", "description": "the ID of the template", "type": "uuid", "length": 255, "required": true, "related": "registerTemplate,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "url", "description": "the url to which the ISO would be extracted", "type": "string", "length": 2048, "required": false }, { "name": "zoneid", "description": "the ID of the zone where the ISO is originally located", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones" } ], "response": [ { "name": "accountid", "description": "the account id to which the extracted object belongs", "type": "string" }, { "name": "uploadpercentage", "description": "the percentage of the entity uploaded to the specified location", "type": "integer" }, { }, { "name": "storagetype", "description": "type of the storage", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "zoneid", "description": "zone ID the object was extracted from", "type": "string" }, { }, { "name": "extractMode", "description": "the mode of extraction - upload or download", "type": "string" }, { "name": "extractId", "description": "the upload id of extracted object", "type": "string" }, { "name": "created", "description": "the time and date the object was created", "type": "date" }, { "name": "status", "description": "the status of the extraction", "type": "string" }, { "name": "url", "description": "if mode = upload then url of the uploaded entity. if mode = download the url from which the entity can be downloaded", "type": "string" }, { "name": "zonename", "description": "zone name the object was extracted from", "type": "string" }, { "name": "resultstring", "description": "", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the id of extracted object", "type": "string" }, { "name": "name", "description": "the name of the extracted object", "type": "string" }, { "name": "state", "description": "the state of the extracted object", "type": "string" } ] }, { "name": "expungeVirtualMachine", "description": "Expunge a virtual machine. Once expunged, it cannot be recoverd.", "isasync": true, "params": [ { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "suspendProject", "description": "Suspends a project", "since": "3.0.0", "isasync": true, "related": "activateProject", "params": [ { "name": "id", "description": "id of the project to be suspended", "type": "uuid", "length": 255, "required": true, "related": "activateProject,suspendProject" } ], "response": [ { "name": "displaytext", "description": "the displaytext of the project", "type": "string" }, { "name": "state", "description": "the state of the project", "type": "string" }, { "name": "name", "description": "the name of the project", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this project", "type": "long" }, { "name": "domainid", "description": "the domain id the project belongs to", "type": "string" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this project", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this project", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with vm", "type": "list", "response": [ { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "vpclimit", "description": "the total number of vpcs the project can own", "type": "string" }, { "name": "iplimit", "description": "the total number of public ip addresses this project can acquire", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this project", "type": "string" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by project", "type": "long" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "account", "description": "the account name of the project's owner", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this project", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this project", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this project", "type": "string" }, { "name": "volumelimit", "description": "the total volume which can be used by this project", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by project", "type": "long" }, { "name": "memorylimit", "description": "the total memory (in MB) the project can own", "type": "string" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this project to acquire", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the project can own", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the project can own", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this project to acquire", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by project", "type": "long" }, { "name": "volumeavailable", "description": "the total volume available for this project", "type": "string" }, { }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this project", "type": "long" }, { "name": "domain", "description": "the domain name where the project belongs to", "type": "string" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this project", "type": "string" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this project", "type": "integer" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "cputotal", "description": "the total number of cpu cores owned by project", "type": "long" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this project", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this project", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the project can own", "type": "string" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this project", "type": "long" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the project can own", "type": "string" }, { "name": "id", "description": "the id of the project", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by project", "type": "float" }, { "name": "projectaccountname", "description": "the project account name of the project", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by project", "type": "long" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this project", "type": "long" }, { "name": "volumetotal", "description": "the total volume being used by this project", "type": "long" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this project", "type": "string" } ] }, { "name": "updateIpAddress", "description": "Updates an IP address", "isasync": true, "related": "associateIpAddress,listPublicIpAddresses", "params": [ { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "fordisplay", "description": "an optional field, whether to the display the IP to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "the ID of the public IP address to update", "type": "uuid", "length": 255, "required": true, "related": "updateIpAddress,associateIpAddress,listPublicIpAddresses" } ], "response": [ { "name": "networkid", "description": "the ID of the Network where ip belongs to", "type": "string" }, { "name": "associatednetworkname", "description": "the name of the Network associated with the IP address", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "virtualmachinedisplayname", "description": "virtual machine display name the ip address is assigned to (not null only for static nat Ip)", "type": "string" }, { "name": "zonename", "description": "the name of the zone the public IP address belongs to", "type": "string" }, { "name": "domainid", "description": "the domain ID the public IP address is associated with", "type": "string" }, { "name": "allocated", "description": "date the public IP address was acquired", "type": "date" }, { "name": "associatednetworkid", "description": "the ID of the Network associated with the IP address", "type": "string" }, { }, { "name": "zoneid", "description": "the ID of the zone the public IP address belongs to", "type": "string" }, { }, { "name": "state", "description": "State of the ip address. Can be: Allocatin, Allocated and Releasing", "type": "string" }, { "name": "ipaddress", "description": "public IP address", "type": "string" }, { "name": "virtualmachineid", "description": "virtual machine id the ip address is assigned to (not null only for static nat Ip)", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with ip address", "type": "list", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "vmipaddress", "description": "virtual machine (dnat) ip address (not null only for static nat Ip)", "type": "string" }, { "name": "vlanid", "description": "the ID of the VLAN associated with the IP address. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "purpose", "description": "purpose of the IP address. In Acton this value is not null for Ips with isSystem=true, and can have either StaticNat or LB value", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "isportable", "description": "is public IP portable across the zones", "type": "boolean" }, { "name": "domain", "description": "the domain the public IP address is associated with", "type": "string" }, { "name": "account", "description": "the account the public IP address is associated with", "type": "string" }, { "name": "fordisplay", "description": "is public ip for display to the regular user", "type": "boolean" }, { "name": "id", "description": "public IP address id", "type": "string" }, { "name": "isstaticnat", "description": "true if this ip is for static nat, false otherwise", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the IP address", "type": "boolean" }, { "name": "issystem", "description": "true if this ip is system ip (was allocated as a part of deployVm or createLbRule)", "type": "boolean" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "vlanname", "description": "the VLAN associated with the IP address", "type": "string" }, { "name": "vpcid", "description": "VPC the ip belongs to", "type": "string" }, { "name": "issourcenat", "description": "true if the IP address is a source nat address, false otherwise", "type": "boolean" }, { "name": "virtualmachinename", "description": "virtual machine name the ip address is assigned to (not null only for static nat Ip)", "type": "string" } ] }, { "name": "getApiLimit", "description": "Get API limit count for the caller", "isasync": false, "related": "", "params": [ ], "response": [ { "name": "accountid", "description": "the account uuid of the api remaining count", "type": "string" }, { "name": "apiAllowed", "description": "currently allowed number of apis", "type": "int" }, { }, { "name": "account", "description": "the account name of the api remaining count", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "apiIssued", "description": "number of api already issued", "type": "int" }, { "name": "expireAfter", "description": "seconds left to reset counters", "type": "long" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteStorageNetworkIpRange", "description": "Deletes a storage network IP Range.", "since": "3.0.0", "isasync": true, "params": [ { "name": "id", "description": "the uuid of the storage network ip range", "type": "uuid", "length": 255, "required": true, "related": "createStorageNetworkIpRange" } ], "response": [ { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "migrateNetwork", "description": "moves a network to another physical network", "since": "4.11.0", "isasync": true, "related": "listNetworks,updateNetwork,createNetwork", "params": [ { "name": "networkofferingid", "description": "network offering ID", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "resume", "description": "true if previous network migration cmd failed", "type": "boolean", "length": 255, "required": false }, { "name": "networkid", "description": "the ID of the network", "type": "uuid", "length": 255, "required": true, "related": "migrateNetwork,listNetworks,updateNetwork,createNetwork" } ], "response": [ { "name": "broadcastdomaintype", "description": "Broadcast domain type of the network", "type": "string" }, { "name": "strechedl2subnet", "description": "true if network can span multiple zones", "type": "boolean" }, { "name": "cidr", "description": "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR", "type": "string" }, { "name": "state", "description": "state of the network", "type": "string" }, { "name": "networkofferingdisplaytext", "description": "display text of the network offering the network is created from", "type": "string" }, { "name": "name", "description": "the name of the network", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "subdomainaccess", "description": "true if users from subdomains can access the domain level network", "type": "boolean" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { "name": "zonesnetworkspans", "description": "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", "type": "set" }, { }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "ispersistent", "description": "list networks that are persistent", "type": "boolean" }, { "name": "dns2", "description": "the second DNS for the network", "type": "string" }, { "name": "vpcid", "description": "VPC the network belongs to", "type": "string" }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "broadcasturi", "description": "broadcast uri of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "networkofferingavailability", "description": "availability of the network offering the network is created from", "type": "string" }, { "name": "acltype", "description": "acl type - access type to the network", "type": "string" }, { "name": "gateway", "description": "the network's gateway", "type": "string" }, { "name": "id", "description": "the id of the network", "type": "string" }, { "name": "isdefault", "description": "true if network is default, false otherwise", "type": "boolean" }, { "name": "account", "description": "the owner of the network", "type": "string" }, { "name": "restartrequired", "description": "true network requires restart", "type": "boolean" }, { "name": "externalid", "description": "The external id of the network", "type": "string" }, { "name": "networkofferingconservemode", "description": "true if network offering is ip conserve mode enabled", "type": "boolean" }, { "name": "specifyipranges", "description": "true if network supports specifying ip ranges, false otherwise", "type": "boolean" }, { "name": "canusefordeploy", "description": "list networks available for vm deployment", "type": "boolean" }, { "name": "networkofferingname", "description": "name of the network offering the network is created from", "type": "string" }, { "name": "type", "description": "the type of the network", "type": "string" }, { "name": "service", "description": "the list of services", "type": "list", "response": [ { "name": "name", "description": "the service name", "type": "string" }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "name", "description": "the provider name", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" } ] }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "name", "description": "the capability name", "type": "string" }, { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" } ] } ] }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with network", "type": "list", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "displaytext", "description": "the displaytext of the network", "type": "string" }, { "name": "netmask", "description": "the network's netmask", "type": "string" }, { "name": "networkcidr", "description": "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE", "type": "string" }, { "name": "displaynetwork", "description": "an optional field, whether to the display the network to the end user or not.", "type": "boolean" }, { }, { "name": "networkofferingid", "description": "network offering id the network is created from", "type": "string" }, { "name": "related", "description": "related to what other network configuration", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "issystem", "description": "true if network is system, false otherwise", "type": "boolean" }, { "name": "traffictype", "description": "the traffic type of the network", "type": "string" }, { "name": "zonename", "description": "the name of the zone the network belongs to", "type": "string" }, { "name": "zoneid", "description": "zone id of the network", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "dns1", "description": "the first DNS for the network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "vlan", "description": "The vlan of the network. This parameter is visible to ROOT admins only", "type": "string" }, { "name": "reservediprange", "description": "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes", "type": "string" }, { "name": "aclid", "description": "ACL Id associated with the VPC network", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "redundantrouter", "description": "If the network has redundant routers enabled", "type": "boolean" } ] }, { "name": "configureSimulatorHAProviderState", "description": "configures simulator HA provider state for a host for probing and testing", "since": "4.11", "isasync": false, "params": [ { "name": "health", "description": "Set true is haprovider for simulator host should be healthy", "type": "boolean", "length": 255, "required": true }, { "name": "recover", "description": "Set true is haprovider for simulator host should be be recoverable", "type": "boolean", "length": 255, "required": true }, { "name": "activity", "description": "Set true is haprovider for simulator host should have activity", "type": "boolean", "length": 255, "required": true }, { "name": "fence", "description": "Set true is haprovider for simulator host should be be fence-able", "type": "boolean", "length": 255, "required": true }, { "name": "hostid", "description": "List by host ID", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "updateIsoPermissions", "description": "Updates ISO permissions", "isasync": false, "params": [ { "name": "ispublic", "description": "true for public template/iso, false for private templates/isos", "type": "boolean", "length": 255, "required": false }, { "name": "projectids", "description": "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.", "type": "list", "length": 255, "required": false, "related": "activateProject" }, { "name": "op", "description": "permission operator (add, remove, reset)", "type": "string", "length": 255, "required": false }, { "name": "accounts", "description": "a comma delimited list of accounts. If specified, \"op\" parameter has to be passed in.", "type": "list", "length": 255, "required": false }, { "name": "id", "description": "the template ID", "type": "uuid", "length": 255, "required": true, "related": "registerTemplate,registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "isextractable", "description": "true if the template/iso is extractable, false other wise. Can be set only by root admin", "type": "boolean", "length": 255, "required": false }, { "name": "isfeatured", "description": "true for featured template/iso, false otherwise", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { } ] }, { "name": "registerTemplate", "description": "Registers an existing template into the CloudStack cloud.", "isasync": false, "related": "registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates", "params": [ { "name": "zoneids", "description": "A list of zone ids where the template will be hosted. Use this parameter if the template needs to be registered to multiple zones in one go. Use zoneid if the template needs to be registered to only one zone.Passing only -1 to this will cause the template to be registered as a cross zone template and will be copied to all zones. ", "type": "list", "length": 255, "required": false, "related": "createZone,listZones" }, { "name": "ispublic", "description": "true if the template is available to all accounts; default is true", "type": "boolean", "length": 255, "required": false }, { "name": "format", "description": "the format for the template. Possible values include QCOW2, RAW, VHD and OVA.", "type": "string", "length": 255, "required": true }, { "name": "requireshvm", "description": "true if this template requires HVM", "type": "boolean", "length": 255, "required": false }, { "name": "sshkeyenabled", "description": "true if the template supports the sshkey upload feature; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "url", "description": "the URL of where the template is hosted. Possible URL include http:// and https://", "type": "string", "length": 2048, "required": true }, { "name": "displaytext", "description": "the display text of the template. This is usually used for display purposes.", "type": "string", "length": 4096, "required": true }, { "name": "ostypeid", "description": "the ID of the OS Type that best represents the OS of this template.", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "directdownload", "description": "true if template should bypass Secondary Storage and be downloaded to Primary Storage on deployment", "type": "boolean", "length": 255, "required": false }, { "name": "zoneid", "description": "the ID of the zone the template is to be hosted on", "type": "uuid", "length": 255, "required": false, "related": "createZone,listZones" }, { "name": "passwordenabled", "description": "true if the template supports the password reset feature; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "checksum", "description": "the checksum value of this template. The parameter containing the checksum will be considered a MD5sum if it is not prefixed\n and just a plain ascii/utf8 representation of a hexadecimal string. If it is required to\n use another algorithm the hexadecimal string is to be prefixed with a string of the form,\n \"{}\", not including the double quotes. In this is the exact string\n representing the java supported algorithm, i.e. MD5 or SHA-256. Note that java does not\n contain an algorithm called SHA256 or one called sha-256, only SHA-256.", "type": "string", "length": 255, "required": false }, { "name": "hypervisor", "description": "the target hypervisor for the template", "type": "string", "length": 255, "required": true }, { "name": "domainid", "description": "an optional domainId. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "isextractable", "description": "true if the template or its derivatives are extractable; default is false", "type": "boolean", "length": 255, "required": false }, { "name": "isrouting", "description": "true if the template type is routing i.e., if template is used to deploy router", "type": "boolean", "length": 255, "required": false }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean", "length": 255, "required": false }, { "name": "account", "description": "an optional accountName. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "bits", "description": "32 or 64 bits support. 64 by default", "type": "integer", "length": 255, "required": false }, { "name": "details", "description": "Template details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].hypervisortoolsversion=xenserver61", "type": "map", "length": 255, "required": false }, { "name": "name", "description": "the name of the template", "type": "string", "length": 255, "required": true }, { "name": "projectid", "description": "Register template for the project", "type": "uuid", "length": 255, "required": false, "related": "activateProject" }, { "name": "templatetag", "description": "the tag for this template.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "zoneid", "description": "the ID of the zone for this template", "type": "string" }, { "name": "zonename", "description": "the name of the zone for this template", "type": "string" }, { "name": "status", "description": "the status of the template", "type": "string" }, { "name": "details", "description": "additional key/value details tied with template", "type": "map" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "templatetype", "description": "the type of the template", "type": "string" }, { "name": "format", "description": "the format of the template.", "type": "imageformat" }, { "name": "parenttemplateid", "description": "if Datadisk template, then id of the root disk template this template belongs to", "type": "string" }, { "name": "isready", "description": "true if the template is ready to be deployed from, false otherwise.", "type": "boolean" }, { "name": "name", "description": "the template name", "type": "string" }, { "name": "passwordenabled", "description": "true if the reset password feature is enabled, false otherwise", "type": "boolean" }, { "name": "displaytext", "description": "the template display text", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "isfeatured", "description": "true if this template is a featured template, false otherwise", "type": "boolean" }, { "name": "bootable", "description": "true if the ISO is bootable, false otherwise", "type": "boolean" }, { "name": "domain", "description": "the name of the domain to which the template belongs", "type": "string" }, { "name": "hostname", "description": "the name of the secondary storage host for the template", "type": "string" }, { "name": "bits", "description": "the processor bit size", "type": "int" }, { "name": "sshkeyenabled", "description": "true if template is sshkey enabled, false otherwise", "type": "boolean" }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" }, { "name": "isdynamicallyscalable", "description": "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory", "type": "boolean" }, { "name": "checksum", "description": "checksum of the template", "type": "string" }, { "name": "project", "description": "the project name of the template", "type": "string" }, { "name": "ostypename", "description": "the name of the OS type for this template.", "type": "string" }, { "name": "sourcetemplateid", "description": "the template ID of the parent template if present", "type": "string" }, { "name": "childtemplates", "description": "if root disk template, then ids of the datas disk templates this template owns", "type": "set" }, { "name": "ostypeid", "description": "the ID of the OS type for this template.", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "requireshvm", "description": "true if template requires HVM enabled, false otherwise", "type": "boolean" }, { "name": "size", "description": "the size of the template", "type": "long" }, { "name": "created", "description": "the date this template was created", "type": "date" }, { "name": "directdownload", "description": "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage", "type": "boolean" }, { "name": "projectid", "description": "the project id of the template", "type": "string" }, { "name": "physicalsize", "description": "the physical size of the template", "type": "long" }, { "name": "account", "description": "the account name to which the template belongs", "type": "string" }, { }, { "name": "templatetag", "description": "the tag of this template", "type": "string" }, { "name": "accountid", "description": "the account id to which the template belongs", "type": "string" }, { "name": "crossZones", "description": "true if the template is managed across all Zones, false otherwise", "type": "boolean" }, { "name": "removed", "description": "the date this template was removed", "type": "date" }, { "name": "isextractable", "description": "true if the template is extractable, false otherwise", "type": "boolean" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { "name": "hostid", "description": "the ID of the secondary storage host for the template", "type": "string" } ] }, { "name": "deleteVPCOffering", "description": "Deletes VPC offering", "isasync": true, "params": [ { "name": "id", "description": "the ID of the VPC offering", "type": "uuid", "length": 255, "required": true, "related": "updateVPCOffering" } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { } ] }, { "name": "listSimulatorHAStateTransitions", "description": "list recent simulator HA state transitions for a host for probing and testing", "since": "4.11", "isasync": false, "related": "", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "hostid", "description": "List by host ID", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "event", "description": "the event that caused state transition", "type": "string" }, { }, { "name": "activitycounter", "description": "the activity counter", "type": "long" }, { "name": "recoverycounter", "description": "the recovery counter", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hastate", "description": "the ha state", "type": "string" }, { }, { "name": "prevhastate", "description": "the previous ha state", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "addStratosphereSsp", "description": "Adds stratosphere ssp server", "isasync": false, "related": "", "params": [ { "name": "username", "description": "stratosphere ssp api username", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the zone ID", "type": "uuid", "length": 255, "required": true, "related": "createZone,listZones" }, { "name": "password", "description": "stratosphere ssp api password", "type": "string", "length": 255, "required": false }, { "name": "url", "description": "stratosphere ssp server url", "type": "string", "length": 255, "required": true }, { "name": "tenantuuid", "description": "stratosphere ssp tenant uuid", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "stratosphere ssp api name", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "zoneid", "description": "zone which this ssp controls", "type": "string" }, { "name": "name", "description": "name", "type": "string" }, { "name": "url", "description": "url of ssp endpoint", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hostid", "description": "server id of the stratosphere ssp server", "type": "string" }, { }, { } ] }, { "name": "updateNuageVspDevice", "description": "Update a Nuage VSP device", "since": "4.6", "isasync": true, "related": "", "params": [ { "name": "hostname", "description": "the hostname of the Nuage VSD", "type": "string", "length": 255, "required": false }, { "name": "apiversion", "description": "the version of the API to use to communicate to Nuage VSD", "type": "string", "length": 255, "required": false }, { "name": "port", "description": "the port to communicate to Nuage VSD", "type": "integer", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "the ID of the physical network in to which Nuage VSP is added", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" }, { "name": "password", "description": "the password of CMS user in Nuage VSD", "type": "string", "length": 255, "required": false }, { "name": "username", "description": "the user name of the CMS user in Nuage VSD", "type": "string", "length": 255, "required": false }, { "name": "retrycount", "description": "the number of retries on failure to communicate to Nuage VSD", "type": "integer", "length": 255, "required": false }, { "name": "retryinterval", "description": "the time to wait after failure before retrying to communicate to Nuage VSD", "type": "long", "length": 255, "required": false } ], "response": [ { "name": "physicalnetworkid", "description": "the ID of the physical network to which this Nuage VSP belongs to", "type": "string" }, { "name": "retrycount", "description": "the number of retries on failure to communicate to Nuage VSD", "type": "int" }, { "name": "vspdeviceid", "description": "the device id of the Nuage VSD", "type": "string" }, { }, { "name": "apiversion", "description": "the version of the API to use to communicate to Nuage VSD", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hostname", "description": "the hostname of the Nuage VSD", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "cmsid", "description": "the CMS ID generated by the Nuage VSD", "type": "string" }, { "name": "provider", "description": "the service provider name corresponding to this Nuage VSP device", "type": "string" }, { "name": "nuagedevicename", "description": "the name of the Nuage VSP device", "type": "string" }, { "name": "retryinterval", "description": "the time to wait after failure before retrying to communicate to Nuage VSD", "type": "long" }, { "name": "port", "description": "the port to communicate to Nuage VSD", "type": "int" } ] }, { "name": "deleteNetworkACL", "description": "Deletes a network ACL", "isasync": true, "params": [ { "name": "id", "description": "the ID of the network ACL", "type": "uuid", "length": 255, "required": true, "related": "moveNetworkAclItem" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "findStoragePoolsForMigration", "description": "Lists storage pools available for migration of a volume.", "isasync": false, "related": "enableStorageMaintenance,cancelStorageMaintenance,createStoragePool", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "the ID of the volume", "type": "uuid", "length": 255, "required": true, "related": "createVolume,createVolume,listVolumes,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "provider", "description": "Storage provider for this pool", "type": "string" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "storagecapabilities", "description": "the storage pool capabilities", "type": "map" }, { }, { "name": "id", "description": "the ID of the storage pool", "type": "string" }, { "name": "zonename", "description": "the Zone name of the storage pool", "type": "string" }, { "name": "disksizetotal", "description": "the total disk size of the storage pool", "type": "long" }, { }, { "name": "capacityiops", "description": "IOPS CloudStack can provision from this storage pool", "type": "long" }, { "name": "state", "description": "the state of the storage pool", "type": "storagepoolstatus" }, { "name": "ipaddress", "description": "the IP address of the storage pool", "type": "string" }, { "name": "disksizeused", "description": "the host's currently used disk size", "type": "long" }, { "name": "type", "description": "the storage pool type", "type": "string" }, { "name": "podid", "description": "the Pod ID of the storage pool", "type": "string" }, { "name": "podname", "description": "the Pod name of the storage pool", "type": "string" }, { "name": "tags", "description": "the tags for the storage pool", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the storage pool", "type": "string" }, { "name": "created", "description": "the date and time the storage pool was created", "type": "date" }, { "name": "suitableformigration", "description": "true if this pool is suitable to migrate a volume, false otherwise", "type": "boolean" }, { "name": "scope", "description": "the scope of the storage pool", "type": "string" }, { "name": "name", "description": "the name of the storage pool", "type": "string" }, { "name": "path", "description": "the storage pool path", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "clustername", "description": "the name of the cluster for the storage pool", "type": "string" }, { "name": "overprovisionfactor", "description": "the overprovisionfactor for the storage pool", "type": "string" }, { "name": "allocatediops", "description": "total min IOPS currently in use by volumes", "type": "long" }, { "name": "hypervisor", "description": "the hypervisor type of the storage pool", "type": "string" }, { "name": "clusterid", "description": "the ID of the cluster for the storage pool", "type": "string" } ] }, { "name": "createStoragePool", "description": "Creates a storage pool.", "isasync": false, "related": "enableStorageMaintenance,cancelStorageMaintenance", "params": [ { "name": "provider", "description": "the storage provider name", "type": "string", "length": 255, "required": false }, { "name": "capacitybytes", "description": "bytes CloudStack can provision from this storage pool", "type": "long", "length": 255, "required": false }, { "name": "name", "description": "the name for the storage pool", "type": "string", "length": 255, "required": true }, { "name": "url", "description": "the URL of the storage pool", "type": "string", "length": 255, "required": true }, { "name": "zoneid", "description": "the Zone ID for the storage pool", "type": "uuid", "length": 255, "required": true, "related": "createZone,listZones" }, { "name": "managed", "description": "whether the storage should be managed by CloudStack", "type": "boolean", "length": 255, "required": false }, { "name": "hypervisor", "description": "hypervisor type of the hosts in zone that will be attached to this storage pool. KVM, VMware supported as of now.", "type": "string", "length": 255, "required": false }, { "name": "clusterid", "description": "the cluster ID for the storage pool", "type": "uuid", "length": 255, "required": false, "related": "addCluster" }, { "name": "capacityiops", "description": "IOPS CloudStack can provision from this storage pool", "type": "long", "length": 255, "required": false }, { "name": "scope", "description": "the scope of the storage: cluster or zone", "type": "string", "length": 255, "required": false }, { "name": "details", "description": "the details for the storage pool", "type": "map", "length": 255, "required": false }, { "name": "tags", "description": "the tags for the storage pool", "type": "string", "length": 255, "required": false }, { "name": "podid", "description": "the Pod ID for the storage pool", "type": "uuid", "length": 255, "required": false, "related": "createManagementNetworkIpRange,updatePod" } ], "response": [ { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "clustername", "description": "the name of the cluster for the storage pool", "type": "string" }, { }, { "name": "created", "description": "the date and time the storage pool was created", "type": "date" }, { "name": "hypervisor", "description": "the hypervisor type of the storage pool", "type": "string" }, { "name": "path", "description": "the storage pool path", "type": "string" }, { "name": "tags", "description": "the tags for the storage pool", "type": "string" }, { "name": "suitableformigration", "description": "true if this pool is suitable to migrate a volume, false otherwise", "type": "boolean" }, { "name": "clusterid", "description": "the ID of the cluster for the storage pool", "type": "string" }, { }, { "name": "id", "description": "the ID of the storage pool", "type": "string" }, { "name": "podname", "description": "the Pod name of the storage pool", "type": "string" }, { "name": "zonename", "description": "the Zone name of the storage pool", "type": "string" }, { "name": "disksizetotal", "description": "the total disk size of the storage pool", "type": "long" }, { "name": "storagecapabilities", "description": "the storage pool capabilities", "type": "map" }, { "name": "capacityiops", "description": "IOPS CloudStack can provision from this storage pool", "type": "long" }, { "name": "provider", "description": "Storage provider for this pool", "type": "string" }, { "name": "state", "description": "the state of the storage pool", "type": "storagepoolstatus" }, { "name": "podid", "description": "the Pod ID of the storage pool", "type": "string" }, { "name": "name", "description": "the name of the storage pool", "type": "string" }, { "name": "allocatediops", "description": "total min IOPS currently in use by volumes", "type": "long" }, { "name": "ipaddress", "description": "the IP address of the storage pool", "type": "string" }, { "name": "scope", "description": "the scope of the storage pool", "type": "string" }, { "name": "type", "description": "the storage pool type", "type": "string" }, { "name": "disksizeused", "description": "the host's currently used disk size", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "zoneid", "description": "the Zone ID of the storage pool", "type": "string" }, { "name": "overprovisionfactor", "description": "the overprovisionfactor for the storage pool", "type": "string" } ] }, { "name": "addOpenDaylightController", "description": "Adds an OpenDyalight controler", "isasync": true, "related": "", "params": [ { "name": "url", "description": "Api URL of the OpenDaylight Controller.", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "Credential to access the OpenDaylight API", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "Username to access the OpenDaylight API", "type": "string", "length": 255, "required": true }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "createPhysicalNetwork" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "username", "description": "the username to authenticate to the controller", "type": "string" }, { "name": "url", "description": "the url of the controller api", "type": "string" }, { "name": "id", "description": "device id of the controller", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this controller belongs to", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "the name assigned to the controller", "type": "string" }, { }, { } ] }, { "name": "createZone", "description": "Creates a Zone.", "isasync": false, "related": "listZones", "params": [ { "name": "allocationstate", "description": "Allocation state of this Zone for allocation of new resources", "type": "string", "length": 255, "required": false }, { "name": "internaldns2", "description": "the second internal DNS for the Zone", "type": "string", "length": 255, "required": false }, { "name": "localstorageenabled", "description": "true if local storage offering enabled, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "networktype", "description": "network type of the zone, can be Basic or Advanced", "type": "string", "length": 255, "required": true }, { "name": "internaldns1", "description": "the first internal DNS for the Zone", "type": "string", "length": 255, "required": true }, { "name": "securitygroupenabled", "description": "true if network is security group enabled, false otherwise", "type": "boolean", "length": 255, "required": false }, { "name": "domain", "description": "Network domain name for the networks in the zone", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "the name of the Zone", "type": "string", "length": 255, "required": true }, { "name": "domainid", "description": "the ID of the containing domain, null for public zones", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "dns1", "description": "the first DNS for the Zone", "type": "string", "length": 255, "required": true }, { "name": "dns2", "description": "the second DNS for the Zone", "type": "string", "length": 255, "required": false }, { "name": "ip6dns1", "description": "the first DNS for IPv6 network in the Zone", "type": "string", "length": 255, "required": false }, { "name": "ip6dns2", "description": "the second DNS for IPv6 network in the Zone", "type": "string", "length": 255, "required": false }, { "name": "guestcidraddress", "description": "the guest CIDR address for the Zone", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "domainid", "description": "the UUID of the containing domain, null for public zones", "type": "string" }, { }, { "name": "resourcedetails", "description": "Meta data associated with the zone (key/value pairs)", "type": "map" }, { "name": "displaytext", "description": "the display text of the zone", "type": "string" }, { "name": "allocationstate", "description": "the allocation state of the cluster", "type": "string" }, { "name": "internaldns2", "description": "the second internal DNS for the Zone", "type": "string" }, { "name": "domainname", "description": "the name of the containing domain, null for public zones", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with zone.", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] }, { "name": "internaldns1", "description": "the first internal DNS for the Zone", "type": "string" }, { "name": "guestcidraddress", "description": "the guest CIDR address for the Zone", "type": "string" }, { "name": "zonetoken", "description": "Zone Token", "type": "string" }, { "name": "networktype", "description": "the network type of the zone; can be Basic or Advanced", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "capacity", "description": "the capacity of the Zone", "type": "list", "response": [ { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "name", "description": "the capacity name", "type": "string" } ] }, { "name": "domain", "description": "Network domain name for the networks in the zone", "type": "string" }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the Zone", "type": "string" }, { "name": "id", "description": "Zone id", "type": "string" }, { "name": "securitygroupsenabled", "description": "true if security groups support is enabled, false otherwise", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "dhcpprovider", "description": "the dhcp Provider for the Zone", "type": "string" }, { "name": "name", "description": "Zone name", "type": "string" }, { }, { "name": "localstorageenabled", "description": "true if local storage offering enabled, false otherwise", "type": "boolean" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the Zone", "type": "string" }, { "name": "dns2", "description": "the second DNS for the Zone", "type": "string" }, { "name": "dns1", "description": "the first DNS for the Zone", "type": "string" }, { "name": "description", "description": "Zone description", "type": "string" } ] }, { "name": "createStorageNetworkIpRange", "description": "Creates a Storage network IP range.", "since": "3.0.0", "isasync": true, "related": "", "params": [ { "name": "startip", "description": "the beginning IP address", "type": "string", "length": 255, "required": true }, { "name": "endip", "description": "the ending IP address", "type": "string", "length": 255, "required": false }, { "name": "podid", "description": "UUID of pod where the ip range belongs to", "type": "uuid", "length": 255, "required": true, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "gateway", "description": "the gateway for storage network", "type": "string", "length": 255, "required": true }, { "name": "netmask", "description": "the netmask for storage network", "type": "string", "length": 255, "required": true }, { "name": "vlan", "description": "Optional. The vlan the ip range sits on, default to Null when it is not specificed which means you network is not on any Vlan. This is mainly for Vmware as other hypervisors can directly reterive bridge from pyhsical network traffic type table", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "netmask", "description": "the netmask of the storage network IP range", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "gateway", "description": "the gateway of the storage network IP range", "type": "string" }, { "name": "id", "description": "the uuid of storage network IP range.", "type": "string" }, { "name": "endip", "description": "the end ip of the storage network IP range", "type": "string" }, { "name": "startip", "description": "the start ip of the storage network IP range", "type": "string" }, { }, { "name": "networkid", "description": "the network uuid of storage network IP range", "type": "string" }, { "name": "podid", "description": "the Pod uuid for the storage network IP range", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "vlan", "description": "the ID or VID of the VLAN.", "type": "integer" }, { "name": "zoneid", "description": "the Zone uuid of the storage network IP range", "type": "string" }, { } ] }, { "name": "listDomainChildren", "description": "Lists all children domains belonging to a specified domain", "isasync": false, "related": "listDomains", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "list children domains by name", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "list children domain by parent domain ID.", "type": "uuid", "length": 255, "required": false, "related": "listDomains,listDomainChildren" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "isrecursive", "description": "to return the entire tree, use the value \"true\". To return the first level children, use the value \"false\".", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "level", "description": "the level of the domain", "type": "integer" }, { "name": "path", "description": "the path of the domain", "type": "string" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this domain", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the domain can own", "type": "string" }, { "name": "projecttotal", "description": "the total number of projects being administrated by this domain", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this domain", "type": "string" }, { "name": "vpclimit", "description": "the total number of vpcs the domain can own", "type": "string" }, { "name": "projectlimit", "description": "the total number of projects the domain can own", "type": "string" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this domain to acquire", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this domain", "type": "string" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this domain", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this domain to acquire", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this domain", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by domain", "type": "long" }, { "name": "id", "description": "the ID of the domain", "type": "string" }, { "name": "memorylimit", "description": "the total memory (in MB) the domain can own", "type": "string" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this domain", "type": "string" }, { "name": "parentdomainid", "description": "the domain ID of the parent domain", "type": "string" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this domain", "type": "long" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this domain", "type": "long" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by domain", "type": "long" }, { }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "haschild", "description": "whether the domain has one or more sub-domains", "type": "boolean" }, { "name": "iplimit", "description": "the total number of public ip addresses this domain can acquire", "type": "string" }, { "name": "volumetotal", "description": "the total volume being used by this domain", "type": "long" }, { "name": "vpctotal", "description": "the total number of vpcs owned by domain", "type": "long" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this domain", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this domain", "type": "string" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this domain", "type": "string" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this domain", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this domain", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by domain", "type": "float" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this domain", "type": "long" }, { "name": "parentdomainname", "description": "the domain name of the parent domain", "type": "string" }, { "name": "state", "description": "the state of the domain", "type": "string" }, { }, { "name": "volumelimit", "description": "the total volume which can be used by this domain", "type": "string" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this domain", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by domain", "type": "long" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by domain", "type": "long" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this domain", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this domain", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the domain can own", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the domain can own", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the domain can own", "type": "string" }, { "name": "name", "description": "the name of the domain", "type": "string" } ] }, { "name": "getVMPassword", "description": "Returns an encrypted password for the VM", "isasync": false, "related": "", "params": [ { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "encryptedpassword", "description": "The base64 encoded encrypted password of the VM", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "assignToGlobalLoadBalancerRule", "description": "Assign load balancer rule or list of load balancer rules to a global load balancer rules.", "isasync": true, "params": [ { "name": "loadbalancerrulelist", "description": "the list load balancer rules that will be assigned to global load balancer rule", "type": "list", "length": 255, "required": true, "related": "" }, { "name": "gslblbruleweightsmap", "description": "Map of LB rule id's and corresponding weights (between 1-100) in the GSLB rule, if not specified weight of a LB rule is defaulted to 1. Specified as 'gslblbruleweightsmap[0].loadbalancerid=UUID&gslblbruleweightsmap[0].weight=10'", "type": "map", "length": 255, "required": false }, { "name": "id", "description": "the ID of the global load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "configureOvsElement", "description": "Configures an ovs element.", "isasync": true, "related": "", "params": [ { "name": "enabled", "description": "Enabled/Disabled the service provider", "type": "boolean", "length": 255, "required": true }, { "name": "id", "description": "the ID of the ovs provider", "type": "uuid", "length": 255, "required": true, "related": "configureOvsElement" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "nspid", "description": "the physical network service provider id of the provider", "type": "string" }, { }, { "name": "account", "description": "the account associated with the provider", "type": "string" }, { "name": "id", "description": "the id of the ovs", "type": "string" }, { "name": "domain", "description": "the domain associated with the provider", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "domainid", "description": "the domain ID associated with the provider", "type": "string" }, { "name": "enabled", "description": "Enabled/Disabled the service provider", "type": "boolean" } ] }, { "name": "uploadTemplateDirectDownloadCertificate", "description": "Upload a certificate for HTTPS direct template download on KVM hosts", "since": "4.11.0", "isasync": false, "params": [ { "name": "certificate", "description": "SSL certificate", "type": "string", "length": 65535, "required": true }, { "name": "name", "description": "Name for the uploaded certificate", "type": "string", "length": 255, "required": true }, { "name": "hypervisor", "description": "Hypervisor type", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "addImageStoreS3", "description": "Adds S3 Image Store", "since": "4.7.0", "isasync": false, "related": "listImageStores", "params": [ { "name": "maxerrorretry", "description": "Maximum number of times to retry on error", "type": "integer", "length": 255, "required": false }, { "name": "usehttps", "description": "Use HTTPS instead of HTTP", "type": "boolean", "length": 255, "required": false }, { "name": "connectiontimeout", "description": "Connection timeout (milliseconds)", "type": "integer", "length": 255, "required": false }, { "name": "sockettimeout", "description": "Socket timeout (milliseconds)", "type": "integer", "length": 255, "required": false }, { "name": "s3signer", "description": "Signer Algorithm to use, either S3SignerType or AWSS3V4SignerType", "type": "string", "length": 255, "required": false }, { "name": "endpoint", "description": "S3 endpoint", "type": "string", "length": 255, "required": true }, { "name": "usetcpkeepalive", "description": "Whether TCP keep-alive is used", "type": "boolean", "length": 255, "required": false }, { "name": "accesskey", "description": "S3 access key", "type": "string", "length": 255, "required": true }, { "name": "connectionttl", "description": "Connection TTL (milliseconds)", "type": "integer", "length": 255, "required": false }, { "name": "bucket", "description": "Name of the storage bucket", "type": "string", "length": 255, "required": true }, { "name": "secretkey", "description": "S3 secret key", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "scope", "description": "the scope of the image store", "type": "scopetype" }, { "name": "zonename", "description": "the Zone name of the image store", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the image store", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the image store", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "the name of the image store", "type": "string" }, { "name": "providername", "description": "the provider name of the image store", "type": "string" }, { "name": "url", "description": "the url of the image store", "type": "string" }, { }, { "name": "protocol", "description": "the protocol of the image store", "type": "string" } ] }, { "name": "createPhysicalNetwork", "description": "Creates a physical network", "since": "3.0.0", "isasync": true, "related": "", "params": [ { "name": "name", "description": "the name of the physical network", "type": "string", "length": 255, "required": true }, { "name": "isolationmethods", "description": "the isolation method for the physical network[VLAN/L3/GRE]", "type": "list", "length": 255, "required": false }, { "name": "vlan", "description": "the VLAN for the physical network", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "domain ID of the account owning a physical network", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "networkspeed", "description": "the speed for the physical network[1G/10G]", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID for the physical network", "type": "uuid", "length": 255, "required": true, "related": "listZones" }, { "name": "tags", "description": "Tag the physical network", "type": "list", "length": 255, "required": false }, { "name": "broadcastdomainrange", "description": "the broadcast domain range for the physical network[Pod or Zone]. In Acton release it can be Zone only in Advance zone, and Pod in Basic", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "isolationmethods", "description": "isolation methods", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the domain id of the physical network owner", "type": "string" }, { "name": "vlan", "description": "the vlan of the physical network", "type": "string" }, { "name": "zoneid", "description": "zone id of the physical network", "type": "string" }, { "name": "id", "description": "the uuid of the physical network", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "state", "description": "state of the physical network", "type": "string" }, { "name": "broadcastdomainrange", "description": "Broadcast domain range of the physical network", "type": "string" }, { "name": "tags", "description": "comma separated tag", "type": "string" }, { "name": "name", "description": "name of the physical network", "type": "string" }, { "name": "networkspeed", "description": "the speed of the physical network", "type": "string" }, { } ] }, { "name": "listAutoScaleVmGroups", "description": "Lists autoscale vm groups.", "isasync": false, "related": "", "params": [ { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "vmprofileid", "description": "the ID of the profile", "type": "uuid", "length": 255, "required": false, "related": "createAutoScaleVmProfile" }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject" }, { "name": "lbruleid", "description": "the ID of the loadbalancer", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "the ID of the autoscale vm group", "type": "uuid", "length": 255, "required": false, "related": "listAutoScaleVmGroups" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "policyid", "description": "the ID of the policy", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the availability zone ID", "type": "uuid", "length": 255, "required": false, "related": "listZones" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "vmprofileid", "description": "the autoscale profile that contains information about the vms in the vm group.", "type": "string" }, { "name": "scaleuppolicies", "description": "list of scaleup autoscale policies", "type": "list" }, { "name": "project", "description": "the project name of the vm profile", "type": "string" }, { "name": "maxmembers", "description": "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.", "type": "int" }, { "name": "minmembers", "description": "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.", "type": "int" }, { "name": "id", "description": "the autoscale vm group ID", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "lbruleid", "description": "the load balancer rule ID", "type": "string" }, { "name": "interval", "description": "the frequency at which the conditions have to be evaluated", "type": "int" }, { "name": "fordisplay", "description": "is group for display to the regular user", "type": "boolean" }, { "name": "state", "description": "the current state of the AutoScale Vm Group", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the domain ID of the vm profile", "type": "string" }, { }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { }, { "name": "scaledownpolicies", "description": "list of scaledown autoscale policies", "type": "list" }, { "name": "domain", "description": "the domain name of the vm profile", "type": "string" }, { "name": "projectid", "description": "the project id vm profile", "type": "string" } ] }, { "name": "createVolume", "description": "Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.", "isasync": true, "related": "createVolume,listVolumes,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume", "params": [ { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false }, { "name": "size", "description": "Arbitrary volume size", "type": "long", "length": 255, "required": false }, { "name": "domainid", "description": "the domain ID associated with the disk offering. If used with the account parameter returns the disk volume associated with the account for the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "diskofferingid", "description": "the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "miniops", "description": "min iops", "type": "long", "length": 255, "required": false }, { "name": "maxiops", "description": "max iops", "type": "long", "length": 255, "required": false }, { "name": "displayvolume", "description": "an optional field, whether to display the volume to the end user or not.", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "the project associated with the volume. Mutually exclusive with account parameter", "type": "uuid", "length": 255, "required": false, "related": "activateProject" }, { "name": "snapshotid", "description": "the snapshot ID for the disk volume. Either diskOfferingId or snapshotId must be passed in.", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "account", "description": "the account associated with the disk volume. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "the ID of the virtual machine; to be used with snapshot Id, VM to which the volume gets attached after creation", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "name", "description": "the name of the disk volume", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the ID of the availability zone", "type": "uuid", "length": 255, "required": false, "related": "listZones" } ], "response": [ { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "diskofferingid", "description": "ID of the disk offering", "type": "string" }, { "name": "utilization", "description": "the disk utilization", "type": "string" }, { "name": "miniops", "description": "min iops of the disk volume", "type": "long" }, { "name": "vmdisplayname", "description": "display name of the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "podid", "description": "pod id of the volume", "type": "string" }, { "name": "maxiops", "description": "max iops of the disk volume", "type": "long" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the disk volume", "type": "long" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "quiescevm", "description": "need quiesce vm or not when taking snapshot", "type": "boolean" }, { "name": "displayvolume", "description": "an optional field whether to the display the volume to the end user or not.", "type": "boolean" }, { "name": "state", "description": "the state of the disk volume", "type": "string" }, { "name": "virtualmachineid", "description": "id of the virtual machine", "type": "string" }, { "name": "size", "description": "size of the disk volume", "type": "long" }, { "name": "storagetype", "description": "shared or local storage", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "zonename", "description": "name of the availability zone", "type": "string" }, { "name": "diskofferingdisplaytext", "description": "the display text of the disk offering", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hypervisor", "description": "Hypervisor the volume belongs to", "type": "string" }, { "name": "type", "description": "type of the disk volume (ROOT or DATADISK)", "type": "string" }, { "name": "podname", "description": "pod name of the volume", "type": "string" }, { "name": "vmstate", "description": "state of the virtual machine", "type": "string" }, { "name": "physicalsize", "description": "the bytes alloaated", "type": "long" }, { "name": "isextractable", "description": "true if the volume is extractable, false otherwise", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "status", "description": "the status of the volume", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the disk volume", "type": "long" }, { "name": "virtualsize", "description": "the bytes actually consumed on disk", "type": "long" }, { "name": "storageid", "description": "id of the primary storage hosting the disk volume; returned to admin user only", "type": "string" }, { "name": "zoneid", "description": "ID of the availability zone", "type": "string" }, { "name": "vmname", "description": "name of the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "name of the disk offering", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the disk volume", "type": "long" }, { "name": "name", "description": "name of the disk volume", "type": "string" }, { "name": "chaininfo", "description": "the chain info of the volume", "type": "string" }, { "name": "attached", "description": "the date the volume was attached to a VM instance", "type": "date" }, { "name": "serviceofferingname", "description": "name of the service offering for root disk", "type": "string" }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes.", "type": "string" }, { "name": "deviceid", "description": "the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached.", "type": "long" }, { "name": "serviceofferingid", "description": "ID of the service offering for root disk", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "path", "description": "the path of the volume", "type": "string" }, { "name": "created", "description": "the date the disk volume was created", "type": "date" }, { "name": "storage", "description": "name of the primary storage hosting the disk volume", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "snapshotid", "description": "ID of the snapshot from which this volume was created", "type": "string" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the disk volume", "type": "long" }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "clusterid", "description": "cluster id of the volume", "type": "string" }, { "name": "destroyed", "description": "the boolean state of whether the volume is destroyed or not", "type": "boolean" }, { "name": "id", "description": "ID of the disk volume", "type": "string" }, { "name": "clustername", "description": "cluster name where the volume is allocated", "type": "string" }, { "name": "serviceofferingdisplaytext", "description": "the display text of the service offering for root disk", "type": "string" } ] }, { "name": "createFirewallRule", "description": "Creates a firewall rule for a given IP address", "isasync": true, "related": "updateEgressFirewallRule", "params": [ { "name": "icmptype", "description": "type of the ICMP message being sent", "type": "integer", "length": 255, "required": false }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer", "length": 255, "required": false }, { "name": "ipaddressid", "description": "the IP address id of the port forwarding rule", "type": "uuid", "length": 255, "required": true, "related": "associateIpAddress,listPublicIpAddresses" }, { "name": "cidrlist", "description": "the CIDR list to forward traffic from", "type": "list", "length": 255, "required": false }, { "name": "endport", "description": "the ending port of firewall rule", "type": "integer", "length": 255, "required": false }, { "name": "type", "description": "type of firewallrule: system/user", "type": "string", "length": 255, "required": false }, { "name": "startport", "description": "the starting port of firewall rule", "type": "integer", "length": 255, "required": false }, { "name": "protocol", "description": "the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "destcidrlist", "description": "the cidr list to forward traffic to", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { }, { "name": "protocol", "description": "the protocol of the firewall rule", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "id", "description": "the ID of the firewall rule", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "endport", "description": "the ending port of firewall rule's port range", "type": "integer" }, { "name": "startport", "description": "the starting port of firewall rule's port range", "type": "integer" }, { }, { "name": "ipaddressid", "description": "the public ip address id for the firewall rule", "type": "string" }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer" }, { "name": "networkid", "description": "the network id of the firewall rule", "type": "string" }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "ipaddress", "description": "the public ip address for the firewall rule", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listVMSnapshot", "description": "List virtual machine snapshot by conditions", "since": "4.2.0", "isasync": false, "related": "createVMSnapshot", "params": [ { "name": "state", "description": "state of the virtual machine snapshot", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "lists snapshot by snapshot name or display name", "type": "string", "length": 255, "required": false }, { "name": "vmsnapshotid", "description": "The ID of the VM snapshot", "type": "uuid", "length": 255, "required": false, "related": "createVMSnapshot,listVMSnapshot" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "vmsnapshotids", "description": "the IDs of the vm snapshots, mutually exclusive with vmsnapshotid", "type": "list", "length": 255, "required": false, "since": "4.9", "related": "createVMSnapshot,listVMSnapshot" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject" }, { "name": "virtualmachineid", "description": "the ID of the vm", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "virtualmachineid", "description": "the vm ID of the vm snapshot", "type": "string" }, { }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "parentName", "description": "the parent displayName of the vm snapshot", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the vm snapshot", "type": "string" }, { "name": "current", "description": "indiates if this is current snapshot", "type": "boolean" }, { "name": "type", "description": "VM Snapshot type", "type": "string" }, { "name": "parent", "description": "the parent ID of the vm snapshot", "type": "string" }, { "name": "displayname", "description": "the display name of the vm snapshot", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { "name": "created", "description": "the create date of the vm snapshot", "type": "date" }, { "name": "description", "description": "the description of the vm snapshot", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "state", "description": "the state of the vm snapshot", "type": "state" }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "id", "description": "the ID of the vm snapshot", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "the name of the vm snapshot", "type": "string" } ] }, { "name": "moveNetworkAclItem", "description": "Move an ACL rule to a position bettwen two other ACL rules of the same ACL network list", "isasync": true, "related": "", "params": [ { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "previousaclruleid", "description": "The ID of the first rule that is right before the new position where the rule being moved is going to be placed. This value can be 'NULL' if the rule is being moved to the first position of the network ACL list.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "The ID of the network ACL rule that is being moved to a new position.", "type": "string", "length": 255, "required": true }, { "name": "nextaclruleid", "description": "The ID of the rule that is right after the new position where the rule being moved is going to be placed. This value can be 'NULL' if the rule is being moved to the last position of the network ACL list.", "type": "string", "length": 255, "required": false }, { "name": "aclconsistencyhash", "description": "Md5 hash used to check the consistency of the ACL rule list before applying the ACL rule move. This check is useful to manage concurrency problems that may happen when multiple users are editing the same ACL rule listing. The parameter is not required. Therefore, if the user does not send it, he/she is assuming the risk of moving ACL rules without checking the consistency of the access control list before executing the move. We use MD5 hash function on a String that is composed of all UUIDs of the ACL rules in concatenated in their respective order (order defined via 'number' field).", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "endport", "description": "the ending port of ACL's port range", "type": "string" }, { "name": "protocol", "description": "the protocol of the ACL", "type": "string" }, { "name": "traffictype", "description": "the traffic type for the ACL", "type": "string" }, { }, { "name": "number", "description": "Number of the ACL Item", "type": "integer" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "aclid", "description": "the ID of the ACL this item belongs to", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "startport", "description": "the starting port of ACL's port range", "type": "string" }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "reason", "description": "an explanation on why this ACL rule is being applied", "type": "string" }, { "name": "action", "description": "Action of ACL Item. Allow/Deny", "type": "string" }, { "name": "id", "description": "the ID of the ACL Item", "type": "string" }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the network ACLs", "type": "list", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "updatePod", "description": "Updates a Pod.", "isasync": false, "related": "createManagementNetworkIpRange", "params": [ { "name": "netmask", "description": "the netmask of the Pod", "type": "string", "length": 255, "required": false }, { "name": "endip", "description": "the ending IP address for the Pod", "type": "string", "length": 255, "required": false }, { "name": "allocationstate", "description": "Allocation state of this cluster for allocation of new resources", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "the name of the Pod", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the ID of the Pod", "type": "uuid", "length": 255, "required": true, "related": "createManagementNetworkIpRange,updatePod" }, { "name": "gateway", "description": "the gateway for the Pod", "type": "string", "length": 255, "required": false }, { "name": "startip", "description": "the starting IP address for the Pod", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "name", "description": "the name of the Pod", "type": "string" }, { "name": "capacity", "description": "the capacity of the Pod", "type": "list", "response": [ { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "name", "description": "the capacity name", "type": "string" } ] }, { "name": "forsystemvms", "description": "indicates if range is dedicated for CPVM and SSVM", "type": "list" }, { }, { "name": "id", "description": "the ID of the Pod", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "gateway", "description": "the gateway of the Pod", "type": "string" }, { "name": "netmask", "description": "the netmask of the Pod", "type": "string" }, { "name": "allocationstate", "description": "the allocation state of the Pod", "type": "string" }, { "name": "startip", "description": "the starting IP for the Pod", "type": "list" }, { "name": "zoneid", "description": "the Zone ID of the Pod", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "zonename", "description": "the Zone name of the Pod", "type": "string" }, { "name": "vlanid", "description": "indicates Vlan ID for the range", "type": "list" }, { "name": "endip", "description": "the ending IP for the Pod", "type": "list" } ] }, { "name": "attachIso", "description": "Attaches an ISO to a virtual machine.", "isasync": true, "related": "destroyVirtualMachine,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "id", "description": "the ID of the ISO file", "type": "uuid", "length": 255, "required": true, "related": "registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "virtualmachineid", "description": "the ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,attachIso,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" } ] }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" } ] }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" } ] }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" } ] }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "description", "description": "the description of the affinity group", "type": "string" } ] }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" } ] }, { "name": "disassociateIpAddress", "description": "Disassociates an IP address from the account.", "isasync": true, "params": [ { "name": "id", "description": "the ID of the public IP address to disassociate", "type": "uuid", "length": 255, "required": true, "related": "associateIpAddress,listPublicIpAddresses" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "listBaremetalDhcp", "description": "list baremetal dhcp servers", "isasync": false, "related": "", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "DHCP server device ID", "type": "long", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "dhcpservertype", "description": "Type of DHCP device", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "provider", "description": "name of the provider", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "url", "description": "url", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "device id of ", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this external dhcp device belongs to", "type": "string" }, { }, { "name": "dhcpservertype", "description": "name of the provider", "type": "string" } ] }, { "name": "enableStorageMaintenance", "description": "Puts storage pool into maintenance state", "isasync": true, "related": "cancelStorageMaintenance", "params": [ { "name": "id", "description": "Primary storage ID", "type": "uuid", "length": 255, "required": true, "related": "enableStorageMaintenance,cancelStorageMaintenance" } ], "response": [ { "name": "state", "description": "the state of the storage pool", "type": "storagepoolstatus" }, { "name": "capacityiops", "description": "IOPS CloudStack can provision from this storage pool", "type": "long" }, { "name": "name", "description": "the name of the storage pool", "type": "string" }, { "name": "overprovisionfactor", "description": "the overprovisionfactor for the storage pool", "type": "string" }, { "name": "disksizetotal", "description": "the total disk size of the storage pool", "type": "long" }, { "name": "disksizeused", "description": "the host's currently used disk size", "type": "long" }, { "name": "tags", "description": "the tags for the storage pool", "type": "string" }, { "name": "storagecapabilities", "description": "the storage pool capabilities", "type": "map" }, { "name": "ipaddress", "description": "the IP address of the storage pool", "type": "string" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "created", "description": "the date and time the storage pool was created", "type": "date" }, { "name": "podid", "description": "the Pod ID of the storage pool", "type": "string" }, { "name": "provider", "description": "Storage provider for this pool", "type": "string" }, { "name": "path", "description": "the storage pool path", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor type of the storage pool", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "podname", "description": "the Pod name of the storage pool", "type": "string" }, { "name": "scope", "description": "the scope of the storage pool", "type": "string" }, { "name": "id", "description": "the ID of the storage pool", "type": "string" }, { "name": "type", "description": "the storage pool type", "type": "string" }, { "name": "suitableformigration", "description": "true if this pool is suitable to migrate a volume, false otherwise", "type": "boolean" }, { "name": "allocatediops", "description": "total min IOPS currently in use by volumes", "type": "long" }, { "name": "zoneid", "description": "the Zone ID of the storage pool", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "clustername", "description": "the name of the cluster for the storage pool", "type": "string" }, { "name": "clusterid", "description": "the ID of the cluster for the storage pool", "type": "string" }, { "name": "zonename", "description": "the Zone name of the storage pool", "type": "string" } ] }, { "name": "ldapRemove", "description": "(Deprecated , use deleteLdapConfiguration) Remove the LDAP context for this site.", "since": "3.0.1", "isasync": false, "related": "", "params": [ ], "response": [ { "name": "hostname", "description": "Hostname or ip address of the ldap server eg: my.ldap.com", "type": "string" }, { "name": "queryfilter", "description": "You specify a query filter here, which narrows down the users, who can be part of this domain", "type": "string" }, { "name": "bindpass", "description": "DN password", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "ssl", "description": "Check Use SSL if the external LDAP server is configured for LDAP over SSL", "type": "string" }, { "name": "searchbase", "description": "The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "port", "description": "Specify the LDAP port if required, default is 389", "type": "string" }, { }, { }, { "name": "binddn", "description": "Specify the distinguished name of a user with the search permission on the directory", "type": "string" } ] }, { "name": "createUser", "description": "Creates a user for an account that already exists", "isasync": false, "related": "getUser", "params": [ { "name": "account", "description": "Creates the user under the specified account. If no account is specified, the username will be used as the account name.", "type": "string", "length": 255, "required": true }, { "name": "userid", "description": "User UUID, required for adding account from external provisioning system", "type": "string", "length": 255, "required": false }, { "name": "lastname", "description": "lastname", "type": "string", "length": 255, "required": true }, { "name": "email", "description": "email", "type": "string", "length": 255, "required": true }, { "name": "timezone", "description": "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "Creates the user under the specified domain. Has to be accompanied with the account parameter", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "firstname", "description": "firstname", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "Unique username.", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "Clear text password (Default hashed to SHA256SALT). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" } ] }, { "name": "listApis", "description": "lists all available apis on the server, provided by the Api Discovery plugin", "since": "4.1.0", "isasync": false, "related": "", "params": [ { "name": "name", "description": "API name", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "params", "description": "the list params the api accepts", "type": "set", "response": [ { "name": "description", "description": "description of the api parameter", "type": "string" }, { "name": "name", "description": "the name of the api parameter", "type": "string" }, { "name": "length", "description": "length of the parameter", "type": "int" }, { "name": "since", "description": "version of CloudStack the api was introduced in", "type": "string" }, { "name": "type", "description": "parameter type", "type": "string" }, { "name": "related", "description": "comma separated related apis to get the parameter", "type": "string" }, { "name": "required", "description": "true if this parameter is required for the api request", "type": "boolean" } ] }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "response", "description": "api response fields", "type": "set", "response": [ { "name": "name", "description": "the name of the api response field", "type": "string" }, { "name": "description", "description": "description of the api response field", "type": "string" }, { "name": "type", "description": "response field type", "type": "string" }, { "name": "response", "description": "api response fields", "type": "set" } ] }, { "name": "related", "description": "comma separated related apis", "type": "string" }, { "name": "since", "description": "version of CloudStack the api was introduced in", "type": "string" }, { "name": "type", "description": "response field type", "type": "string" }, { "name": "isasync", "description": "true if api is asynchronous", "type": "boolean" }, { "name": "name", "description": "the name of the api command", "type": "string" }, { "name": "description", "description": "description of the api", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "deleteBaremetalRct", "description": "deletes baremetal rack configuration text", "isasync": true, "params": [ { "name": "id", "description": "RCT id", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "createVpnGateway", "description": "Creates site to site vpn local gateway", "isasync": true, "related": "", "params": [ { "name": "vpcid", "description": "public ip address id of the vpn gateway", "type": "uuid", "length": 255, "required": true, "related": "listVPCs,createVPC,updateVPC" }, { "name": "fordisplay", "description": "an optional field, whether to the display the vpn to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "account", "description": "the owner", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "domainid", "description": "the domain id of the owner", "type": "string" }, { "name": "id", "description": "the vpn gateway ID", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "vpcid", "description": "the vpc id of this gateway", "type": "string" }, { }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "project", "description": "the project name", "type": "string" }, { "name": "projectid", "description": "the project id", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "publicip", "description": "the public IP address", "type": "string" }, { "name": "fordisplay", "description": "is vpn gateway for display to the regular user", "type": "boolean" } ] }, { "name": "createVMSnapshot", "description": "Creates snapshot for a vm.", "since": "4.2.0", "isasync": true, "related": "", "params": [ { "name": "quiescevm", "description": "quiesce vm if true", "type": "boolean", "length": 255, "required": false }, { "name": "snapshotmemory", "description": "snapshot memory if true", "type": "boolean", "length": 255, "required": false }, { "name": "description", "description": "The description of the snapshot", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "The display name of the snapshot", "type": "string", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "The ID of the vm", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { }, { "name": "account", "description": "the account associated with the disk volume", "type": "string" }, { "name": "current", "description": "indiates if this is current snapshot", "type": "boolean" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displayname", "description": "the display name of the vm snapshot", "type": "string" }, { "name": "name", "description": "the name of the vm snapshot", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the disk volume", "type": "string" }, { "name": "state", "description": "the state of the vm snapshot", "type": "state" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "type", "description": "VM Snapshot type", "type": "string" }, { "name": "id", "description": "the ID of the vm snapshot", "type": "string" }, { "name": "parent", "description": "the parent ID of the vm snapshot", "type": "string" }, { "name": "virtualmachineid", "description": "the vm ID of the vm snapshot", "type": "string" }, { "name": "parentName", "description": "the parent displayName of the vm snapshot", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the vm snapshot", "type": "string" }, { "name": "domain", "description": "the domain associated with the disk volume", "type": "string" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "description", "description": "the description of the vm snapshot", "type": "string" }, { "name": "created", "description": "the create date of the vm snapshot", "type": "date" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" } ] }, { "name": "addResourceDetail", "description": "Adds detail for the Resource.", "isasync": true, "params": [ { "name": "resourceid", "description": "resource id to create the details for", "type": "string", "length": 255, "required": true }, { "name": "details", "description": "Map of (key/value pairs)", "type": "map", "length": 255, "required": true }, { "name": "fordisplay", "description": "pass false if you want this detail to be disabled for the regular user. True by default", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "resourcetype", "description": "type of the resource", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { } ] }, { "name": "listVpnUsers", "description": "Lists vpn users", "isasync": false, "related": "addVpnUser", "params": [ { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "The uuid of the Vpn user", "type": "uuid", "length": 255, "required": false, "related": "listVpnUsers,addVpnUser" }, { "name": "username", "description": "the username of the vpn user.", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "username", "description": "the username of the vpn user", "type": "string" }, { "name": "id", "description": "the vpn userID", "type": "string" }, { "name": "account", "description": "the account of the remote access vpn", "type": "string" }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { }, { "name": "state", "description": "the state of the Vpn User", "type": "string" }, { "name": "domain", "description": "the domain name of the account of the remote access vpn", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "domainid", "description": "the domain id of the account of the remote access vpn", "type": "string" } ] }, { "name": "deleteLoadBalancer", "description": "Deletes a load balancer", "since": "4.2.0", "isasync": true, "params": [ { "name": "id", "description": "the ID of the Load Balancer", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "deleteIpForwardingRule", "description": "Deletes an IP forwarding rule", "isasync": true, "params": [ { "name": "id", "description": "the ID of the forwarding rule", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "addRegion", "description": "Adds a Region", "isasync": false, "related": "", "params": [ { "name": "id", "description": "Id of the Region", "type": "integer", "length": 255, "required": true }, { "name": "endpoint", "description": "Region service endpoint", "type": "string", "length": 255, "required": true }, { "name": "name", "description": "Name of the region", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "name", "description": "the name of the region", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "endpoint", "description": "the end point of the region", "type": "string" }, { }, { }, { "name": "portableipserviceenabled", "description": "true if security groups support is enabled, false otherwise", "type": "boolean" }, { "name": "gslbserviceenabled", "description": "true if GSLB service is enabled in the region, false otherwise", "type": "boolean" }, { "name": "id", "description": "the ID of the region", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "generateUsageRecords", "description": "Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed", "isasync": false, "params": [ { "name": "domainid", "description": "List events for the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "startdate", "description": "Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.", "type": "date", "length": 255, "required": true }, { "name": "enddate", "description": "End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.", "type": "date", "length": 255, "required": true } ], "response": [ { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "updateRolePermission", "description": "Updates a role permission order", "since": "4.9.0", "isasync": false, "params": [ { "name": "ruleorder", "description": "The parent role permission uuid, use 0 to move this rule at the top of the list", "type": "list", "length": 255, "required": false, "related": "" }, { "name": "ruleid", "description": "Role permission rule id", "type": "uuid", "length": 255, "required": false, "since": "4.11", "related": "" }, { "name": "roleid", "description": "ID of the role", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "permission", "description": "Rule permission, can be: allow or deny", "type": "string", "length": 255, "required": false, "since": "4.11" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listSSHKeyPairs", "description": "List registered keypairs", "isasync": false, "related": "", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "A key pair name to look for", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "fingerprint", "description": "A public key fingerprint to look for", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "activateProject" } ], "response": [ { "name": "name", "description": "Name of the keypair", "type": "string" }, { "name": "domainid", "description": "the domain id of the keypair owner", "type": "string" }, { }, { "name": "fingerprint", "description": "Fingerprint of the public key", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domain", "description": "the domain name of the keypair owner", "type": "string" }, { "name": "account", "description": "the owner of the keypair", "type": "string" }, { } ] }, { "name": "listAccounts", "description": "Lists accounts and provides detailed account information for listed accounts", "isasync": false, "related": "enableAccount,listAccounts", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "accounttype", "description": "list accounts by account type. Valid account types are 1 (admin), 2 (domain-admin), and 0 (user).", "type": "long", "length": 255, "required": false }, { "name": "state", "description": "list accounts by state. Valid states are enabled, disabled, and locked.", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "list account by account ID", "type": "uuid", "length": 255, "required": false, "related": "enableAccount,listAccounts,listAccounts" }, { "name": "iscleanuprequired", "description": "list accounts by cleanuprequired attribute (values are true or false)", "type": "boolean", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "name", "description": "list account by account name", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "memorylimit", "description": "the total memory (in MB) the account can own", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by account", "type": "long" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this account", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by account", "type": "long" }, { "name": "iscleanuprequired", "description": "true if the account requires cleanup", "type": "boolean" }, { "name": "projecttotal", "description": "the total number of projects being administrated by this account", "type": "long" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this account", "type": "string" }, { "name": "projectlimit", "description": "the total number of projects the account can own", "type": "string" }, { "name": "accountdetails", "description": "details for the account", "type": "map" }, { "name": "roletype", "description": "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)", "type": "string" }, { }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this account", "type": "string" }, { }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this account", "type": "string" }, { "name": "vpclimit", "description": "the total number of vpcs the account can own", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this account", "type": "integer" }, { "name": "user", "description": "the list of users associated with account", "type": "list", "response": [ { "name": "username", "description": "the user name", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" } ] }, { "name": "iplimit", "description": "the total number of public ip addresses this account can acquire", "type": "string" }, { "name": "domainid", "description": "id of the Domain the account belongs too", "type": "string" }, { "name": "name", "description": "the name of the account", "type": "string" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this account", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by account", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this account to acquire", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the account can own", "type": "string" }, { "name": "state", "description": "the state of the account", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the account can own", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this account", "type": "string" }, { "name": "accounttype", "description": "account type (admin, domain-admin, user)", "type": "short" }, { "name": "sentbytes", "description": "the total number of network traffic bytes sent", "type": "long" }, { "name": "defaultzoneid", "description": "the default zone of the account", "type": "string" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this account", "type": "long" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this account", "type": "long" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "templateavailable", "description": "the total number of templates available to be created by this account", "type": "string" }, { "name": "domain", "description": "name of the Domain the account belongs too", "type": "string" }, { "name": "id", "description": "the id of the account", "type": "string" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this account to acquire", "type": "string" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this account", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the account can own", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the account can own", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by account", "type": "long" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this account", "type": "integer" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this account", "type": "string" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this account", "type": "string" }, { "name": "groups", "description": "the list of acl groups that account belongs to", "type": "list" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this account", "type": "long" }, { "name": "isdefault", "description": "true if account is default, false otherwise", "type": "boolean" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by account", "type": "long" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this account", "type": "string" }, { "name": "volumelimit", "description": "the total volume which can be used by this account", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by account", "type": "float" }, { "name": "receivedbytes", "description": "the total number of network traffic bytes received", "type": "long" }, { "name": "volumetotal", "description": "the total volume being used by this account", "type": "long" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this account", "type": "long" } ] }, { "name": "cancelStorageMaintenance", "description": "Cancels maintenance for primary storage", "isasync": true, "related": "", "params": [ { "name": "id", "description": "the primary storage ID", "type": "uuid", "length": 255, "required": true, "related": "cancelStorageMaintenance" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "zonename", "description": "the Zone name of the storage pool", "type": "string" }, { "name": "podname", "description": "the Pod name of the storage pool", "type": "string" }, { "name": "ipaddress", "description": "the IP address of the storage pool", "type": "string" }, { "name": "tags", "description": "the tags for the storage pool", "type": "string" }, { "name": "capacityiops", "description": "IOPS CloudStack can provision from this storage pool", "type": "long" }, { "name": "name", "description": "the name of the storage pool", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "disksizeused", "description": "the host's currently used disk size", "type": "long" }, { "name": "scope", "description": "the scope of the storage pool", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor type of the storage pool", "type": "string" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "podid", "description": "the Pod ID of the storage pool", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the storage pool", "type": "string" }, { "name": "provider", "description": "Storage provider for this pool", "type": "string" }, { "name": "type", "description": "the storage pool type", "type": "string" }, { "name": "disksizetotal", "description": "the total disk size of the storage pool", "type": "long" }, { "name": "clusterid", "description": "the ID of the cluster for the storage pool", "type": "string" }, { }, { "name": "suitableformigration", "description": "true if this pool is suitable to migrate a volume, false otherwise", "type": "boolean" }, { "name": "overprovisionfactor", "description": "the overprovisionfactor for the storage pool", "type": "string" }, { "name": "allocatediops", "description": "total min IOPS currently in use by volumes", "type": "long" }, { "name": "id", "description": "the ID of the storage pool", "type": "string" }, { "name": "state", "description": "the state of the storage pool", "type": "storagepoolstatus" }, { "name": "created", "description": "the date and time the storage pool was created", "type": "date" }, { "name": "clustername", "description": "the name of the cluster for the storage pool", "type": "string" }, { "name": "storagecapabilities", "description": "the storage pool capabilities", "type": "map" }, { "name": "path", "description": "the storage pool path", "type": "string" } ] }, { "name": "destroyRouter", "description": "Destroys a router.", "isasync": true, "related": "", "params": [ { "name": "id", "description": "the ID of the router", "type": "uuid", "length": 255, "required": true, "related": "destroyRouter" } ], "response": [ { "name": "hostname", "description": "the hostname for the router", "type": "string" }, { "name": "publicip", "description": "the public IP address for the router", "type": "string" }, { "name": "created", "description": "the date and time the router was created", "type": "date" }, { "name": "requiresupgrade", "description": "true if the router template requires upgrader", "type": "boolean" }, { "name": "id", "description": "the id of the router", "type": "string" }, { "name": "guestnetworkname", "description": "the name of the corresponding guest network", "type": "string" }, { "name": "hostid", "description": "the host ID for the router", "type": "string" }, { "name": "zoneid", "description": "the Zone ID for the router", "type": "string" }, { "name": "scriptsversion", "description": "the version of scripts", "type": "string" }, { "name": "project", "description": "the project name of the address", "type": "string" }, { "name": "name", "description": "the name of the router", "type": "string" }, { "name": "templateid", "description": "the template ID for the router", "type": "string" }, { "name": "linklocalnetmask", "description": "the link local netmask for the router", "type": "string" }, { "name": "vpcname", "description": "the name of VPC the router belongs to", "type": "string" }, { "name": "domainid", "description": "the domain ID associated with the router", "type": "string" }, { "name": "redundantstate", "description": "the state of redundant virtual router", "type": "string" }, { "name": "projectid", "description": "the project id of the ipaddress", "type": "string" }, { "name": "state", "description": "the state of the router", "type": "state" }, { "name": "nic", "description": "the list of nics associated with the router", "type": "set", "response": [ { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" } ] }, { "name": "ip6dns2", "description": "the second IPv6 DNS for the router", "type": "string" }, { "name": "publicnetworkid", "description": "the ID of the corresponding public network", "type": "string" }, { "name": "account", "description": "the account associated with the router", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "dns2", "description": "the second DNS for the router", "type": "string" }, { }, { "name": "dns1", "description": "the first DNS for the router", "type": "string" }, { "name": "guestnetworkid", "description": "the ID of the corresponding guest network", "type": "string" }, { "name": "domain", "description": "the domain associated with the router", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "linklocalip", "description": "the link local IP address for the router", "type": "string" }, { "name": "ip6dns1", "description": "the first IPv6 DNS for the router", "type": "string" }, { "name": "linklocalmacaddress", "description": "the link local MAC address for the router", "type": "string" }, { "name": "guestmacaddress", "description": "the guest MAC address for the router", "type": "string" }, { "name": "vpcid", "description": "VPC the router belongs to", "type": "string" }, { "name": "networkdomain", "description": "the network domain for the router", "type": "string" }, { "name": "isredundantrouter", "description": "if this router is an redundant virtual router", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "zonename", "description": "the Zone name for the router", "type": "string" }, { "name": "guestnetmask", "description": "the guest netmask for the router", "type": "string" }, { "name": "version", "description": "the version of template", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "podid", "description": "the Pod ID for the router", "type": "string" }, { "name": "role", "description": "role of the domain router", "type": "string" }, { "name": "publicnetmask", "description": "the public netmask for the router", "type": "string" }, { }, { "name": "publicmacaddress", "description": "the public MAC address for the router", "type": "string" }, { "name": "gateway", "description": "the gateway for the router", "type": "string" }, { "name": "guestipaddress", "description": "the guest IP address for the router", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "linklocalnetworkid", "description": "the ID of the corresponding link local network", "type": "string" } ] }, { "name": "updateSnapshotPolicy", "description": "Updates the snapshot policy.", "isasync": true, "related": "", "params": [ { "name": "fordisplay", "description": "an optional field, whether to the display the snapshot policy to the end user or not.", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "the ID of the snapshot policy", "type": "uuid", "length": 255, "required": false, "related": "updateSnapshotPolicy" } ], "response": [ { "name": "schedule", "description": "time the snapshot is scheduled to be taken.", "type": "string" }, { "name": "timezone", "description": "the time zone of the snapshot policy", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "maxsnaps", "description": "maximum number of snapshots retained", "type": "int" }, { "name": "intervaltype", "description": "the interval type of the snapshot policy", "type": "short" }, { "name": "fordisplay", "description": "is this policy for display to the regular user", "type": "boolean" }, { }, { "name": "volumeid", "description": "the ID of the disk volume", "type": "string" }, { "name": "id", "description": "the ID of the snapshot policy", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "queryAsyncJobResult", "description": "Retrieves the current status of asynchronous job.", "isasync": false, "related": "", "params": [ { "name": "jobid", "description": "the ID of the asychronous job", "type": "uuid", "length": 255, "required": true, "related": "queryAsyncJobResult" } ], "response": [ { "name": "jobstatus", "description": "the current job status-should be 0 for PENDING", "type": "integer" }, { "name": "cmd", "description": "the async command executed", "type": "string" }, { "name": "userid", "description": "the user that executed the async command", "type": "string" }, { "name": "jobinstanceid", "description": "the unique ID of the instance/entity object related to the job", "type": "string" }, { }, { "name": "created", "description": " the created date of the job", "type": "date" }, { "name": "jobresultcode", "description": "the result code for the job", "type": "integer" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobprocstatus", "description": "the progress information of the PENDING job", "type": "integer" }, { "name": "jobinstancetype", "description": "the instance/entity object related to the job", "type": "string" }, { "name": "jobresult", "description": "the result reason", "type": "responseobject" }, { "name": "jobresulttype", "description": "the result type", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "accountid", "description": "the account that executed the async command", "type": "string" }, { }, { "name": "completed", "description": " the completed date of the job", "type": "date" } ] }, { "name": "registerNetscalerControlCenter", "description": "Adds a netscaler control center device", "isasync": true, "related": "addNetscalerLoadBalancer,listNetscalerLoadBalancers", "params": [ { "name": "numretries", "description": "Credentials to reach netscaler controlcenter device", "type": "integer", "length": 255, "required": true }, { "name": "ipaddress", "description": "URL of the netscaler controlcenter appliance.", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "Credentials to reach netscaler controlcenter device", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "Credentials to reach netscaler controlcenter device", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "isexclusivegslbprovider", "description": "true if NetScaler device is provisioned exclusively to be a GSLB service provider", "type": "boolean" }, { }, { "name": "lbdevicestate", "description": "device state", "type": "string" }, { }, { "name": "lbdevicename", "description": "device name", "type": "string" }, { "name": "gslbproviderpublicip", "description": "public IP of the NetScaler representing GSLB site", "type": "string" }, { "name": "lbdeviceid", "description": "device id of the netscaler load balancer", "type": "string" }, { "name": "publicinterface", "description": "the public interface of the load balancer", "type": "string" }, { "name": "privateinterface", "description": "the private interface of the load balancer", "type": "string" }, { "name": "lbdevicededicated", "description": "true if device is dedicated for an account", "type": "boolean" }, { "name": "lbdevicecapacity", "description": "device capacity", "type": "long" }, { "name": "gslbprovider", "description": "true if NetScaler device is provisioned to be a GSLB service provider", "type": "boolean" }, { "name": "podids", "description": "Used when NetScaler device is provider of EIP service. This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to route pod's subnet IP to a NetScaler device.", "type": "list" }, { "name": "physicalnetworkid", "description": "the physical network to which this netscaler device belongs to", "type": "string" }, { "name": "gslbproviderprivateip", "description": "private IP of the NetScaler representing GSLB site", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "ipaddress", "description": "the management IP address of the external load balancer", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "listImageStores", "description": "Lists image stores.", "since": "4.2.0", "isasync": false, "related": "", "params": [ { "name": "zoneid", "description": "the Zone ID for the image store", "type": "uuid", "length": 255, "required": false, "related": "listZones" }, { "name": "protocol", "description": "the image store protocol", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "name", "description": "the name of the image store", "type": "string", "length": 255, "required": false }, { "name": "id", "description": "the ID of the storage pool", "type": "uuid", "length": 255, "required": false, "related": "listImageStores" }, { "name": "provider", "description": "the image store provider", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "url", "description": "the url of the image store", "type": "string" }, { "name": "providername", "description": "the provider name of the image store", "type": "string" }, { }, { "name": "protocol", "description": "the protocol of the image store", "type": "string" }, { "name": "zonename", "description": "the Zone name of the image store", "type": "string" }, { "name": "name", "description": "the name of the image store", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the image store", "type": "string" }, { "name": "id", "description": "the ID of the image store", "type": "string" }, { "name": "scope", "description": "the scope of the image store", "type": "scopetype" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteAccount", "description": "Deletes a account, and all users associated with this account", "isasync": true, "params": [ { "name": "id", "description": "Account id", "type": "uuid", "length": 255, "required": true, "related": "enableAccount,listAccounts" } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "createCounter", "description": "Adds metric counter", "isasync": true, "related": "", "params": [ { "name": "name", "description": "Name of the counter.", "type": "string", "length": 255, "required": true }, { "name": "value", "description": "Value of the counter e.g. oid in case of snmp.", "type": "string", "length": 255, "required": true }, { "name": "source", "description": "Source of the counter.", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "id", "description": "the id of the Counter", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "value", "description": "Value in case of snmp or other specific counters.", "type": "string" }, { }, { "name": "name", "description": "Name of the counter.", "type": "string" }, { "name": "zoneid", "description": "zone id of counter", "type": "string" }, { "name": "source", "description": "Source of the counter.", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "listEventTypes", "description": "List Event Types", "isasync": false, "related": "", "params": [ ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "name", "description": "Event Type", "type": "string" }, { }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "disableOutOfBandManagementForCluster", "description": "Disables out-of-band management for a cluster", "since": "4.9.0", "isasync": true, "related": "", "params": [ { "name": "clusterid", "description": "the ID of the cluster", "type": "uuid", "length": 255, "required": true, "related": "addCluster" } ], "response": [ { "name": "description", "description": "the operation result description", "type": "string" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { "name": "address", "description": "the out-of-band management interface address", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "action", "description": "the out-of-band management action (if issued)", "type": "string" }, { "name": "username", "description": "the out-of-band management interface username", "type": "string" }, { "name": "powerstate", "description": "the out-of-band management interface powerState of the host", "type": "powerstate" }, { "name": "status", "description": "the operation result", "type": "boolean" }, { "name": "password", "description": "the out-of-band management interface password", "type": "string" }, { "name": "port", "description": "the out-of-band management interface port", "type": "string" }, { "name": "enabled", "description": "true if out-of-band management is enabled for the host", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "driver", "description": "the out-of-band management driver for the host", "type": "string" } ] }, { "name": "removeNicFromVirtualMachine", "description": "Removes VM from specified network by deleting a NIC", "isasync": true, "related": "destroyVirtualMachine,startVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "nicid", "description": "NIC ID", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "virtualmachineid", "description": "Virtual Machine ID", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,startVirtualMachine,removeNicFromVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" } ] }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" } ] }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" } ] }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "securitygroupname", "description": "security group name", "type": "string" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" } ] }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" } ] }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" } ] }, { "name": "addCluster", "description": "Adds a new cluster", "isasync": false, "related": "", "params": [ { "name": "zoneid", "description": "the Zone ID for the cluster", "type": "uuid", "length": 255, "required": true, "related": "listZones" }, { "name": "guestvswitchtype", "description": "Type of virtual switch used for guest traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)", "type": "string", "length": 255, "required": false }, { "name": "ovm3vip", "description": "Ovm3 vip to use for pool (and cluster)", "type": "string", "length": 255, "required": false }, { "name": "vsmusername", "description": "the username for the VSM associated with this cluster", "type": "string", "length": 255, "required": false }, { "name": "vsmpassword", "description": "the password for the VSM associated with this cluster", "type": "string", "length": 255, "required": false }, { "name": "vsmipaddress", "description": "the ipaddress of the VSM associated with this cluster", "type": "string", "length": 255, "required": false }, { "name": "password", "description": "the password for the host", "type": "string", "length": 255, "required": false }, { "name": "guestvswitchname", "description": "Name of virtual switch used for guest traffic in the cluster. This would override zone wide traffic label setting.", "type": "string", "length": 255, "required": false }, { "name": "publicvswitchname", "description": "Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting.", "type": "string", "length": 255, "required": false }, { "name": "username", "description": "the username for the cluster", "type": "string", "length": 255, "required": false }, { "name": "clustername", "description": "the cluster name", "type": "string", "length": 255, "required": true }, { "name": "clustertype", "description": "type of the cluster: CloudManaged, ExternalManaged", "type": "string", "length": 255, "required": true }, { "name": "ovm3pool", "description": "Ovm3 native pooling enabled for cluster", "type": "string", "length": 255, "required": false }, { "name": "ovm3cluster", "description": "Ovm3 native OCFS2 clustering enabled for cluster", "type": "string", "length": 255, "required": false }, { "name": "podid", "description": "the Pod ID for the host", "type": "uuid", "length": 255, "required": true, "related": "createManagementNetworkIpRange" }, { "name": "hypervisor", "description": "hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator,Ovm3", "type": "string", "length": 255, "required": true }, { "name": "allocationstate", "description": "Allocation state of this cluster for allocation of new resources", "type": "string", "length": 255, "required": false }, { "name": "url", "description": "the URL", "type": "string", "length": 255, "required": false }, { "name": "publicvswitchtype", "description": "Type of virtual switch used for public traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "cpuovercommitratio", "description": "The cpu overcommit ratio of the cluster", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the cluster", "type": "string" }, { "name": "resourcedetails", "description": "Meta data associated with the zone (key/value pairs)", "type": "map" }, { "name": "name", "description": "the cluster name", "type": "string" }, { "name": "hypervisortype", "description": "the hypervisor type of the cluster", "type": "string" }, { "name": "id", "description": "the cluster ID", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "podid", "description": "the Pod ID of the cluster", "type": "string" }, { "name": "ovm3vip", "description": "Ovm3 VIP to use for pooling and/or clustering", "type": "string" }, { "name": "capacity", "description": "the capacity of the Cluster", "type": "list", "response": [ { "name": "name", "description": "the capacity name", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" } ] }, { "name": "allocationstate", "description": "the allocation state of the cluster", "type": "string" }, { }, { "name": "podname", "description": "the Pod name of the cluster", "type": "string" }, { "name": "clustertype", "description": "the type of the cluster", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "managedstate", "description": "whether this cluster is managed by cloudstack", "type": "string" }, { "name": "memoryovercommitratio", "description": "The memory overcommit ratio of the cluster", "type": "string" }, { "name": "zonename", "description": "the Zone name of the cluster", "type": "string" } ] }, { "name": "deleteTrafficMonitor", "description": "Deletes an traffic monitor host.", "isasync": false, "params": [ { "name": "id", "description": "Id of the Traffic Monitor Host.", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "activateProject", "description": "Activates a project", "since": "3.0.0", "isasync": true, "related": "", "params": [ { "name": "id", "description": "id of the project to be modified", "type": "uuid", "length": 255, "required": true, "related": "activateProject" } ], "response": [ { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this project", "type": "string" }, { }, { "name": "templateavailable", "description": "the total number of templates available to be created by this project", "type": "string" }, { "name": "displaytext", "description": "the displaytext of the project", "type": "string" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this project", "type": "long" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this project", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by project", "type": "float" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this project to acquire", "type": "string" }, { "name": "networktotal", "description": "the total number of networks owned by project", "type": "long" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this project", "type": "long" }, { "name": "volumetotal", "description": "the total volume being used by this project", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "memorylimit", "description": "the total memory (in MB) the project can own", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this project", "type": "integer" }, { "name": "projectaccountname", "description": "the project account name of the project", "type": "string" }, { "name": "cputotal", "description": "the total number of cpu cores owned by project", "type": "long" }, { "name": "domainid", "description": "the domain id the project belongs to", "type": "string" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this project", "type": "string" }, { "name": "cpulimit", "description": "the total number of cpu cores the project can own", "type": "string" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this project", "type": "string" }, { "name": "vmavailable", "description": "the total number of virtual machines available for this project to acquire", "type": "string" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the project can own", "type": "string" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this project", "type": "string" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this project", "type": "string" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this project", "type": "string" }, { "name": "state", "description": "the state of the project", "type": "string" }, { "name": "name", "description": "the name of the project", "type": "string" }, { "name": "vpctotal", "description": "the total number of vpcs owned by project", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "account", "description": "the account name of the project's owner", "type": "string" }, { "name": "domain", "description": "the domain name where the project belongs to", "type": "string" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this project", "type": "long" }, { "name": "networklimit", "description": "the total number of networks the project can own", "type": "string" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the project can own", "type": "string" }, { "name": "volumelimit", "description": "the total volume which can be used by this project", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this project", "type": "string" }, { }, { "name": "volumeavailable", "description": "the total volume available for this project", "type": "string" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by project", "type": "long" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this project", "type": "string" }, { "name": "iplimit", "description": "the total number of public ip addresses this project can acquire", "type": "string" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this project", "type": "long" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this project", "type": "integer" }, { "name": "vpclimit", "description": "the total number of vpcs the project can own", "type": "string" }, { "name": "networkavailable", "description": "the total number of networks available to be created for this project", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by project", "type": "long" }, { "name": "id", "description": "the id of the project", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with vm", "type": "list", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] } ] }, { "name": "deleteSslCert", "description": "Delete a certificate to CloudStack", "isasync": false, "params": [ { "name": "id", "description": "Id of SSL certificate", "type": "uuid", "length": 255, "required": true, "related": "uploadSslCert" } ], "response": [ { }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "listDedicatedHosts", "description": "Lists dedicated hosts.", "isasync": false, "related": "", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "domainid", "description": "the ID of the domain associated with the host", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "affinitygroupid", "description": "list dedicated hosts by affinity group", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "account", "description": "the name of the account associated with the host. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "hostid", "description": "the ID of the host", "type": "uuid", "length": 255, "required": false, "related": "reconnectHost,addBaremetalHost" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the domain ID of the host", "type": "string" }, { "name": "affinitygroupid", "description": "the Dedication Affinity Group ID of the host", "type": "string" }, { "name": "accountid", "description": "the Account ID of the host", "type": "string" }, { "name": "hostname", "description": "the name of the host", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the dedicated resource", "type": "string" }, { "name": "hostid", "description": "the ID of the host", "type": "string" }, { } ] }, { "name": "listPaloAltoFirewalls", "description": "lists Palo Alto firewall devices in a physical network", "isasync": false, "related": "addPaloAltoFirewall", "params": [ { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "fwdeviceid", "description": "Palo Alto firewall device ID", "type": "uuid", "length": 255, "required": false, "related": "listPaloAltoFirewalls,addPaloAltoFirewall" } ], "response": [ { "name": "username", "description": "the username that's used to log in to the external firewall", "type": "string" }, { "name": "zoneid", "description": "the zone ID of the external firewall", "type": "string" }, { "name": "publicinterface", "description": "the public interface of the external firewall", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "fwdevicecapacity", "description": "device capacity", "type": "long" }, { "name": "numretries", "description": "the number of times to retry requests to the external firewall", "type": "string" }, { "name": "fwdevicename", "description": "device name", "type": "string" }, { "name": "publiczone", "description": "the public security zone of the external firewall", "type": "string" }, { "name": "timeout", "description": "the timeout (in seconds) for requests to the external firewall", "type": "string" }, { "name": "fwdevicestate", "description": "device state", "type": "string" }, { "name": "ipaddress", "description": "the management IP address of the external firewall", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this Palo Alto firewall belongs to", "type": "string" }, { }, { "name": "privatezone", "description": "the private security zone of the external firewall", "type": "string" }, { "name": "privateinterface", "description": "the private interface of the external firewall", "type": "string" }, { "name": "usageinterface", "description": "the usage interface of the external firewall", "type": "string" }, { }, { "name": "fwdeviceid", "description": "device id of the Palo Alto firewall", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" } ] }, { "name": "deleteAutoScaleVmGroup", "description": "Deletes a autoscale vm group.", "isasync": true, "params": [ { "name": "id", "description": "the ID of the autoscale group", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "deleteAlerts", "description": "Delete one or more alerts.", "isasync": false, "params": [ { "name": "enddate", "description": "end date range to delete alerts (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")", "type": "date", "length": 255, "required": false }, { "name": "startdate", "description": "start date range to delete alerts (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")", "type": "date", "length": 255, "required": false }, { "name": "type", "description": "delete by alert type", "type": "string", "length": 255, "required": false }, { "name": "ids", "description": "the IDs of the alerts", "type": "list", "length": 255, "required": false, "related": "" } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "updateLoadBalancerRule", "description": "Updates load balancer", "isasync": true, "related": "listLoadBalancerRules", "params": [ { "name": "id", "description": "the ID of the load balancer rule to update", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "protocol", "description": "The protocol for the LB", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "the name of the load balancer rule", "type": "string", "length": 255, "required": false }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "algorithm", "description": "load balancer algorithm (source, roundrobin, leastconn)", "type": "string", "length": 255, "required": false }, { "name": "description", "description": "the description of the load balancer rule", "type": "string", "length": 4096, "required": false }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "tags", "description": "the list of resource tags associated with load balancer", "type": "list", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" } ] }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "account", "description": "the account of the load balancer rule", "type": "string" }, { "name": "publicport", "description": "the public port", "type": "string" }, { }, { "name": "projectid", "description": "the project id of the load balancer", "type": "string" }, { "name": "publicip", "description": "the public ip address", "type": "string" }, { "name": "zoneid", "description": "the id of the zone the rule belongs to", "type": "string" }, { }, { "name": "domainid", "description": "the domain ID of the load balancer rule", "type": "string" }, { "name": "privateport", "description": "the private port", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "the name of the load balancer", "type": "string" }, { "name": "id", "description": "the load balancer rule ID", "type": "string" }, { "name": "publicipid", "description": "the public ip address id", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "description", "description": "the description of the load balancer", "type": "string" }, { "name": "project", "description": "the project name of the load balancer", "type": "string" }, { "name": "domain", "description": "the domain of the load balancer rule", "type": "string" }, { "name": "zonename", "description": "the name of the zone the load balancer rule belongs to", "type": "string" }, { "name": "networkid", "description": "the id of the guest network the lb rule belongs to", "type": "string" }, { "name": "algorithm", "description": "the load balancer algorithm (source, roundrobin, leastconn)", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "protocol", "description": "the protocol of the loadbalanacer rule", "type": "string" } ] }, { "name": "enableAccount", "description": "Enables an account", "isasync": false, "related": "listAccounts", "params": [ { "name": "domainid", "description": "Enables specified account in this domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "id", "description": "Account id", "type": "uuid", "length": 255, "required": false, "related": "enableAccount,listAccounts" }, { "name": "account", "description": "Enables specified account.", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "vmavailable", "description": "the total number of virtual machines available for this account to acquire", "type": "string" }, { "name": "snapshotavailable", "description": "the total number of snapshots available for this account", "type": "string" }, { "name": "state", "description": "the state of the account", "type": "string" }, { }, { "name": "vpctotal", "description": "the total number of vpcs owned by account", "type": "long" }, { "name": "vpclimit", "description": "the total number of vpcs the account can own", "type": "string" }, { "name": "vmtotal", "description": "the total number of virtual machines deployed by this account", "type": "long" }, { "name": "secondarystoragelimit", "description": "the total secondary storage space (in GiB) the account can own", "type": "string" }, { "name": "primarystoragetotal", "description": "the total primary storage space (in GiB) owned by account", "type": "long" }, { "name": "networkdomain", "description": "the network domain", "type": "string" }, { "name": "accounttype", "description": "account type (admin, domain-admin, user)", "type": "short" }, { "name": "domain", "description": "name of the Domain the account belongs too", "type": "string" }, { "name": "volumeavailable", "description": "the total volume available for this account", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "primarystoragelimit", "description": "the total primary storage space (in GiB) the account can own", "type": "string" }, { "name": "receivedbytes", "description": "the total number of network traffic bytes received", "type": "long" }, { "name": "iptotal", "description": "the total number of public ip addresses allocated for this account", "type": "long" }, { "name": "secondarystorageavailable", "description": "the total secondary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "snapshottotal", "description": "the total number of snapshots stored by this account", "type": "long" }, { "name": "templatetotal", "description": "the total number of templates which have been created by this account", "type": "long" }, { "name": "memorytotal", "description": "the total memory (in MB) owned by account", "type": "long" }, { "name": "networktotal", "description": "the total number of networks owned by account", "type": "long" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "defaultzoneid", "description": "the default zone of the account", "type": "string" }, { "name": "volumelimit", "description": "the total volume which can be used by this account", "type": "string" }, { "name": "projecttotal", "description": "the total number of projects being administrated by this account", "type": "long" }, { "name": "memorylimit", "description": "the total memory (in MB) the account can own", "type": "string" }, { "name": "projectavailable", "description": "the total number of projects available for administration by this account", "type": "string" }, { "name": "networklimit", "description": "the total number of networks the account can own", "type": "string" }, { "name": "secondarystoragetotal", "description": "the total secondary storage space (in GiB) owned by account", "type": "float" }, { "name": "accountdetails", "description": "details for the account", "type": "map" }, { "name": "iplimit", "description": "the total number of public ip addresses this account can acquire", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "projectlimit", "description": "the total number of projects the account can own", "type": "string" }, { "name": "volumetotal", "description": "the total volume being used by this account", "type": "long" }, { "name": "snapshotlimit", "description": "the total number of snapshots which can be stored by this account", "type": "string" }, { }, { "name": "networkavailable", "description": "the total number of networks available to be created for this account", "type": "string" }, { "name": "ipavailable", "description": "the total number of public ip addresses available for this account to acquire", "type": "string" }, { "name": "sentbytes", "description": "the total number of network traffic bytes sent", "type": "long" }, { "name": "memoryavailable", "description": "the total memory (in MB) available to be created for this account", "type": "string" }, { "name": "domainid", "description": "id of the Domain the account belongs too", "type": "string" }, { "name": "user", "description": "the list of users associated with account", "type": "list", "response": [ { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "account", "description": "the account name of the user", "type": "string" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" } ] }, { "name": "templateavailable", "description": "the total number of templates available to be created by this account", "type": "string" }, { "name": "primarystorageavailable", "description": "the total primary storage space (in GiB) available to be used for this account", "type": "string" }, { "name": "cpuavailable", "description": "the total number of cpu cores available to be created for this account", "type": "string" }, { "name": "roletype", "description": "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)", "type": "string" }, { "name": "groups", "description": "the list of acl groups that account belongs to", "type": "list" }, { "name": "templatelimit", "description": "the total number of templates which can be created by this account", "type": "string" }, { "name": "name", "description": "the name of the account", "type": "string" }, { "name": "vmlimit", "description": "the total number of virtual machines that can be deployed by this account", "type": "string" }, { "name": "vmrunning", "description": "the total number of virtual machines running for this account", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "vmstopped", "description": "the total number of virtual machines stopped for this account", "type": "integer" }, { "name": "isdefault", "description": "true if account is default, false otherwise", "type": "boolean" }, { "name": "cpulimit", "description": "the total number of cpu cores the account can own", "type": "string" }, { "name": "iscleanuprequired", "description": "true if the account requires cleanup", "type": "boolean" }, { "name": "cputotal", "description": "the total number of cpu cores owned by account", "type": "long" }, { "name": "vpcavailable", "description": "the total number of vpcs available to be created for this account", "type": "string" }, { "name": "id", "description": "the id of the account", "type": "string" } ] }, { "name": "createAutoScaleVmProfile", "description": "Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature.", "isasync": true, "related": "", "params": [ { "name": "destroyvmgraceperiod", "description": "the time allowed for existing connections to get closed before a vm is destroyed", "type": "integer", "length": 255, "required": false }, { "name": "zoneid", "description": "availability zone for the auto deployed virtual machine", "type": "uuid", "length": 255, "required": true, "related": "listZones" }, { "name": "otherdeployparams", "description": "parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine", "type": "string", "length": 255, "required": false }, { "name": "serviceofferingid", "description": "the service offering of the auto deployed virtual machine", "type": "uuid", "length": 255, "required": true, "related": "listServiceOfferings,updateServiceOffering" }, { "name": "templateid", "description": "the template of the auto deployed virtual machine", "type": "uuid", "length": 255, "required": true, "related": "registerTemplate,createTemplate,listIsos,copyTemplate,copyIso,registerIso,listTemplates" }, { "name": "fordisplay", "description": "an optional field, whether to the display the profile to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "autoscaleuserid", "description": "the ID of the user used to launch and destroy the VMs", "type": "uuid", "length": 255, "required": false, "related": "getUser" }, { "name": "counterparam", "description": "counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161", "type": "map", "length": 255, "required": false } ], "response": [ { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "destroyvmgraceperiod", "description": "the time allowed for existing connections to get closed before a vm is destroyed", "type": "integer" }, { "name": "autoscaleuserid", "description": "the ID of the user used to launch and destroy the VMs", "type": "string" }, { "name": "serviceofferingid", "description": "the service offering to be used while deploying a virtual machine", "type": "string" }, { "name": "templateid", "description": "the template to be used while deploying a virtual machine", "type": "string" }, { "name": "zoneid", "description": "the availability zone to be used while deploying a virtual machine", "type": "string" }, { }, { "name": "fordisplay", "description": "is profile for display to the regular user", "type": "boolean" }, { "name": "projectid", "description": "the project id vm profile", "type": "string" }, { "name": "domain", "description": "the domain name of the vm profile", "type": "string" }, { "name": "project", "description": "the project name of the vm profile", "type": "string" }, { "name": "otherdeployparams", "description": "parameters other than zoneId/serviceOfferringId/templateId to be used while deploying a virtual machine", "type": "string" }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { "name": "id", "description": "the autoscale vm profile ID", "type": "string" }, { "name": "domainid", "description": "the domain ID of the vm profile", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "listLBStickinessPolicies", "description": "Lists load balancer stickiness policies.", "since": "3.0.0", "isasync": false, "related": "", "params": [ { "name": "lbruleid", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "id", "description": "the ID of the load balancer stickiness policy", "type": "uuid", "length": 255, "required": false, "related": "listLBStickinessPolicies" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "lbruleid", "description": "the LB rule ID", "type": "string" }, { "name": "description", "description": "the description of the Stickiness policy", "type": "string" }, { "name": "stickinesspolicy", "description": "the list of stickinesspolicies", "type": "list", "response": [ { "name": "id", "description": "the LB Stickiness policy ID", "type": "string" }, { "name": "description", "description": "the description of the Stickiness policy", "type": "string" }, { "name": "fordisplay", "description": "is policy for display to the regular user", "type": "boolean" }, { "name": "state", "description": "the state of the policy", "type": "string" }, { "name": "name", "description": "the name of the Stickiness policy", "type": "string" }, { "name": "methodname", "description": "the method name of the Stickiness policy", "type": "string" }, { "name": "params", "description": "the params of the policy", "type": "map" } ] }, { }, { }, { "name": "account", "description": "the account of the Stickiness policy", "type": "string" }, { "name": "domain", "description": "the domain of the Stickiness policy", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "the name of the Stickiness policy", "type": "string" }, { "name": "zoneid", "description": "the id of the zone the Stickiness policy belongs to", "type": "string" }, { "name": "state", "description": "the state of the policy", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domainid", "description": "the domain ID of the Stickiness policy", "type": "string" } ] }, { "name": "addUcsManager", "description": "Adds a Ucs manager", "isasync": false, "related": "", "params": [ { "name": "name", "description": "the name of UCS manager", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone id for the ucs manager", "type": "uuid", "length": 255, "required": true, "related": "listZones" }, { "name": "url", "description": "the name of UCS url", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "the password of UCS", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "the username of UCS", "type": "string", "length": 255, "required": true } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "url", "description": "the url of ucs manager", "type": "string" }, { }, { "name": "zoneid", "description": "the zone ID of ucs manager", "type": "string" }, { "name": "name", "description": "the name of ucs manager", "type": "string" }, { "name": "id", "description": "the ID of the ucs manager", "type": "string" } ] }, { "name": "deleteNetwork", "description": "Deletes a network", "isasync": true, "params": [ { "name": "id", "description": "the ID of the network", "type": "uuid", "length": 255, "required": true, "related": "listNetworks,updateNetwork,createNetwork" }, { "name": "forced", "description": "Force delete a network. Network will be marked as 'Destroy' even when commands to shutdown and cleanup to the backend fails.", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { } ] }, { "name": "reconnectHost", "description": "Reconnects a host.", "isasync": true, "related": "addBaremetalHost", "params": [ { "name": "id", "description": "the host ID", "type": "uuid", "length": 255, "required": true, "related": "reconnectHost,addBaremetalHost" } ], "response": [ { "name": "state", "description": "the state of the host", "type": "status" }, { "name": "name", "description": "the name of the host", "type": "string" }, { "name": "cpuallocated", "description": "the amount of the host's CPU currently allocated", "type": "string" }, { "name": "annotation", "description": "the last annotation set on this host by an admin", "type": "string" }, { "name": "memorywithoverprovisioning", "description": "the amount of the host's memory after applying the mem.overprovisioning.factor", "type": "string" }, { "name": "zonename", "description": "the Zone name of the host", "type": "string" }, { "name": "hypervisor", "description": "the host hypervisor", "type": "hypervisortype" }, { "name": "lastpinged", "description": "the date and time the host was last pinged", "type": "date" }, { "name": "disconnected", "description": "true if the host is disconnected. False otherwise.", "type": "date" }, { "name": "cpuwithoverprovisioning", "description": "the amount of the host's CPU after applying the cpu.overprovisioning.factor ", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "hahost", "description": "true if the host is Ha host (dedicated to vms started by HA process; false otherwise", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "cpuspeed", "description": "the CPU speed of the host", "type": "long" }, { "name": "memoryused", "description": "the amount of the host's memory currently used", "type": "long" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "details", "description": "Host details in key/value pairs.", "type": "map" }, { "name": "outofbandmanagement", "description": "the host out-of-band management information", "type": "outofbandmanagementresponse" }, { "name": "username", "description": "the admin that annotated this host", "type": "string" }, { "name": "clustertype", "description": "the cluster type of the cluster that host belongs to", "type": "string" }, { "name": "cpusockets", "description": "the number of CPU sockets on the host", "type": "integer" }, { "name": "cpunumber", "description": "the CPU number of the host", "type": "integer" }, { "name": "lastannotated", "description": "the last time this host was annotated", "type": "date" }, { "name": "suitableformigration", "description": "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise", "type": "boolean" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { }, { "name": "events", "description": "events available for the host", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "ipaddress", "description": "the IP address of the host", "type": "string" }, { "name": "cpuused", "description": "the amount of the host's CPU currently used", "type": "string" }, { "name": "managementserverid", "description": "the management server ID of the host", "type": "long" }, { "name": "gpugroup", "description": "GPU cards present in the host", "type": "list", "response": [ { "name": "gpugroupname", "description": "GPU cards present in the host", "type": "string" }, { "name": "vgpu", "description": "the list of enabled vGPUs", "type": "list", "response": [ { "name": "videoram", "description": "Video RAM for this vGPU type", "type": "long" }, { "name": "maxresolutionx", "description": "Maximum X resolution per display", "type": "long" }, { "name": "maxresolutiony", "description": "Maximum Y resolution per display", "type": "long" }, { "name": "remainingcapacity", "description": "Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type", "type": "long" }, { "name": "vgputype", "description": "Model Name of vGPU", "type": "string" }, { "name": "maxvgpuperpgpu", "description": "Maximum no. of vgpu per gpu card (pgpu)", "type": "long" }, { "name": "maxheads", "description": "Maximum displays per user", "type": "long" }, { "name": "maxcapacity", "description": "Maximum vgpu can be created with this vgpu type on the given gpu group", "type": "long" } ] } ] }, { "name": "podname", "description": "the Pod name of the host", "type": "string" }, { "name": "memorytotal", "description": "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning", "type": "long" }, { "name": "hosttags", "description": "comma-separated list of tags for the host", "type": "string" }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "oscategoryname", "description": "the OS category name of the host", "type": "string" }, { "name": "capabilities", "description": "capabilities of the host", "type": "string" }, { "name": "oscategoryid", "description": "the OS category ID of the host", "type": "string" }, { "name": "hasenoughcapacity", "description": "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise", "type": "boolean" }, { "name": "resourcestate", "description": "the resource state of the host", "type": "string" }, { }, { "name": "memoryallocated", "description": "the amount of the host's memory currently allocated", "type": "long" }, { "name": "zoneid", "description": "the Zone ID of the host", "type": "string" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "podid", "description": "the Pod ID of the host", "type": "string" }, { "name": "disksizetotal", "description": "the total disk size of the host", "type": "long" }, { "name": "type", "description": "the host type", "type": "type" }, { "name": "islocalstorageactive", "description": "true if local storage is active, false otherwise", "type": "boolean" }, { "name": "hostha", "description": "the host HA information information", "type": "hostharesponse" }, { "name": "networkkbsread", "description": "the incoming network traffic on the host", "type": "long" }, { "name": "averageload", "description": "the cpu average load on the host", "type": "long" }, { "name": "clustername", "description": "the cluster name of the host", "type": "string" }, { "name": "version", "description": "the host version", "type": "string" }, { "name": "id", "description": "the ID of the host", "type": "string" }, { "name": "clusterid", "description": "the cluster ID of the host", "type": "string" } ] }, { "name": "deleteProject", "description": "Deletes a project", "since": "3.0.0", "isasync": true, "params": [ { "name": "id", "description": "id of the project to be deleted", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "listNetscalerLoadBalancers", "description": "lists netscaler load balancer devices", "isasync": false, "related": "addNetscalerLoadBalancer", "params": [ { "name": "lbdeviceid", "description": "netscaler load balancer device ID", "type": "uuid", "length": 255, "required": false, "related": "addNetscalerLoadBalancer,listNetscalerLoadBalancers" }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "lbdevicename", "description": "device name", "type": "string" }, { "name": "lbdevicecapacity", "description": "device capacity", "type": "long" }, { "name": "privateinterface", "description": "the private interface of the load balancer", "type": "string" }, { "name": "podids", "description": "Used when NetScaler device is provider of EIP service. This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to route pod's subnet IP to a NetScaler device.", "type": "list" }, { "name": "lbdeviceid", "description": "device id of the netscaler load balancer", "type": "string" }, { "name": "lbdevicededicated", "description": "true if device is dedicated for an account", "type": "boolean" }, { "name": "ipaddress", "description": "the management IP address of the external load balancer", "type": "string" }, { "name": "gslbproviderprivateip", "description": "private IP of the NetScaler representing GSLB site", "type": "string" }, { "name": "gslbprovider", "description": "true if NetScaler device is provisioned to be a GSLB service provider", "type": "boolean" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "lbdevicestate", "description": "device state", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this netscaler device belongs to", "type": "string" }, { "name": "gslbproviderpublicip", "description": "public IP of the NetScaler representing GSLB site", "type": "string" }, { "name": "isexclusivegslbprovider", "description": "true if NetScaler device is provisioned exclusively to be a GSLB service provider", "type": "boolean" }, { "name": "publicinterface", "description": "the public interface of the load balancer", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "createInstanceGroup", "description": "Creates a vm group", "isasync": false, "related": "", "params": [ { "name": "account", "description": "the account of the instance group. The account parameter must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "projectid", "description": "The project of the instance group", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "domainid", "description": "the domain ID of account owning the instance group", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "name", "description": "the name of the instance group", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "id", "description": "the ID of the instance group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the instance group", "type": "string" }, { "name": "name", "description": "the name of the instance group", "type": "string" }, { "name": "created", "description": "time and date the instance group was created", "type": "date" }, { }, { "name": "account", "description": "the account owning the instance group", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "domain", "description": "the domain name of the instance group", "type": "string" }, { "name": "project", "description": "the project name of the instance group", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "projectid", "description": "the project ID of the instance group", "type": "string" } ] }, { "name": "addNetscalerLoadBalancer", "description": "Adds a netscaler load balancer device", "isasync": true, "related": "", "params": [ { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "isexclusivegslbprovider", "description": "true if NetScaler device being added is for providing GSLB service exclusively and can not be used for LB", "type": "boolean", "length": 255, "required": false }, { "name": "networkdevicetype", "description": "Netscaler device type supports NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer", "type": "string", "length": 255, "required": true }, { "name": "gslbprovider", "description": "true if NetScaler device being added is for providing GSLB service", "type": "boolean", "length": 255, "required": false }, { "name": "password", "description": "Credentials to reach netscaler load balancer device", "type": "string", "length": 255, "required": true }, { "name": "username", "description": "Credentials to reach netscaler load balancer device", "type": "string", "length": 255, "required": true }, { "name": "gslbproviderpublicip", "description": "public IP of the site", "type": "string", "length": 255, "required": false }, { "name": "url", "description": "URL of the netscaler load balancer appliance.", "type": "string", "length": 255, "required": true }, { "name": "gslbproviderprivateip", "description": "public IP of the site", "type": "string", "length": 255, "required": false } ], "response": [ { }, { "name": "gslbprovider", "description": "true if NetScaler device is provisioned to be a GSLB service provider", "type": "boolean" }, { "name": "podids", "description": "Used when NetScaler device is provider of EIP service. This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to route pod's subnet IP to a NetScaler device.", "type": "list" }, { "name": "lbdevicecapacity", "description": "device capacity", "type": "long" }, { "name": "gslbproviderprivateip", "description": "private IP of the NetScaler representing GSLB site", "type": "string" }, { "name": "publicinterface", "description": "the public interface of the load balancer", "type": "string" }, { "name": "privateinterface", "description": "the private interface of the load balancer", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "ipaddress", "description": "the management IP address of the external load balancer", "type": "string" }, { "name": "lbdevicename", "description": "device name", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "lbdevicededicated", "description": "true if device is dedicated for an account", "type": "boolean" }, { "name": "lbdeviceid", "description": "device id of the netscaler load balancer", "type": "string" }, { "name": "lbdevicestate", "description": "device state", "type": "string" }, { "name": "gslbproviderpublicip", "description": "public IP of the NetScaler representing GSLB site", "type": "string" }, { }, { "name": "isexclusivegslbprovider", "description": "true if NetScaler device is provisioned exclusively to be a GSLB service provider", "type": "boolean" }, { "name": "physicalnetworkid", "description": "the physical network to which this netscaler device belongs to", "type": "string" } ] }, { "name": "listIsoPermissions", "description": "List iso visibility and all accounts that have permissions to view this iso.", "isasync": false, "related": "listTemplatePermissions,listIsoPermissions", "params": [ { "name": "id", "description": "the template ID", "type": "uuid", "length": 255, "required": true, "related": "listIsoPermissions,listTemplatePermissions,listIsoPermissions" } ], "response": [ { "name": "projectids", "description": "the list of projects the template is available for", "type": "list" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the ID of the domain to which the template belongs", "type": "string" }, { }, { }, { "name": "account", "description": "the list of accounts the template is available for", "type": "list" }, { "name": "id", "description": "the template ID", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "ispublic", "description": "true if this template is a public template, false otherwise", "type": "boolean" } ] }, { "name": "createLoadBalancer", "description": "Creates a load balancer", "since": "4.2.0", "isasync": true, "related": "", "params": [ { "name": "name", "description": "name of the load balancer", "type": "string", "length": 255, "required": true }, { "name": "instanceport", "description": "the TCP port of the virtual machine where the network traffic will be load balanced to", "type": "integer", "length": 255, "required": true }, { "name": "sourceipaddressnetworkid", "description": "the network id of the source ip address", "type": "uuid", "length": 255, "required": true, "related": "listNetworks,updateNetwork,createNetwork" }, { "name": "algorithm", "description": "load balancer algorithm (source, roundrobin, leastconn)", "type": "string", "length": 255, "required": true }, { "name": "sourceport", "description": "the source port the network traffic will be load balanced from", "type": "integer", "length": 255, "required": true }, { "name": "description", "description": "the description of the load balancer", "type": "string", "length": 4096, "required": false }, { "name": "sourceipaddress", "description": "the source IP address the network traffic will be load balanced from", "type": "string", "length": 255, "required": false }, { "name": "scheme", "description": "the load balancer scheme. Supported value in this release is Internal", "type": "string", "length": 255, "required": true }, { "name": "networkid", "description": "The guest network the load balancer will be created for", "type": "uuid", "length": 255, "required": true, "related": "listNetworks,updateNetwork,createNetwork" }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "domain", "description": "the domain of the Load Balancer", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "account", "description": "the account of the Load Balancer", "type": "string" }, { "name": "domainid", "description": "the domain ID of the Load Balancer", "type": "string" }, { "name": "networkid", "description": "Load Balancer network id", "type": "string" }, { "name": "algorithm", "description": "the load balancer algorithm (source, roundrobin, leastconn)", "type": "string" }, { "name": "loadbalancerinstance", "description": "the list of instances associated with the Load Balancer", "type": "list", "response": [ { "name": "state", "description": "the state of the instance", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the instance", "type": "string" }, { "name": "name", "description": "the name of the instance", "type": "string" }, { "name": "id", "description": "the instance ID", "type": "string" } ] }, { "name": "projectid", "description": "the project id of the Load Balancer", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "sourceipaddressnetworkid", "description": "Load Balancer source ip network id", "type": "string" }, { }, { "name": "loadbalancerrule", "description": "the list of rules associated with the Load Balancer", "type": "list", "response": [ { "name": "instanceport", "description": "instance port of the load balancer rule", "type": "integer" }, { "name": "state", "description": "the state of the load balancer rule", "type": "string" }, { "name": "sourceport", "description": "source port of the load balancer rule", "type": "integer" } ] }, { "name": "tags", "description": "the list of resource tags associated with the Load Balancer", "type": "list", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "description", "description": "the description of the Load Balancer", "type": "string" }, { "name": "id", "description": "the Load Balancer ID", "type": "string" }, { "name": "project", "description": "the project name of the Load Balancer", "type": "string" }, { "name": "name", "description": "the name of the Load Balancer", "type": "string" }, { "name": "sourceipaddress", "description": "Load Balancer source ip", "type": "string" } ] }, { "name": "listBaremetalPxeServers", "description": "list baremetal pxe server", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "Pxe server device ID", "type": "long", "length": 255, "required": false }, { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { }, { "name": "physicalnetworkid", "description": "the physical network to which this external dhcp device belongs to", "type": "string" }, { "name": "url", "description": "url", "type": "string" }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "device id of ", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { } ] }, { "name": "addPaloAltoFirewall", "description": "Adds a Palo Alto firewall device", "isasync": true, "related": "", "params": [ { "name": "physicalnetworkid", "description": "the Physical Network ID", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "username", "description": "Credentials to reach Palo Alto firewall device", "type": "string", "length": 255, "required": true }, { "name": "networkdevicetype", "description": "supports only PaloAltoFirewall", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "Credentials to reach Palo Alto firewall device", "type": "string", "length": 255, "required": true }, { "name": "url", "description": "URL of the Palo Alto appliance.", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "fwdevicename", "description": "device name", "type": "string" }, { "name": "fwdevicestate", "description": "device state", "type": "string" }, { "name": "zoneid", "description": "the zone ID of the external firewall", "type": "string" }, { "name": "fwdevicecapacity", "description": "device capacity", "type": "long" }, { "name": "privatezone", "description": "the private security zone of the external firewall", "type": "string" }, { }, { "name": "timeout", "description": "the timeout (in seconds) for requests to the external firewall", "type": "string" }, { "name": "ipaddress", "description": "the management IP address of the external firewall", "type": "string" }, { "name": "publiczone", "description": "the public security zone of the external firewall", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "privateinterface", "description": "the private interface of the external firewall", "type": "string" }, { "name": "username", "description": "the username that's used to log in to the external firewall", "type": "string" }, { "name": "usageinterface", "description": "the usage interface of the external firewall", "type": "string" }, { }, { "name": "provider", "description": "name of the provider", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network to which this Palo Alto firewall belongs to", "type": "string" }, { "name": "fwdeviceid", "description": "device id of the Palo Alto firewall", "type": "string" }, { "name": "numretries", "description": "the number of times to retry requests to the external firewall", "type": "string" }, { "name": "publicinterface", "description": "the public interface of the external firewall", "type": "string" } ] }, { "name": "createPrivateGateway", "description": "Creates a private gateway", "isasync": true, "related": "", "params": [ { "name": "vlan", "description": "the network implementation uri for the private gateway", "type": "string", "length": 255, "required": true }, { "name": "physicalnetworkid", "description": "the Physical Network ID the network belongs to", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "sourcenatsupported", "description": "source NAT supported value. Default value false. If 'true' source NAT is enabled on the private gateway 'false': sourcenat is not supported", "type": "boolean", "length": 255, "required": false }, { "name": "aclid", "description": "the ID of the network ACL", "type": "uuid", "length": 255, "required": false, "related": "createNetworkACLList" }, { "name": "networkofferingid", "description": "the uuid of the network offering to use for the private gateways network connection", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "vpcid", "description": "the VPC network belongs to", "type": "uuid", "length": 255, "required": true, "related": "listVPCs,createVPC,updateVPC" }, { "name": "ipaddress", "description": "the IP address of the Private gateaway", "type": "string", "length": 255, "required": true }, { "name": "gateway", "description": "the gateway of the Private gateway", "type": "string", "length": 255, "required": true }, { "name": "netmask", "description": "the netmask of the Private gateway", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "sourcenatsupported", "description": "Souce Nat enable status", "type": "boolean" }, { "name": "vpcid", "description": "VPC the private gateaway belongs to", "type": "string" }, { }, { "name": "project", "description": "the project name of the private gateway", "type": "string" }, { "name": "state", "description": "State of the gateway, can be Creating, Ready, Deleting", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "domainid", "description": "the ID of the domain associated with the private gateway", "type": "string" }, { "name": "projectid", "description": "the project id of the private gateway", "type": "string" }, { "name": "domain", "description": "the domain associated with the private gateway", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network id", "type": "string" }, { }, { "name": "vlan", "description": "the network implementation uri for the private gateway", "type": "string" }, { "name": "id", "description": "the id of the private gateway", "type": "string" }, { "name": "zoneid", "description": "zone id of the private gateway", "type": "string" }, { "name": "zonename", "description": "the name of the zone the private gateway belongs to", "type": "string" }, { "name": "ipaddress", "description": "the private gateway's ip address", "type": "string" }, { "name": "gateway", "description": "the gateway", "type": "string" }, { "name": "netmask", "description": "the private gateway's netmask", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "aclid", "description": "ACL Id set for private gateway", "type": "string" }, { "name": "account", "description": "the account associated with the private gateway", "type": "string" } ] }, { "name": "getUser", "description": "Find user account by API key", "isasync": false, "related": "", "params": [ { "name": "userapikey", "description": "API key of the user", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "account", "description": "the account name of the user", "type": "string" }, { }, { "name": "domainid", "description": "the domain ID of the user", "type": "string" }, { "name": "username", "description": "the user name", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "created", "description": "the date and time the user account was created", "type": "date" }, { "name": "domain", "description": "the domain name of the user", "type": "string" }, { "name": "firstname", "description": "the user firstname", "type": "string" }, { "name": "email", "description": "the user email address", "type": "string" }, { "name": "rolename", "description": "the name of the role", "type": "string" }, { "name": "roleid", "description": "the ID of the role", "type": "string" }, { "name": "iscallerchilddomain", "description": "the boolean value representing if the updating target is in caller's child domain", "type": "boolean" }, { "name": "timezone", "description": "the timezone user was created in", "type": "string" }, { "name": "accounttype", "description": "the account type of the user", "type": "short" }, { "name": "apikey", "description": "the api key of the user", "type": "string" }, { "name": "state", "description": "the user state", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "usersource", "description": "the source type of the user in lowercase, such as native, ldap, saml2", "type": "string" }, { "name": "roletype", "description": "the type of the role", "type": "string" }, { "name": "id", "description": "the user ID", "type": "string" }, { "name": "isdefault", "description": "true if user is default, false otherwise", "type": "boolean" }, { "name": "secretkey", "description": "the secret key of the user", "type": "string" }, { "name": "lastname", "description": "the user lastname", "type": "string" }, { "name": "accountid", "description": "the account ID of the user", "type": "string" } ] }, { "name": "listLoadBalancerRules", "description": "Lists load balancer rules.", "isasync": false, "related": "", "params": [ { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "virtualmachineid", "description": "the ID of the virtual machine of the load balancer rule", "type": "uuid", "length": 255, "required": false, "related": "destroyVirtualMachine,startVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "networkid", "description": "list by network ID the rule belongs to", "type": "uuid", "length": 255, "required": false, "related": "listNetworks,updateNetwork,createNetwork" }, { "name": "name", "description": "the name of the load balancer rule", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "the availability zone ID", "type": "uuid", "length": 255, "required": false, "related": "listZones" }, { "name": "id", "description": "the ID of the load balancer rule", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "tags", "description": "List resources by tags (key/value pairs)", "type": "map", "length": 255, "required": false }, { "name": "projectid", "description": "list objects by project", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "publicipid", "description": "the public IP address ID of the load balancer rule", "type": "uuid", "length": 255, "required": false, "related": "associateIpAddress,listPublicIpAddresses" }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "account", "description": "list resources by account. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "fordisplay", "description": "list resources by display flag; only ROOT admin is eligible to pass this parameter", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "algorithm", "description": "the load balancer algorithm (source, roundrobin, leastconn)", "type": "string" }, { "name": "description", "description": "the description of the load balancer", "type": "string" }, { }, { "name": "networkid", "description": "the id of the guest network the lb rule belongs to", "type": "string" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { "name": "id", "description": "the load balancer rule ID", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "zoneid", "description": "the id of the zone the rule belongs to", "type": "string" }, { "name": "name", "description": "the name of the load balancer", "type": "string" }, { "name": "publicip", "description": "the public ip address", "type": "string" }, { "name": "domain", "description": "the domain of the load balancer rule", "type": "string" }, { "name": "privateport", "description": "the private port", "type": "string" }, { "name": "publicipid", "description": "the public ip address id", "type": "string" }, { "name": "project", "description": "the project name of the load balancer", "type": "string" }, { "name": "projectid", "description": "the project id of the load balancer", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "account", "description": "the account of the load balancer rule", "type": "string" }, { "name": "zonename", "description": "the name of the zone the load balancer rule belongs to", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the loadbalanacer rule", "type": "string" }, { "name": "domainid", "description": "the domain ID of the load balancer rule", "type": "string" }, { "name": "publicport", "description": "the public port", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with load balancer", "type": "list", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] } ] }, { "name": "deleteFirewallRule", "description": "Deletes a firewall rule", "isasync": true, "params": [ { "name": "id", "description": "the ID of the firewall rule", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "uploadSslCert", "description": "Upload a certificate to CloudStack", "isasync": false, "related": "", "params": [ { "name": "certificate", "description": "SSL certificate", "type": "string", "length": 16384, "required": true }, { "name": "account", "description": "account that will own the SSL certificate", "type": "string", "length": 255, "required": false }, { "name": "privatekey", "description": "Private key", "type": "string", "length": 16384, "required": true }, { "name": "domainid", "description": "domain ID of the account owning the SSL certificate", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "projectid", "description": "an optional project for the SSL certificate", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "name", "description": "Name for the uploaded certificate", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "Password for the private key", "type": "string", "length": 255, "required": false }, { "name": "certchain", "description": "Certificate chain of trust", "type": "string", "length": 2097152, "required": false } ], "response": [ { "name": "id", "description": "SSL certificate ID", "type": "string" }, { "name": "loadbalancerrulelist", "description": "List of loabalancers this certificate is bound to", "type": "list" }, { "name": "projectid", "description": "the project id of the certificate", "type": "string" }, { }, { "name": "domain", "description": "the domain name of the network owner", "type": "string" }, { "name": "name", "description": "name", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "certchain", "description": "certificate chain", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "account", "description": "account for the certificate", "type": "string" }, { "name": "fingerprint", "description": "certificate fingerprint", "type": "string" }, { "name": "project", "description": "the project name of the certificate", "type": "string" }, { "name": "domainid", "description": "the domain id of the network owner", "type": "string" }, { "name": "certificate", "description": "certificate", "type": "string" } ] }, { "name": "createVpnCustomerGateway", "description": "Creates site to site vpn customer gateway", "isasync": true, "related": "", "params": [ { "name": "cidrlist", "description": "guest cidr list of the customer gateway", "type": "string", "length": 255, "required": true }, { "name": "gateway", "description": "public ip address id of the customer gateway", "type": "string", "length": 255, "required": true }, { "name": "account", "description": "the account associated with the gateway. Must be used with the domainId parameter.", "type": "string", "length": 255, "required": false }, { "name": "forceencap", "description": "Force Encapsulation for NAT traversal", "type": "boolean", "length": 255, "required": false }, { "name": "esplifetime", "description": "Lifetime of phase 2 VPN connection to the customer gateway, in seconds", "type": "long", "length": 255, "required": false }, { "name": "domainid", "description": "the domain ID associated with the gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "dpd", "description": "If DPD is enabled for VPN connection", "type": "boolean", "length": 255, "required": false }, { "name": "ikepolicy", "description": "IKE policy of the customer gateway", "type": "string", "length": 255, "required": true }, { "name": "ipsecpsk", "description": "IPsec Preshared-Key of the customer gateway. Cannot contain newline or double quotes.", "type": "string", "length": 255, "required": true }, { "name": "ikelifetime", "description": "Lifetime of phase 1 VPN connection to the customer gateway, in seconds", "type": "long", "length": 255, "required": false }, { "name": "projectid", "description": "create site-to-site VPN customer gateway for the project", "type": "uuid", "length": 255, "required": false, "since": "4.6", "related": "" }, { "name": "esppolicy", "description": "ESP policy of the customer gateway", "type": "string", "length": 255, "required": true }, { "name": "name", "description": "name of this customer gateway", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "ikepolicy", "description": "IKE policy of customer gateway", "type": "string" }, { "name": "account", "description": "the owner", "type": "string" }, { "name": "dpd", "description": "if DPD is enabled for customer gateway", "type": "boolean" }, { "name": "esppolicy", "description": "IPsec policy of customer gateway", "type": "string" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "name", "description": "name of the customer gateway", "type": "string" }, { "name": "ipsecpsk", "description": "IPsec preshared-key of customer gateway", "type": "string" }, { }, { "name": "forceencap", "description": "if Force NAT Encapsulation is enabled for customer gateway", "type": "boolean" }, { "name": "gateway", "description": "public ip address id of the customer gateway", "type": "string" }, { "name": "project", "description": "the project name", "type": "string" }, { "name": "projectid", "description": "the project id", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "domain", "description": "the domain name of the owner", "type": "string" }, { "name": "ikelifetime", "description": "Lifetime of IKE SA of customer gateway", "type": "long" }, { "name": "domainid", "description": "the domain id of the owner", "type": "string" }, { "name": "cidrlist", "description": "guest cidr list of the customer gateway", "type": "string" }, { "name": "esplifetime", "description": "Lifetime of ESP SA of customer gateway", "type": "long" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "ipaddress", "description": "guest ip of the customer gateway", "type": "string" }, { "name": "id", "description": "the vpn gateway ID", "type": "string" } ] }, { "name": "createManagementNetworkIpRange", "description": "Creates a Management network IP range.", "since": "4.11.0.0", "isasync": true, "related": "", "params": [ { "name": "gateway", "description": "The gateway for the management network.", "type": "string", "length": 255, "required": true }, { "name": "vlan", "description": "Optional. The vlan id the ip range sits on, default to Null when it is not specificed which means you network is not on any Vlan", "type": "string", "length": 255, "required": false }, { "name": "forsystemvms", "description": "Specify if range is dedicated for CPVM and SSVM.", "type": "boolean", "length": 255, "required": false }, { "name": "endip", "description": "The ending IP address.", "type": "string", "length": 255, "required": false }, { "name": "startip", "description": "The starting IP address.", "type": "string", "length": 255, "required": true }, { "name": "netmask", "description": "The netmask for the management network.", "type": "string", "length": 255, "required": true }, { "name": "podid", "description": "UUID of POD, where the IP range belongs to.", "type": "uuid", "length": 255, "required": true, "related": "createManagementNetworkIpRange" } ], "response": [ { }, { "name": "gateway", "description": "the gateway of the Pod", "type": "string" }, { "name": "zoneid", "description": "the Zone ID of the Pod", "type": "string" }, { "name": "forsystemvms", "description": "indicates if range is dedicated for CPVM and SSVM", "type": "list" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "startip", "description": "the starting IP for the Pod", "type": "list" }, { }, { "name": "capacity", "description": "the capacity of the Pod", "type": "list", "response": [ { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "name", "description": "the capacity name", "type": "string" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "podid", "description": "the Pod ID", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" } ] }, { "name": "endip", "description": "the ending IP for the Pod", "type": "list" }, { "name": "id", "description": "the ID of the Pod", "type": "string" }, { "name": "zonename", "description": "the Zone name of the Pod", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "allocationstate", "description": "the allocation state of the Pod", "type": "string" }, { "name": "vlanid", "description": "indicates Vlan ID for the range", "type": "list" }, { "name": "netmask", "description": "the netmask of the Pod", "type": "string" }, { "name": "name", "description": "the name of the Pod", "type": "string" } ] }, { "name": "addVpnUser", "description": "Adds vpn users", "isasync": true, "related": "", "params": [ { "name": "projectid", "description": "add vpn user to the specific project", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "account", "description": "an optional account for the vpn user. Must be used with domainId.", "type": "string", "length": 255, "required": false }, { "name": "username", "description": "username for the vpn user", "type": "string", "length": 255, "required": true }, { "name": "password", "description": "password for the username", "type": "string", "length": 255, "required": true }, { "name": "domainid", "description": "an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.", "type": "uuid", "length": 255, "required": false, "related": "listDomains" } ], "response": [ { "name": "id", "description": "the vpn userID", "type": "string" }, { "name": "domain", "description": "the domain name of the account of the remote access vpn", "type": "string" }, { }, { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "domainid", "description": "the domain id of the account of the remote access vpn", "type": "string" }, { "name": "username", "description": "the username of the vpn user", "type": "string" }, { "name": "account", "description": "the account of the remote access vpn", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "state", "description": "the state of the Vpn User", "type": "string" }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" } ] }, { "name": "removeAnnotation", "description": "remove an annotation.", "since": "4.11", "isasync": false, "related": "", "params": [ { "name": "id", "description": "the id of the annotation", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "created", "description": "the creation timestamp for this annotation", "type": "date" }, { "name": "annotation", "description": "the contents of the annotation", "type": "string" }, { "name": "entityid", "description": "the (uu)id of the entitiy to which this annotation pertains", "type": "string" }, { "name": "removed", "description": "the removal timestamp for this annotation", "type": "date" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { }, { "name": "entitytype", "description": "the type of the annotated entity", "type": "string" }, { "name": "id", "description": "the (uu)id of the annotation", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "userid", "description": "The (uu)id of the user that entered the annotation", "type": "string" } ] }, { "name": "addBaremetalHost", "description": "add a baremetal host", "isasync": false, "related": "", "params": [ { "name": "clusterid", "description": "the cluster ID for the host", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "podid", "description": "the Pod ID for the host", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "username", "description": "the username for the host", "type": "string", "length": 255, "required": true }, { "name": "hosttags", "description": "list of tags to be added to the host", "type": "list", "length": 255, "required": false }, { "name": "zoneid", "description": "the Zone ID for the host", "type": "uuid", "length": 255, "required": true, "related": "listZones" }, { "name": "ipaddress", "description": "ip address intentionally allocated to this host after provisioning", "type": "string", "length": 255, "required": false }, { "name": "allocationstate", "description": "Allocation state of this Host for allocation of new resources", "type": "string", "length": 255, "required": false }, { "name": "hypervisor", "description": "hypervisor type of the host", "type": "string", "length": 255, "required": true }, { "name": "clustername", "description": "the cluster name for the host", "type": "string", "length": 255, "required": false }, { "name": "password", "description": "the password for the host", "type": "string", "length": 255, "required": true }, { "name": "url", "description": "the host URL", "type": "string", "length": 255, "required": true } ], "response": [ { "name": "lastannotated", "description": "the last time this host was annotated", "type": "date" }, { "name": "capabilities", "description": "capabilities of the host", "type": "string" }, { "name": "hypervisor", "description": "the host hypervisor", "type": "hypervisortype" }, { "name": "cpusockets", "description": "the number of CPU sockets on the host", "type": "integer" }, { "name": "removed", "description": "the date and time the host was removed", "type": "date" }, { "name": "outofbandmanagement", "description": "the host out-of-band management information", "type": "outofbandmanagementresponse" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "created", "description": "the date and time the host was created", "type": "date" }, { "name": "memorywithoverprovisioning", "description": "the amount of the host's memory after applying the mem.overprovisioning.factor", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "name", "description": "the name of the host", "type": "string" }, { "name": "suitableformigration", "description": "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise", "type": "boolean" }, { "name": "podid", "description": "the Pod ID of the host", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the host", "type": "long" }, { "name": "oscategoryname", "description": "the OS category name of the host", "type": "string" }, { "name": "details", "description": "Host details in key/value pairs.", "type": "map" }, { "name": "state", "description": "the state of the host", "type": "status" }, { "name": "disksizetotal", "description": "the total disk size of the host", "type": "long" }, { "name": "cpuwithoverprovisioning", "description": "the amount of the host's CPU after applying the cpu.overprovisioning.factor ", "type": "string" }, { "name": "hostha", "description": "the host HA information information", "type": "hostharesponse" }, { "name": "zonename", "description": "the Zone name of the host", "type": "string" }, { "name": "hasenoughcapacity", "description": "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise", "type": "boolean" }, { "name": "hypervisorversion", "description": "the hypervisor version", "type": "string" }, { "name": "podname", "description": "the Pod name of the host", "type": "string" }, { "name": "lastpinged", "description": "the date and time the host was last pinged", "type": "date" }, { "name": "type", "description": "the host type", "type": "type" }, { "name": "zoneid", "description": "the Zone ID of the host", "type": "string" }, { "name": "events", "description": "events available for the host", "type": "string" }, { "name": "clustertype", "description": "the cluster type of the cluster that host belongs to", "type": "string" }, { "name": "username", "description": "the admin that annotated this host", "type": "string" }, { "name": "version", "description": "the host version", "type": "string" }, { "name": "resourcestate", "description": "the resource state of the host", "type": "string" }, { "name": "hahost", "description": "true if the host is Ha host (dedicated to vms started by HA process; false otherwise", "type": "boolean" }, { "name": "id", "description": "the ID of the host", "type": "string" }, { "name": "oscategoryid", "description": "the OS category ID of the host", "type": "string" }, { "name": "annotation", "description": "the last annotation set on this host by an admin", "type": "string" }, { }, { "name": "gpugroup", "description": "GPU cards present in the host", "type": "list", "response": [ { "name": "vgpu", "description": "the list of enabled vGPUs", "type": "list", "response": [ { "name": "videoram", "description": "Video RAM for this vGPU type", "type": "long" }, { "name": "maxresolutionx", "description": "Maximum X resolution per display", "type": "long" }, { "name": "maxresolutiony", "description": "Maximum Y resolution per display", "type": "long" }, { "name": "remainingcapacity", "description": "Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type", "type": "long" }, { "name": "maxvgpuperpgpu", "description": "Maximum no. of vgpu per gpu card (pgpu)", "type": "long" }, { "name": "vgputype", "description": "Model Name of vGPU", "type": "string" }, { "name": "maxcapacity", "description": "Maximum vgpu can be created with this vgpu type on the given gpu group", "type": "long" }, { "name": "maxheads", "description": "Maximum displays per user", "type": "long" } ] }, { "name": "gpugroupname", "description": "GPU cards present in the host", "type": "string" } ] }, { "name": "disconnected", "description": "true if the host is disconnected. False otherwise.", "type": "date" }, { "name": "memorytotal", "description": "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning", "type": "long" }, { "name": "cpunumber", "description": "the CPU number of the host", "type": "integer" }, { "name": "managementserverid", "description": "the management server ID of the host", "type": "long" }, { "name": "memoryallocated", "description": "the amount of the host's memory currently allocated", "type": "long" }, { "name": "memoryused", "description": "the amount of the host's memory currently used", "type": "long" }, { "name": "ipaddress", "description": "the IP address of the host", "type": "string" }, { "name": "clusterid", "description": "the cluster ID of the host", "type": "string" }, { "name": "cpuspeed", "description": "the CPU speed of the host", "type": "long" }, { }, { "name": "clustername", "description": "the cluster name of the host", "type": "string" }, { "name": "cpuallocated", "description": "the amount of the host's CPU currently allocated", "type": "string" }, { "name": "cpuused", "description": "the amount of the host's CPU currently used", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "averageload", "description": "the cpu average load on the host", "type": "long" }, { "name": "islocalstorageactive", "description": "true if local storage is active, false otherwise", "type": "boolean" }, { "name": "disksizeallocated", "description": "the host's currently allocated disk size", "type": "long" }, { "name": "hosttags", "description": "comma-separated list of tags for the host", "type": "string" } ] }, { "name": "deleteRolePermission", "description": "Deletes a role permission", "since": "4.9.0", "isasync": false, "params": [ { "name": "id", "description": "ID of the role permission", "type": "uuid", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "releasePodIpAddress", "description": "Releases a Pod IP back to the Pod", "isasync": false, "params": [ { "name": "id", "description": "UUID of the Pod IP", "type": "long", "length": 255, "required": true } ], "response": [ { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "updateRemoteAccessVpn", "description": "Updates remote access vpn", "since": "4.4", "isasync": true, "related": "", "params": [ { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "fordisplay", "description": "an optional field, whether to the display the vpn to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "id of the remote access vpn", "type": "uuid", "length": 255, "required": true, "related": "updateRemoteAccessVpn" } ], "response": [ { "name": "project", "description": "the project name of the vpn", "type": "string" }, { "name": "state", "description": "the state of the rule", "type": "string" }, { "name": "domain", "description": "the domain name of the account of the remote access vpn", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "presharedkey", "description": "the ipsec preshared key", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "fordisplay", "description": "is vpn for display to the regular user", "type": "boolean" }, { "name": "account", "description": "the account of the remote access vpn", "type": "string" }, { "name": "id", "description": "the id of the remote access vpn", "type": "string" }, { "name": "iprange", "description": "the range of ips to allocate to the clients", "type": "string" }, { "name": "publicip", "description": "the public ip address of the vpn server", "type": "string" }, { "name": "publicipid", "description": "the public ip address of the vpn server", "type": "string" }, { "name": "domainid", "description": "the domain id of the account of the remote access vpn", "type": "string" }, { }, { "name": "projectid", "description": "the project id of the vpn", "type": "string" }, { } ] }, { "name": "updateVPCOffering", "description": "Updates VPC offering", "isasync": true, "related": "", "params": [ { "name": "id", "description": "the id of the VPC offering", "type": "uuid", "length": 255, "required": true, "related": "updateVPCOffering" }, { "name": "name", "description": "the name of the VPC offering", "type": "string", "length": 255, "required": false }, { "name": "state", "description": "update state for the VPC offering; supported states - Enabled/Disabled", "type": "string", "length": 255, "required": false }, { "name": "displaytext", "description": "the display text of the VPC offering", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "displaytext", "description": "an alternate display text of the vpc offering.", "type": "string" }, { "name": "created", "description": "the date this vpc offering was created", "type": "date" }, { "name": "supportsregionLevelvpc", "description": " indicated if the offering can support region level vpc", "type": "boolean" }, { "name": "isdefault", "description": "true if vpc offering is default, false otherwise", "type": "boolean" }, { "name": "state", "description": "state of the vpc offering. Can be Disabled/Enabled", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "service", "description": "the list of supported services", "type": "list", "response": [ { "name": "name", "description": "the service name", "type": "string" }, { "name": "capability", "description": "the list of capabilities", "type": "list", "response": [ { "name": "value", "description": "the capability value", "type": "string" }, { "name": "canchooseservicecapability", "description": "can this service capability value can be choosable while creatine network offerings", "type": "boolean" }, { "name": "name", "description": "the capability name", "type": "string" } ] }, { "name": "provider", "description": "the service provider name", "type": "list", "response": [ { "name": "id", "description": "uuid of the network provider", "type": "string" }, { "name": "state", "description": "state of the network provider", "type": "string" }, { "name": "physicalnetworkid", "description": "the physical network this belongs to", "type": "string" }, { "name": "servicelist", "description": "services for this provider", "type": "list" }, { "name": "name", "description": "the provider name", "type": "string" }, { "name": "destinationphysicalnetworkid", "description": "the destination physical network", "type": "string" }, { "name": "canenableindividualservice", "description": "true if individual services can be enabled/disabled", "type": "boolean" } ] } ] }, { }, { "name": "distributedvpcrouter", "description": " indicates if the vpc offering supports distributed router for one-hop forwarding", "type": "boolean" }, { "name": "name", "description": "the name of the vpc offering", "type": "string" }, { "name": "id", "description": "the id of the vpc offering", "type": "string" } ] }, { "name": "scaleVirtualMachine", "description": "Scales the virtual machine to a new service offering.", "isasync": true, "params": [ { "name": "details", "description": "name value pairs of custom parameters for cpu,memory and cpunumber. example details[i].name=value", "type": "map", "length": 255, "required": false }, { "name": "serviceofferingid", "description": "the ID of the service offering for the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "listServiceOfferings,updateServiceOffering" }, { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,startVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" } ] }, { "name": "destroyVirtualMachine", "description": "Destroys a virtual machine.", "isasync": true, "related": "startVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "volumeids", "description": "Comma separated list of UUIDs for volumes that will be deleted", "type": "list", "length": 255, "required": false, "since": "4.12.0", "related": "createVolume,listVolumes,updateVolume,resizeVolume,migrateVolume,attachVolume,uploadVolume,detachVolume" }, { "name": "expunge", "description": "If true is passed, the vm is expunged immediately. False by default.", "type": "boolean", "length": 255, "required": false, "since": "4.2.1" }, { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "destroyVirtualMachine,startVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] } ] }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" } ] }, { "name": "name", "description": "the name of the security group", "type": "string" } ] }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" } ] }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" } ] }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" } ] }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" } ] }, { "name": "updateEgressFirewallRule", "description": "Updates egress firewall rule ", "since": "4.4", "isasync": true, "related": "", "params": [ { "name": "id", "description": "the ID of the egress firewall rule", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "customid", "description": "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "fordisplay", "description": "an optional field, whether to the display the rule to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "state", "description": "the state of the rule", "type": "string" }, { }, { "name": "startport", "description": "the starting port of firewall rule's port range", "type": "integer" }, { "name": "cidrlist", "description": "the cidr list to forward traffic from", "type": "string" }, { "name": "icmpcode", "description": "error code for this icmp message", "type": "integer" }, { "name": "networkid", "description": "the network id of the firewall rule", "type": "string" }, { "name": "ipaddressid", "description": "the public ip address id for the firewall rule", "type": "string" }, { "name": "endport", "description": "the ending port of firewall rule's port range", "type": "integer" }, { "name": "fordisplay", "description": "is rule for display to the regular user", "type": "boolean" }, { }, { "name": "ipaddress", "description": "the public ip address for the firewall rule", "type": "string" }, { "name": "destcidrlist", "description": "the cidr list to forward traffic to", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "list", "response": [ { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "icmptype", "description": "type of the icmp message being sent", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the firewall rule", "type": "string" }, { "name": "protocol", "description": "the protocol of the firewall rule", "type": "string" } ] }, { "name": "listServiceOfferings", "description": "Lists all available service offerings.", "isasync": false, "related": "updateServiceOffering", "params": [ { "name": "id", "description": "ID of the service offering", "type": "uuid", "length": 255, "required": false, "related": "listServiceOfferings,updateServiceOffering" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "issystem", "description": "is this a system vm offering", "type": "boolean", "length": 255, "required": false }, { "name": "systemvmtype", "description": "the system VM type. Possible types are \"consoleproxy\", \"secondarystoragevm\" or \"domainrouter\".", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "domainid", "description": "list only resources belonging to the domain specified", "type": "uuid", "length": 255, "required": false, "related": "listDomains" }, { "name": "virtualmachineid", "description": "the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.", "type": "uuid", "length": 255, "required": false, "related": "startVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "name", "description": "name of the service offering", "type": "string", "length": 255, "required": false }, { "name": "isrecursive", "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.", "type": "boolean", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "listall", "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false", "type": "boolean", "length": 255, "required": false } ], "response": [ { "name": "diskBytesReadRate", "description": "bytes read rate of the service offering", "type": "long" }, { "name": "maxiops", "description": "the max iops of the disk offering", "type": "long" }, { "name": "cpunumber", "description": "the number of CPU", "type": "integer" }, { "name": "name", "description": "the name of the service offering", "type": "string" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the service offering", "type": "long" }, { "name": "tags", "description": "the tags for the service offering", "type": "string" }, { "name": "diskIopsWriteRateMax", "description": "burst io requests write rate of the disk offering", "type": "long" }, { "name": "diskBytesReadRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "memory", "description": "the memory in MB", "type": "integer" }, { "name": "displaytext", "description": "an alternate display text of the service offering.", "type": "string" }, { "name": "iscustomizediops", "description": "true if disk offering uses custom iops, false otherwise", "type": "boolean" }, { "name": "networkrate", "description": "data transfer rate in megabits per second allowed.", "type": "integer" }, { "name": "created", "description": "the date this service offering was created", "type": "date" }, { "name": "hosttags", "description": "the host tag for the service offering", "type": "string" }, { "name": "issystem", "description": "is this a system vm offering", "type": "boolean" }, { "name": "id", "description": "the id of the service offering", "type": "string" }, { "name": "cpuspeed", "description": "the clock rate CPU speed in Mhz", "type": "integer" }, { "name": "domain", "description": "Domain name for the offering", "type": "string" }, { "name": "limitcpuuse", "description": "restrict the CPU usage to committed service offering", "type": "boolean" }, { "name": "diskBytesWriteRateMax", "description": "burst bytes write rate of the disk offering", "type": "long" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes. Valid values are thin, sparse, fat.", "type": "string" }, { "name": "diskBytesReadRateMax", "description": "burst bytes read rate of the disk offering", "type": "long" }, { "name": "defaultuse", "description": "is this a default system vm offering", "type": "boolean" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the service offering", "type": "long" }, { "name": "hypervisorsnapshotreserve", "description": "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", "type": "integer" }, { "name": "serviceofferingdetails", "description": "additional key/value details tied with this service offering", "type": "map" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "diskIopsReadRateMaxLength", "description": "length (in second) of the burst", "type": "long" }, { "name": "miniops", "description": "the min iops of the disk offering", "type": "long" }, { "name": "domainid", "description": "the domain id of the service offering", "type": "string" }, { "name": "diskIopsReadRateMax", "description": "burst io requests read rate of the disk offering", "type": "long" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "diskIopsWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the service offering", "type": "long" }, { "name": "storagetype", "description": "the storage type for this service offering", "type": "string" }, { "name": "systemvmtype", "description": "is this a the systemvm type for system vm offering", "type": "string" }, { "name": "offerha", "description": "the ha support in the service offering", "type": "boolean" }, { "name": "iscustomized", "description": "is true if the offering is customized", "type": "boolean" }, { "name": "deploymentplanner", "description": "deployment strategy used to deploy VM.", "type": "string" }, { "name": "diskBytesWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { }, { "name": "isvolatile", "description": "true if the vm needs to be volatile, i.e., on every reboot of vm from API root disk is discarded and creates a new root disk", "type": "boolean" }, { } ] }, { "name": "listOsCategories", "description": "Lists all supported OS categories for this cloud.", "isasync": false, "related": "", "params": [ { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "list Os category by id", "type": "uuid", "length": 255, "required": false, "related": "listOsCategories" }, { "name": "name", "description": "list os category by name", "type": "string", "length": 255, "required": false, "since": "3.0.1" } ], "response": [ { "name": "name", "description": "the name of the OS category", "type": "string" }, { }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "id", "description": "the ID of the OS category", "type": "string" }, { } ] }, { "name": "listAffinityGroupTypes", "description": "Lists affinity group types available", "isasync": false, "related": "", "params": [ { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { } ] }, { "name": "removeFromGlobalLoadBalancerRule", "description": "Removes a load balancer rule association with global load balancer rule", "isasync": true, "params": [ { "name": "id", "description": "The ID of the load balancer rule", "type": "uuid", "length": 255, "required": true, "related": "" }, { "name": "loadbalancerrulelist", "description": "the list load balancer rules that will be assigned to gloabal load balancer rule", "type": "list", "length": 255, "required": true, "related": "" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "displaytext", "description": "any text associated with the success or failure", "type": "string" }, { }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "success", "description": "true if operation is executed successfully", "type": "boolean" } ] }, { "name": "listCapacity", "description": "Lists all the system wide capacities.", "isasync": false, "related": "", "params": [ { "name": "sortby", "description": "Sort the results. Available values: Usage", "type": "string", "length": 255, "required": false, "since": "3.0.0" }, { "name": "keyword", "description": "List by keyword", "type": "string", "length": 255, "required": false }, { "name": "zoneid", "description": "lists capacity by the Zone ID", "type": "uuid", "length": 255, "required": false, "related": "listZones" }, { "name": "page", "description": "", "type": "integer", "length": 255, "required": false }, { "name": "podid", "description": "lists capacity by the Pod ID", "type": "uuid", "length": 255, "required": false, "related": "" }, { "name": "type", "description": "lists capacity by type* CAPACITY_TYPE_MEMORY = 0* CAPACITY_TYPE_CPU = 1* CAPACITY_TYPE_STORAGE = 2* CAPACITY_TYPE_STORAGE_ALLOCATED = 3* CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = 4* CAPACITY_TYPE_PRIVATE_IP = 5* CAPACITY_TYPE_SECONDARY_STORAGE = 6* CAPACITY_TYPE_VLAN = 7* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8* CAPACITY_TYPE_LOCAL_STORAGE = 9* CAPACITY_TYPE_GPU = 19* CAPACITY_TYPE_CPU_CORE = 90.", "type": "integer", "length": 255, "required": false }, { "name": "clusterid", "description": "lists capacity by the Cluster ID", "type": "uuid", "length": 255, "required": false, "since": "3.0.0", "related": "" }, { "name": "fetchlatest", "description": "recalculate capacities and fetch the latest", "type": "boolean", "length": 255, "required": false, "since": "3.0.0" }, { "name": "pagesize", "description": "", "type": "integer", "length": 255, "required": false } ], "response": [ { "name": "podname", "description": "the Pod name", "type": "string" }, { "name": "capacityallocated", "description": "the capacity currently in allocated", "type": "long" }, { "name": "zonename", "description": "the Zone name", "type": "string" }, { "name": "clusterid", "description": "the Cluster ID", "type": "string" }, { "name": "type", "description": "the capacity type", "type": "short" }, { "name": "percentused", "description": "the percentage of capacity currently in use", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { }, { "name": "clustername", "description": "the Cluster name", "type": "string" }, { "name": "capacitytotal", "description": "the total capacity available", "type": "long" }, { }, { "name": "capacityused", "description": "the capacity currently in use", "type": "long" }, { "name": "name", "description": "the capacity name", "type": "string" }, { "name": "zoneid", "description": "the Zone ID", "type": "string" }, { "name": "podid", "description": "the Pod ID", "type": "string" } ] }, { "name": "startVirtualMachine", "description": "Starts a virtual machine.", "isasync": true, "related": "stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "deploymentplanner", "description": "Deployment planner to use for vm allocation. Available to ROOT admin only", "type": "string", "length": 255, "required": false, "since": "4.4" }, { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "startVirtualMachine,stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" }, { "name": "hostid", "description": "destination Host ID to deploy the VM to - parameter available for root admin only", "type": "uuid", "length": 255, "required": false, "since": "3.0.1", "related": "" } ], "response": [ { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" } ] }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" } ] }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" } ] }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" }, { }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "domainid", "description": "the domain ID of the security group", "type": "string" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" } ] }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" } ] }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" } ] }, { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" } ] } ] }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" } ] }, { "name": "stopVirtualMachine", "description": "Stops a virtual machine.", "isasync": true, "related": "detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine", "params": [ { "name": "forced", "description": "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). The caller knows the VM is stopped.", "type": "boolean", "length": 255, "required": false }, { "name": "id", "description": "The ID of the virtual machine", "type": "uuid", "length": 255, "required": true, "related": "stopVirtualMachine,detachIso,removeNicFromVirtualMachine,listVirtualMachines,destroyVirtualMachine,attachIso,updateVMAffinityGroup,resetSSHKeyForVirtualMachine,updateVirtualMachine,startVirtualMachine,changeServiceForVirtualMachine,restoreVirtualMachine,rebootVirtualMachine,revertToVMSnapshot,addNicToVirtualMachine,deployVirtualMachine,resetPasswordForVirtualMachine,updateDefaultNicForVirtualMachine,stopVirtualMachine" } ], "response": [ { "name": "rootdeviceid", "description": "device ID of the root volume", "type": "long" }, { "name": "cpuspeed", "description": "the speed of each cpu", "type": "integer" }, { "name": "publicipid", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { }, { "name": "displayname", "description": "user generated name. The name of the virtual machine is returned if no displayname exists.", "type": "string" }, { "name": "isoid", "description": "the ID of the ISO attached to the virtual machine", "type": "string" }, { "name": "projectid", "description": "the project id of the vm", "type": "string" }, { "name": "diskofferingname", "description": "the name of the disk offering of the virtual machine", "type": "string" }, { "name": "servicestate", "description": "State of the Service from LB rule", "type": "string" }, { "name": "diskofferingid", "description": "the ID of the disk offering of the virtual machine", "type": "string" }, { "name": "serviceofferingid", "description": "the ID of the service offering of the virtual machine", "type": "string" }, { "name": "memorytargetkbs", "description": "the target memory in vm", "type": "long" }, { "name": "hostid", "description": "the ID of the host for the virtual machine", "type": "string" }, { "name": "templatedisplaytext", "description": " an alternate display text of the template for the virtual machine", "type": "string" }, { "name": "vgpu", "description": "the vgpu type used by the virtual machine", "type": "string" }, { }, { "name": "nic", "description": "the list of nics associated with vm", "type": "set", "response": [ { "name": "isdefault", "description": "true if nic is default, false otherwise", "type": "boolean" }, { "name": "macaddress", "description": "true if nic is default, false otherwise", "type": "string" }, { "name": "secondaryip", "description": "the Secondary ipv4 addr of nic", "type": "list" }, { "name": "type", "description": "the type of the nic", "type": "string" }, { "name": "ip6gateway", "description": "the gateway of IPv6 network", "type": "string" }, { "name": "id", "description": "the ID of the nic", "type": "string" }, { "name": "extradhcpoption", "description": "the extra dhcp options on the nic", "type": "list" }, { "name": "gateway", "description": "the gateway of the nic", "type": "string" }, { "name": "ip6cidr", "description": "the cidr of IPv6 network", "type": "string" }, { "name": "nsxlogicalswitchport", "description": "Id of the NSX Logical Switch Port (if NSX based), null otherwise", "type": "string" }, { "name": "networkid", "description": "the ID of the corresponding network", "type": "string" }, { "name": "netmask", "description": "the netmask of the nic", "type": "string" }, { "name": "networkname", "description": "the name of the corresponding network", "type": "string" }, { "name": "traffictype", "description": "the traffic type of the nic", "type": "string" }, { "name": "nsxlogicalswitch", "description": "Id of the NSX Logical Switch (if NSX based), null otherwise", "type": "string" }, { "name": "isolationuri", "description": "the isolation uri of the nic", "type": "string" }, { "name": "ip6address", "description": "the IPv6 address of network", "type": "string" }, { "name": "ipaddress", "description": "the ip address of the nic", "type": "string" }, { "name": "deviceid", "description": "device id for the network when plugged into the virtual machine", "type": "string" }, { "name": "virtualmachineid", "description": "Id of the vm to which the nic belongs", "type": "string" }, { "name": "broadcasturi", "description": "the broadcast uri of the nic", "type": "string" } ] }, { "name": "diskkbswrite", "description": "the write (bytes) of disk on the vm", "type": "long" }, { "name": "zoneid", "description": "the ID of the availablility zone for the virtual machine", "type": "string" }, { "name": "id", "description": "the ID of the virtual machine", "type": "string" }, { "name": "templatename", "description": "the name of the template for the virtual machine", "type": "string" }, { "name": "project", "description": "the project name of the vm", "type": "string" }, { "name": "networkkbswrite", "description": "the outgoing network traffic on the host", "type": "long" }, { "name": "networkkbsread", "description": "the incoming network traffic on the vm", "type": "long" }, { "name": "forvirtualnetwork", "description": "the virtual network for the service offering", "type": "boolean" }, { "name": "templateid", "description": "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.", "type": "string" }, { "name": "isoname", "description": "the name of the ISO attached to the virtual machine", "type": "string" }, { "name": "instancename", "description": "instance name of the user vm; this parameter is returned to the ROOT admin only", "type": "string" }, { "name": "guestosid", "description": "Os type ID of the virtual machine", "type": "string" }, { "name": "group", "description": "the group name of the virtual machine", "type": "string" }, { "name": "diskiowrite", "description": "the write (io) of disk on the vm", "type": "long" }, { "name": "account", "description": "the account associated with the virtual machine", "type": "string" }, { "name": "diskioread", "description": "the read (io) of disk on the vm", "type": "long" }, { "name": "memorykbs", "description": "the memory used by the vm", "type": "long" }, { "name": "cpunumber", "description": "the number of cpu this virtual machine is running with", "type": "integer" }, { "name": "publicip", "description": "public IP address id associated with vm via Static nat rule", "type": "string" }, { "name": "password", "description": "the password (if exists) of the virtual machine", "type": "string" }, { "name": "affinitygroup", "description": "list of affinity groups associated with the virtual machine", "type": "set", "response": [ { "name": "virtualmachineIds", "description": "virtual machine IDs associated with this affinity group", "type": "list" }, { "name": "id", "description": "the ID of the affinity group", "type": "string" }, { "name": "project", "description": "the project name of the affinity group", "type": "string" }, { "name": "name", "description": "the name of the affinity group", "type": "string" }, { "name": "projectid", "description": "the project ID of the affinity group", "type": "string" }, { "name": "domain", "description": "the domain name of the affinity group", "type": "string" }, { "name": "type", "description": "the type of the affinity group", "type": "string" }, { "name": "domainid", "description": "the domain ID of the affinity group", "type": "string" }, { "name": "description", "description": "the description of the affinity group", "type": "string" }, { "name": "account", "description": "the account owning the affinity group", "type": "string" } ] }, { "name": "state", "description": "the state of the virtual machine", "type": "string" }, { "name": "keypair", "description": "ssh key-pair", "type": "string" }, { "name": "name", "description": "the name of the virtual machine", "type": "string" }, { "name": "created", "description": "the date when this virtual machine was created", "type": "date" }, { "name": "rootdevicetype", "description": "device type of the root volume", "type": "string" }, { "name": "isdynamicallyscalable", "description": "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.", "type": "boolean" }, { "name": "groupid", "description": "the group ID of the virtual machine", "type": "string" }, { "name": "securitygroup", "description": "list of security groups associated with the virtual machine", "type": "set", "response": [ { "name": "id", "description": "the ID of the security group", "type": "string" }, { "name": "domain", "description": "the domain name of the security group", "type": "string" }, { "name": "egressrule", "description": "the list of egress rules associated with the security group", "type": "set", "response": [ { "name": "ruleid", "description": "the id of the security group rule", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" } ] }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" } ] }, { "name": "projectid", "description": "the project id of the group", "type": "string" }, { "name": "project", "description": "the project name of the group", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" } ] }, { "name": "name", "description": "the name of the security group", "type": "string" }, { "name": "account", "description": "the account owning the security group", "type": "string" }, { "name": "description", "description": "the description of the security group", "type": "string" }, { "name": "virtualmachinecount", "description": "the number of virtualmachines associated with this securitygroup", "type": "integer" }, { "name": "ingressrule", "description": "the list of ingress rules associated with the security group", "type": "set", "response": [ { "name": "startport", "description": "the starting IP of the security group rule", "type": "integer" }, { "name": "cidr", "description": "the CIDR notation for the base IP address of the security group rule", "type": "string" }, { "name": "endport", "description": "the ending IP of the security group rule ", "type": "integer" }, { "name": "account", "description": "account owning the security group rule", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated with the rule", "type": "set", "response": [ { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "key", "description": "tag key name", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" } ] }, { "name": "icmpcode", "description": "the code for the ICMP message response", "type": "integer" }, { "name": "protocol", "description": "the protocol of the security group rule", "type": "string" }, { "name": "securitygroupname", "description": "security group name", "type": "string" }, { "name": "icmptype", "description": "the type of the ICMP message response", "type": "integer" }, { "name": "ruleid", "description": "the id of the security group rule", "type": "string" } ] }, { "name": "virtualmachineids", "description": "the list of virtualmachine ids associated with this securitygroup", "type": "set" }, { "name": "domainid", "description": "the domain ID of the security group", "type": "string" } ] }, { "name": "zonename", "description": "the name of the availability zone for the virtual machine", "type": "string" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "userid", "description": "the user's ID who deployed the virtual machine", "type": "string" }, { "name": "hypervisor", "description": "the hypervisor on which the template runs", "type": "string" }, { "name": "passwordenabled", "description": "true if the password rest feature is enabled, false otherwise", "type": "boolean" }, { "name": "memoryintfreekbs", "description": "the internal memory thats free in vm", "type": "long" }, { "name": "ostypeid", "description": "OS type id of the vm", "type": "string" }, { "name": "details", "description": "Vm details in key/value pairs.", "type": "map" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "memory", "description": "the memory allocated for the virtual machine", "type": "integer" }, { "name": "username", "description": "the user's name who deployed the virtual machine", "type": "string" }, { }, { "name": "diskkbsread", "description": "the read (bytes) of disk on the vm", "type": "long" }, { "name": "cpuused", "description": "the amount of the vm's CPU currently used", "type": "string" }, { "name": "hostname", "description": "the name of the host for the virtual machine", "type": "string" }, { "name": "displayvm", "description": "an optional field whether to the display the vm to the end user or not.", "type": "boolean" }, { "name": "domainid", "description": "the ID of the domain in which the virtual machine exists", "type": "string" }, { "name": "serviceofferingname", "description": "the name of the service offering of the virtual machine", "type": "string" }, { "name": "tags", "description": "the list of resource tags associated", "type": "set", "response": [ { "name": "key", "description": "tag key name", "type": "string" }, { "name": "project", "description": "the project name where tag belongs to", "type": "string" }, { "name": "value", "description": "tag value", "type": "string" }, { "name": "account", "description": "the account associated with the tag", "type": "string" }, { "name": "customer", "description": "customer associated with the tag", "type": "string" }, { "name": "resourcetype", "description": "resource type", "type": "string" }, { "name": "projectid", "description": "the project id the tag belongs to", "type": "string" }, { "name": "domainid", "description": "the ID of the domain associated with the tag", "type": "string" }, { "name": "domain", "description": "the domain associated with the tag", "type": "string" }, { "name": "resourceid", "description": "id of the resource", "type": "string" } ] }, { "name": "domain", "description": "the name of the domain in which the virtual machine exists", "type": "string" }, { "name": "haenable", "description": "true if high-availability is enabled, false otherwise", "type": "boolean" }, { "name": "isodisplaytext", "description": "an alternate display text of the ISO attached to the virtual machine", "type": "string" } ] }, { "name": "updateServiceOffering", "description": "Updates a service offering.", "isasync": false, "related": "", "params": [ { "name": "sortkey", "description": "sort key of the service offering, integer", "type": "integer", "length": 255, "required": false }, { "name": "id", "description": "the ID of the service offering to be updated", "type": "uuid", "length": 255, "required": true, "related": "updateServiceOffering" }, { "name": "displaytext", "description": "the display text of the service offering to be updated", "type": "string", "length": 255, "required": false }, { "name": "name", "description": "the name of the service offering to be updated", "type": "string", "length": 255, "required": false } ], "response": [ { "name": "offerha", "description": "the ha support in the service offering", "type": "boolean" }, { "name": "diskIopsWriteRate", "description": "io requests write rate of the service offering", "type": "long" }, { "name": "storagetype", "description": "the storage type for this service offering", "type": "string" }, { "name": "diskBytesWriteRateMax", "description": "burst bytes write rate of the disk offering", "type": "long" }, { "name": "created", "description": "the date this service offering was created", "type": "date" }, { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "diskBytesReadRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "hosttags", "description": "the host tag for the service offering", "type": "string" }, { }, { "name": "issystem", "description": "is this a system vm offering", "type": "boolean" }, { "name": "cpuspeed", "description": "the clock rate CPU speed in Mhz", "type": "integer" }, { "name": "serviceofferingdetails", "description": "additional key/value details tied with this service offering", "type": "map" }, { "name": "domainid", "description": "the domain id of the service offering", "type": "string" }, { "name": "hypervisorsnapshotreserve", "description": "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", "type": "integer" }, { "name": "diskBytesReadRateMax", "description": "burst bytes read rate of the disk offering", "type": "long" }, { "name": "systemvmtype", "description": "is this a the systemvm type for system vm offering", "type": "string" }, { "name": "limitcpuuse", "description": "restrict the CPU usage to committed service offering", "type": "boolean" }, { "name": "cpunumber", "description": "the number of CPU", "type": "integer" }, { "name": "diskIopsReadRateMax", "description": "burst io requests read rate of the disk offering", "type": "long" }, { "name": "maxiops", "description": "the max iops of the disk offering", "type": "long" }, { "name": "diskIopsWriteRateMax", "description": "burst io requests write rate of the disk offering", "type": "long" }, { "name": "domain", "description": "Domain name for the offering", "type": "string" }, { "name": "diskIopsReadRateMaxLength", "description": "length (in second) of the burst", "type": "long" }, { }, { "name": "iscustomized", "description": "is true if the offering is customized", "type": "boolean" }, { "name": "networkrate", "description": "data transfer rate in megabits per second allowed.", "type": "integer" }, { "name": "name", "description": "the name of the service offering", "type": "string" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "deploymentplanner", "description": "deployment strategy used to deploy VM.", "type": "string" }, { "name": "iscustomizediops", "description": "true if disk offering uses custom iops, false otherwise", "type": "boolean" }, { "name": "diskBytesWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "tags", "description": "the tags for the service offering", "type": "string" }, { "name": "provisioningtype", "description": "provisioning type used to create volumes. Valid values are thin, sparse, fat.", "type": "string" }, { "name": "displaytext", "description": "an alternate display text of the service offering.", "type": "string" }, { "name": "diskIopsReadRate", "description": "io requests read rate of the service offering", "type": "long" }, { "name": "diskBytesReadRate", "description": "bytes read rate of the service offering", "type": "long" }, { "name": "memory", "description": "the memory in MB", "type": "integer" }, { "name": "diskBytesWriteRate", "description": "bytes write rate of the service offering", "type": "long" }, { "name": "isvolatile", "description": "true if the vm needs to be volatile, i.e., on every reboot of vm from API root disk is discarded and creates a new root disk", "type": "boolean" }, { "name": "miniops", "description": "the min iops of the disk offering", "type": "long" }, { "name": "diskIopsWriteRateMaxLength", "description": "length (in seconds) of the burst", "type": "long" }, { "name": "id", "description": "the id of the service offering", "type": "string" }, { "name": "defaultuse", "description": "is this a default system vm offering", "type": "boolean" } ] }, { "name": "createNetworkACLList", "description": "Creates a network ACL for the given VPC", "isasync": true, "related": "", "params": [ { "name": "name", "description": "Name of the network ACL list", "type": "string", "length": 255, "required": true }, { "name": "description", "description": "Description of the network ACL list", "type": "string", "length": 255, "required": false }, { "name": "vpcid", "description": "ID of the VPC associated with this network ACL list", "type": "uuid", "length": 255, "required": true, "related": "listVPCs,createVPC,updateVPC" }, { "name": "fordisplay", "description": "an optional field, whether to the display the list to the end user or not", "type": "boolean", "length": 255, "required": false, "since": "4.4" } ], "response": [ { "name": "jobstatus", "description": "the current status of the latest async job acting on this object", "type": "integer" }, { "name": "jobid", "description": "the UUID of the latest async job acting on this object", "type": "string" }, { "name": "fordisplay", "description": "is ACL for display to the regular user", "type": "boolean" }, { "name": "vpcid", "description": "Id of the VPC this ACL is associated with", "type": "string" }, { }, { }, { "name": "description", "description": "Description of the ACL", "type": "string" }, { "name": "name", "description": "the Name of the ACL", "type": "string" }, { "name": "id", "description": "the ID of the ACL", "type": "string" } ] } ] } go-cloudstack-2.9.0/generate/regex.txt000066400000000000000000000022731364073403100177330ustar00rootroot00000000000000# # Copyright 2018, Sander van Harmelen # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Below are some search/replace regex values (within single quotes) used within Sublime to format the API docs from the website. Maybe I'll add another function for this later on, but for now this also works fine... Search: '(.*)\n
    \n
  • ' Replace: '$1' Search: '(.*)\n
  • \n
  • ' Replace: ' $1' Search: '(.*)\n
  • \n
\n' Replace: ' $1' Search: '\n.*\n' Replace: '' Search: '^([\S]+)$' Replace: '},\n"$1Service": {' Search: '^([\S]+)\ ([\S]+)[^{]$' Replace: '},\n"$1$2Service": {' Search: ' \(A\)$' Replace: '' Search: '^ ([\S]+)$' Replace: ' "$1",' go-cloudstack-2.9.0/go.mod000066400000000000000000000000621364073403100153660ustar00rootroot00000000000000module github.com/xanzy/go-cloudstack/v2 go 1.13