mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	godep: add go-cloudstack dependency
This commit is contained in:
		
							
								
								
									
										5
									
								
								Godeps/Godeps.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								Godeps/Godeps.json
									
									
									
										generated
									
									
									
								
							@@ -2123,6 +2123,11 @@
 | 
			
		||||
			"Comment": "v0.8.0-9-gb5ee639",
 | 
			
		||||
			"Rev": "b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514"
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "github.com/xanzy/go-cloudstack/cloudstack",
 | 
			
		||||
			"Comment": "v2.1.1-1-g1e2cbf6",
 | 
			
		||||
			"Rev": "1e2cbf647e57fa90353612074fdfc42faf5073bf"
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "github.com/xiang90/probing",
 | 
			
		||||
			"Rev": "6a0cc1ae81b4cc11db5e491e030e4b98fba79c19"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										209
									
								
								Godeps/LICENSES
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										209
									
								
								Godeps/LICENSES
									
									
									
										generated
									
									
									
								
							@@ -65586,6 +65586,215 @@ SOFTWARE.
 | 
			
		||||
================================================================================
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
================================================================================
 | 
			
		||||
= vendor/github.com/xanzy/go-cloudstack/cloudstack licensed under: =
 | 
			
		||||
 | 
			
		||||
Apache 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.
 | 
			
		||||
 | 
			
		||||
= vendor/github.com/xanzy/go-cloudstack/LICENSE 136e4f49dbf29942c572a3a8f6e88a77  -
 | 
			
		||||
================================================================================
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
================================================================================
 | 
			
		||||
= vendor/github.com/xiang90/probing licensed under: =
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										201
									
								
								vendor/github.com/xanzy/go-cloudstack/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										201
									
								
								vendor/github.com/xanzy/go-cloudstack/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,201 @@
 | 
			
		||||
Apache 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.
 | 
			
		||||
							
								
								
									
										96
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/APIDiscoveryService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/APIDiscoveryService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,96 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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,omitempty"`
 | 
			
		||||
	Isasync     bool   `json:"isasync,omitempty"`
 | 
			
		||||
	Name        string `json:"name,omitempty"`
 | 
			
		||||
	Params      []struct {
 | 
			
		||||
		Description string `json:"description,omitempty"`
 | 
			
		||||
		Length      int    `json:"length,omitempty"`
 | 
			
		||||
		Name        string `json:"name,omitempty"`
 | 
			
		||||
		Related     string `json:"related,omitempty"`
 | 
			
		||||
		Required    bool   `json:"required,omitempty"`
 | 
			
		||||
		Since       string `json:"since,omitempty"`
 | 
			
		||||
		Type        string `json:"type,omitempty"`
 | 
			
		||||
	} `json:"params,omitempty"`
 | 
			
		||||
	Related  string `json:"related,omitempty"`
 | 
			
		||||
	Response []struct {
 | 
			
		||||
		Description string   `json:"description,omitempty"`
 | 
			
		||||
		Name        string   `json:"name,omitempty"`
 | 
			
		||||
		Response    []string `json:"response,omitempty"`
 | 
			
		||||
		Type        string   `json:"type,omitempty"`
 | 
			
		||||
	} `json:"response,omitempty"`
 | 
			
		||||
	Since string `json:"since,omitempty"`
 | 
			
		||||
	Type  string `json:"type,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1903
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AccountService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1903
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AccountService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										811
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AddressService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										811
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AddressService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,811 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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.
 | 
			
		||||
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 {
 | 
			
		||||
	JobID                 string `json:"jobid,omitempty"`
 | 
			
		||||
	Account               string `json:"account,omitempty"`
 | 
			
		||||
	Allocated             string `json:"allocated,omitempty"`
 | 
			
		||||
	Associatednetworkid   string `json:"associatednetworkid,omitempty"`
 | 
			
		||||
	Associatednetworkname string `json:"associatednetworkname,omitempty"`
 | 
			
		||||
	Domain                string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid              string `json:"domainid,omitempty"`
 | 
			
		||||
	Fordisplay            bool   `json:"fordisplay,omitempty"`
 | 
			
		||||
	Forvirtualnetwork     bool   `json:"forvirtualnetwork,omitempty"`
 | 
			
		||||
	Id                    string `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress             string `json:"ipaddress,omitempty"`
 | 
			
		||||
	Isportable            bool   `json:"isportable,omitempty"`
 | 
			
		||||
	Issourcenat           bool   `json:"issourcenat,omitempty"`
 | 
			
		||||
	Isstaticnat           bool   `json:"isstaticnat,omitempty"`
 | 
			
		||||
	Issystem              bool   `json:"issystem,omitempty"`
 | 
			
		||||
	Networkid             string `json:"networkid,omitempty"`
 | 
			
		||||
	Physicalnetworkid     string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Project               string `json:"project,omitempty"`
 | 
			
		||||
	Projectid             string `json:"projectid,omitempty"`
 | 
			
		||||
	Purpose               string `json:"purpose,omitempty"`
 | 
			
		||||
	State                 string `json:"state,omitempty"`
 | 
			
		||||
	Tags                  []struct {
 | 
			
		||||
		Account      string `json:"account,omitempty"`
 | 
			
		||||
		Customer     string `json:"customer,omitempty"`
 | 
			
		||||
		Domain       string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
		Key          string `json:"key,omitempty"`
 | 
			
		||||
		Project      string `json:"project,omitempty"`
 | 
			
		||||
		Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
		Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
		Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
		Value        string `json:"value,omitempty"`
 | 
			
		||||
	} `json:"tags,omitempty"`
 | 
			
		||||
	Virtualmachinedisplayname string `json:"virtualmachinedisplayname,omitempty"`
 | 
			
		||||
	Virtualmachineid          string `json:"virtualmachineid,omitempty"`
 | 
			
		||||
	Virtualmachinename        string `json:"virtualmachinename,omitempty"`
 | 
			
		||||
	Vlanid                    string `json:"vlanid,omitempty"`
 | 
			
		||||
	Vlanname                  string `json:"vlanname,omitempty"`
 | 
			
		||||
	Vmipaddress               string `json:"vmipaddress,omitempty"`
 | 
			
		||||
	Vpcid                     string `json:"vpcid,omitempty"`
 | 
			
		||||
	Zoneid                    string `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename                  string `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("tags[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("tags[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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 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,omitempty"`
 | 
			
		||||
	Allocated             string `json:"allocated,omitempty"`
 | 
			
		||||
	Associatednetworkid   string `json:"associatednetworkid,omitempty"`
 | 
			
		||||
	Associatednetworkname string `json:"associatednetworkname,omitempty"`
 | 
			
		||||
	Domain                string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid              string `json:"domainid,omitempty"`
 | 
			
		||||
	Fordisplay            bool   `json:"fordisplay,omitempty"`
 | 
			
		||||
	Forvirtualnetwork     bool   `json:"forvirtualnetwork,omitempty"`
 | 
			
		||||
	Id                    string `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress             string `json:"ipaddress,omitempty"`
 | 
			
		||||
	Isportable            bool   `json:"isportable,omitempty"`
 | 
			
		||||
	Issourcenat           bool   `json:"issourcenat,omitempty"`
 | 
			
		||||
	Isstaticnat           bool   `json:"isstaticnat,omitempty"`
 | 
			
		||||
	Issystem              bool   `json:"issystem,omitempty"`
 | 
			
		||||
	Networkid             string `json:"networkid,omitempty"`
 | 
			
		||||
	Physicalnetworkid     string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Project               string `json:"project,omitempty"`
 | 
			
		||||
	Projectid             string `json:"projectid,omitempty"`
 | 
			
		||||
	Purpose               string `json:"purpose,omitempty"`
 | 
			
		||||
	State                 string `json:"state,omitempty"`
 | 
			
		||||
	Tags                  []struct {
 | 
			
		||||
		Account      string `json:"account,omitempty"`
 | 
			
		||||
		Customer     string `json:"customer,omitempty"`
 | 
			
		||||
		Domain       string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
		Key          string `json:"key,omitempty"`
 | 
			
		||||
		Project      string `json:"project,omitempty"`
 | 
			
		||||
		Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
		Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
		Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
		Value        string `json:"value,omitempty"`
 | 
			
		||||
	} `json:"tags,omitempty"`
 | 
			
		||||
	Virtualmachinedisplayname string `json:"virtualmachinedisplayname,omitempty"`
 | 
			
		||||
	Virtualmachineid          string `json:"virtualmachineid,omitempty"`
 | 
			
		||||
	Virtualmachinename        string `json:"virtualmachinename,omitempty"`
 | 
			
		||||
	Vlanid                    string `json:"vlanid,omitempty"`
 | 
			
		||||
	Vlanname                  string `json:"vlanname,omitempty"`
 | 
			
		||||
	Vmipaddress               string `json:"vmipaddress,omitempty"`
 | 
			
		||||
	Vpcid                     string `json:"vpcid,omitempty"`
 | 
			
		||||
	Zoneid                    string `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename                  string `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID                 string `json:"jobid,omitempty"`
 | 
			
		||||
	Account               string `json:"account,omitempty"`
 | 
			
		||||
	Allocated             string `json:"allocated,omitempty"`
 | 
			
		||||
	Associatednetworkid   string `json:"associatednetworkid,omitempty"`
 | 
			
		||||
	Associatednetworkname string `json:"associatednetworkname,omitempty"`
 | 
			
		||||
	Domain                string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid              string `json:"domainid,omitempty"`
 | 
			
		||||
	Fordisplay            bool   `json:"fordisplay,omitempty"`
 | 
			
		||||
	Forvirtualnetwork     bool   `json:"forvirtualnetwork,omitempty"`
 | 
			
		||||
	Id                    string `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress             string `json:"ipaddress,omitempty"`
 | 
			
		||||
	Isportable            bool   `json:"isportable,omitempty"`
 | 
			
		||||
	Issourcenat           bool   `json:"issourcenat,omitempty"`
 | 
			
		||||
	Isstaticnat           bool   `json:"isstaticnat,omitempty"`
 | 
			
		||||
	Issystem              bool   `json:"issystem,omitempty"`
 | 
			
		||||
	Networkid             string `json:"networkid,omitempty"`
 | 
			
		||||
	Physicalnetworkid     string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Project               string `json:"project,omitempty"`
 | 
			
		||||
	Projectid             string `json:"projectid,omitempty"`
 | 
			
		||||
	Purpose               string `json:"purpose,omitempty"`
 | 
			
		||||
	State                 string `json:"state,omitempty"`
 | 
			
		||||
	Tags                  []struct {
 | 
			
		||||
		Account      string `json:"account,omitempty"`
 | 
			
		||||
		Customer     string `json:"customer,omitempty"`
 | 
			
		||||
		Domain       string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
		Key          string `json:"key,omitempty"`
 | 
			
		||||
		Project      string `json:"project,omitempty"`
 | 
			
		||||
		Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
		Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
		Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
		Value        string `json:"value,omitempty"`
 | 
			
		||||
	} `json:"tags,omitempty"`
 | 
			
		||||
	Virtualmachinedisplayname string `json:"virtualmachinedisplayname,omitempty"`
 | 
			
		||||
	Virtualmachineid          string `json:"virtualmachineid,omitempty"`
 | 
			
		||||
	Virtualmachinename        string `json:"virtualmachinename,omitempty"`
 | 
			
		||||
	Vlanid                    string `json:"vlanid,omitempty"`
 | 
			
		||||
	Vlanname                  string `json:"vlanname,omitempty"`
 | 
			
		||||
	Vmipaddress               string `json:"vmipaddress,omitempty"`
 | 
			
		||||
	Vpcid                     string `json:"vpcid,omitempty"`
 | 
			
		||||
	Zoneid                    string `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename                  string `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										887
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AffinityGroupService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										887
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AffinityGroupService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,887 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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["affinityGroupType"] = 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["affinityGroupType"] = 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 {
 | 
			
		||||
	JobID             string   `json:"jobid,omitempty"`
 | 
			
		||||
	Account           string   `json:"account,omitempty"`
 | 
			
		||||
	Description       string   `json:"description,omitempty"`
 | 
			
		||||
	Domain            string   `json:"domain,omitempty"`
 | 
			
		||||
	Domainid          string   `json:"domainid,omitempty"`
 | 
			
		||||
	Id                string   `json:"id,omitempty"`
 | 
			
		||||
	Name              string   `json:"name,omitempty"`
 | 
			
		||||
	Project           string   `json:"project,omitempty"`
 | 
			
		||||
	Projectid         string   `json:"projectid,omitempty"`
 | 
			
		||||
	Type              string   `json:"type,omitempty"`
 | 
			
		||||
	VirtualmachineIds []string `json:"virtualmachineIds,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["affinityGroupType"] = 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 opts {
 | 
			
		||||
		if err := fn(s.cs, p); err != nil {
 | 
			
		||||
			return "", -1, err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	l, err := s.ListAffinityGroups(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.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 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
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	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,omitempty"`
 | 
			
		||||
	Description       string   `json:"description,omitempty"`
 | 
			
		||||
	Domain            string   `json:"domain,omitempty"`
 | 
			
		||||
	Domainid          string   `json:"domainid,omitempty"`
 | 
			
		||||
	Id                string   `json:"id,omitempty"`
 | 
			
		||||
	Name              string   `json:"name,omitempty"`
 | 
			
		||||
	Project           string   `json:"project,omitempty"`
 | 
			
		||||
	Projectid         string   `json:"projectid,omitempty"`
 | 
			
		||||
	Type              string   `json:"type,omitempty"`
 | 
			
		||||
	VirtualmachineIds []string `json:"virtualmachineIds,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID         string `json:"jobid,omitempty"`
 | 
			
		||||
	Account       string `json:"account,omitempty"`
 | 
			
		||||
	Affinitygroup []struct {
 | 
			
		||||
		Account           string   `json:"account,omitempty"`
 | 
			
		||||
		Description       string   `json:"description,omitempty"`
 | 
			
		||||
		Domain            string   `json:"domain,omitempty"`
 | 
			
		||||
		Domainid          string   `json:"domainid,omitempty"`
 | 
			
		||||
		Id                string   `json:"id,omitempty"`
 | 
			
		||||
		Name              string   `json:"name,omitempty"`
 | 
			
		||||
		Project           string   `json:"project,omitempty"`
 | 
			
		||||
		Projectid         string   `json:"projectid,omitempty"`
 | 
			
		||||
		Type              string   `json:"type,omitempty"`
 | 
			
		||||
		VirtualmachineIds []string `json:"virtualmachineIds,omitempty"`
 | 
			
		||||
	} `json:"affinitygroup,omitempty"`
 | 
			
		||||
	Cpunumber             int               `json:"cpunumber,omitempty"`
 | 
			
		||||
	Cpuspeed              int               `json:"cpuspeed,omitempty"`
 | 
			
		||||
	Cpuused               string            `json:"cpuused,omitempty"`
 | 
			
		||||
	Created               string            `json:"created,omitempty"`
 | 
			
		||||
	Details               map[string]string `json:"details,omitempty"`
 | 
			
		||||
	Diskioread            int64             `json:"diskioread,omitempty"`
 | 
			
		||||
	Diskiowrite           int64             `json:"diskiowrite,omitempty"`
 | 
			
		||||
	Diskkbsread           int64             `json:"diskkbsread,omitempty"`
 | 
			
		||||
	Diskkbswrite          int64             `json:"diskkbswrite,omitempty"`
 | 
			
		||||
	Diskofferingid        string            `json:"diskofferingid,omitempty"`
 | 
			
		||||
	Diskofferingname      string            `json:"diskofferingname,omitempty"`
 | 
			
		||||
	Displayname           string            `json:"displayname,omitempty"`
 | 
			
		||||
	Displayvm             bool              `json:"displayvm,omitempty"`
 | 
			
		||||
	Domain                string            `json:"domain,omitempty"`
 | 
			
		||||
	Domainid              string            `json:"domainid,omitempty"`
 | 
			
		||||
	Forvirtualnetwork     bool              `json:"forvirtualnetwork,omitempty"`
 | 
			
		||||
	Group                 string            `json:"group,omitempty"`
 | 
			
		||||
	Groupid               string            `json:"groupid,omitempty"`
 | 
			
		||||
	Guestosid             string            `json:"guestosid,omitempty"`
 | 
			
		||||
	Haenable              bool              `json:"haenable,omitempty"`
 | 
			
		||||
	Hostid                string            `json:"hostid,omitempty"`
 | 
			
		||||
	Hostname              string            `json:"hostname,omitempty"`
 | 
			
		||||
	Hypervisor            string            `json:"hypervisor,omitempty"`
 | 
			
		||||
	Id                    string            `json:"id,omitempty"`
 | 
			
		||||
	Instancename          string            `json:"instancename,omitempty"`
 | 
			
		||||
	Isdynamicallyscalable bool              `json:"isdynamicallyscalable,omitempty"`
 | 
			
		||||
	Isodisplaytext        string            `json:"isodisplaytext,omitempty"`
 | 
			
		||||
	Isoid                 string            `json:"isoid,omitempty"`
 | 
			
		||||
	Isoname               string            `json:"isoname,omitempty"`
 | 
			
		||||
	Keypair               string            `json:"keypair,omitempty"`
 | 
			
		||||
	Memory                int               `json:"memory,omitempty"`
 | 
			
		||||
	Name                  string            `json:"name,omitempty"`
 | 
			
		||||
	Networkkbsread        int64             `json:"networkkbsread,omitempty"`
 | 
			
		||||
	Networkkbswrite       int64             `json:"networkkbswrite,omitempty"`
 | 
			
		||||
	Nic                   []struct {
 | 
			
		||||
		Broadcasturi string `json:"broadcasturi,omitempty"`
 | 
			
		||||
		Deviceid     string `json:"deviceid,omitempty"`
 | 
			
		||||
		Gateway      string `json:"gateway,omitempty"`
 | 
			
		||||
		Id           string `json:"id,omitempty"`
 | 
			
		||||
		Ip6address   string `json:"ip6address,omitempty"`
 | 
			
		||||
		Ip6cidr      string `json:"ip6cidr,omitempty"`
 | 
			
		||||
		Ip6gateway   string `json:"ip6gateway,omitempty"`
 | 
			
		||||
		Ipaddress    string `json:"ipaddress,omitempty"`
 | 
			
		||||
		Isdefault    bool   `json:"isdefault,omitempty"`
 | 
			
		||||
		Isolationuri string `json:"isolationuri,omitempty"`
 | 
			
		||||
		Macaddress   string `json:"macaddress,omitempty"`
 | 
			
		||||
		Netmask      string `json:"netmask,omitempty"`
 | 
			
		||||
		Networkid    string `json:"networkid,omitempty"`
 | 
			
		||||
		Networkname  string `json:"networkname,omitempty"`
 | 
			
		||||
		Secondaryip  []struct {
 | 
			
		||||
			Id        string `json:"id,omitempty"`
 | 
			
		||||
			Ipaddress string `json:"ipaddress,omitempty"`
 | 
			
		||||
		} `json:"secondaryip,omitempty"`
 | 
			
		||||
		Traffictype      string `json:"traffictype,omitempty"`
 | 
			
		||||
		Type             string `json:"type,omitempty"`
 | 
			
		||||
		Virtualmachineid string `json:"virtualmachineid,omitempty"`
 | 
			
		||||
	} `json:"nic,omitempty"`
 | 
			
		||||
	Ostypeid        int64  `json:"ostypeid,omitempty"`
 | 
			
		||||
	Password        string `json:"password,omitempty"`
 | 
			
		||||
	Passwordenabled bool   `json:"passwordenabled,omitempty"`
 | 
			
		||||
	Project         string `json:"project,omitempty"`
 | 
			
		||||
	Projectid       string `json:"projectid,omitempty"`
 | 
			
		||||
	Publicip        string `json:"publicip,omitempty"`
 | 
			
		||||
	Publicipid      string `json:"publicipid,omitempty"`
 | 
			
		||||
	Rootdeviceid    int64  `json:"rootdeviceid,omitempty"`
 | 
			
		||||
	Rootdevicetype  string `json:"rootdevicetype,omitempty"`
 | 
			
		||||
	Securitygroup   []struct {
 | 
			
		||||
		Account     string `json:"account,omitempty"`
 | 
			
		||||
		Description string `json:"description,omitempty"`
 | 
			
		||||
		Domain      string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid    string `json:"domainid,omitempty"`
 | 
			
		||||
		Egressrule  []struct {
 | 
			
		||||
			Account           string `json:"account,omitempty"`
 | 
			
		||||
			Cidr              string `json:"cidr,omitempty"`
 | 
			
		||||
			Endport           int    `json:"endport,omitempty"`
 | 
			
		||||
			Icmpcode          int    `json:"icmpcode,omitempty"`
 | 
			
		||||
			Icmptype          int    `json:"icmptype,omitempty"`
 | 
			
		||||
			Protocol          string `json:"protocol,omitempty"`
 | 
			
		||||
			Ruleid            string `json:"ruleid,omitempty"`
 | 
			
		||||
			Securitygroupname string `json:"securitygroupname,omitempty"`
 | 
			
		||||
			Startport         int    `json:"startport,omitempty"`
 | 
			
		||||
			Tags              []struct {
 | 
			
		||||
				Account      string `json:"account,omitempty"`
 | 
			
		||||
				Customer     string `json:"customer,omitempty"`
 | 
			
		||||
				Domain       string `json:"domain,omitempty"`
 | 
			
		||||
				Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
				Key          string `json:"key,omitempty"`
 | 
			
		||||
				Project      string `json:"project,omitempty"`
 | 
			
		||||
				Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
				Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
				Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
				Value        string `json:"value,omitempty"`
 | 
			
		||||
			} `json:"tags,omitempty"`
 | 
			
		||||
		} `json:"egressrule,omitempty"`
 | 
			
		||||
		Id          string `json:"id,omitempty"`
 | 
			
		||||
		Ingressrule []struct {
 | 
			
		||||
			Account           string `json:"account,omitempty"`
 | 
			
		||||
			Cidr              string `json:"cidr,omitempty"`
 | 
			
		||||
			Endport           int    `json:"endport,omitempty"`
 | 
			
		||||
			Icmpcode          int    `json:"icmpcode,omitempty"`
 | 
			
		||||
			Icmptype          int    `json:"icmptype,omitempty"`
 | 
			
		||||
			Protocol          string `json:"protocol,omitempty"`
 | 
			
		||||
			Ruleid            string `json:"ruleid,omitempty"`
 | 
			
		||||
			Securitygroupname string `json:"securitygroupname,omitempty"`
 | 
			
		||||
			Startport         int    `json:"startport,omitempty"`
 | 
			
		||||
			Tags              []struct {
 | 
			
		||||
				Account      string `json:"account,omitempty"`
 | 
			
		||||
				Customer     string `json:"customer,omitempty"`
 | 
			
		||||
				Domain       string `json:"domain,omitempty"`
 | 
			
		||||
				Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
				Key          string `json:"key,omitempty"`
 | 
			
		||||
				Project      string `json:"project,omitempty"`
 | 
			
		||||
				Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
				Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
				Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
				Value        string `json:"value,omitempty"`
 | 
			
		||||
			} `json:"tags,omitempty"`
 | 
			
		||||
		} `json:"ingressrule,omitempty"`
 | 
			
		||||
		Name      string `json:"name,omitempty"`
 | 
			
		||||
		Project   string `json:"project,omitempty"`
 | 
			
		||||
		Projectid string `json:"projectid,omitempty"`
 | 
			
		||||
		Tags      []struct {
 | 
			
		||||
			Account      string `json:"account,omitempty"`
 | 
			
		||||
			Customer     string `json:"customer,omitempty"`
 | 
			
		||||
			Domain       string `json:"domain,omitempty"`
 | 
			
		||||
			Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
			Key          string `json:"key,omitempty"`
 | 
			
		||||
			Project      string `json:"project,omitempty"`
 | 
			
		||||
			Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
			Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
			Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
			Value        string `json:"value,omitempty"`
 | 
			
		||||
		} `json:"tags,omitempty"`
 | 
			
		||||
		Virtualmachinecount int      `json:"virtualmachinecount,omitempty"`
 | 
			
		||||
		Virtualmachineids   []string `json:"virtualmachineids,omitempty"`
 | 
			
		||||
	} `json:"securitygroup,omitempty"`
 | 
			
		||||
	Serviceofferingid   string `json:"serviceofferingid,omitempty"`
 | 
			
		||||
	Serviceofferingname string `json:"serviceofferingname,omitempty"`
 | 
			
		||||
	Servicestate        string `json:"servicestate,omitempty"`
 | 
			
		||||
	State               string `json:"state,omitempty"`
 | 
			
		||||
	Tags                []struct {
 | 
			
		||||
		Account      string `json:"account,omitempty"`
 | 
			
		||||
		Customer     string `json:"customer,omitempty"`
 | 
			
		||||
		Domain       string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
		Key          string `json:"key,omitempty"`
 | 
			
		||||
		Project      string `json:"project,omitempty"`
 | 
			
		||||
		Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
		Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
		Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
		Value        string `json:"value,omitempty"`
 | 
			
		||||
	} `json:"tags,omitempty"`
 | 
			
		||||
	Templatedisplaytext string `json:"templatedisplaytext,omitempty"`
 | 
			
		||||
	Templateid          string `json:"templateid,omitempty"`
 | 
			
		||||
	Templatename        string `json:"templatename,omitempty"`
 | 
			
		||||
	Userid              string `json:"userid,omitempty"`
 | 
			
		||||
	Username            string `json:"username,omitempty"`
 | 
			
		||||
	Vgpu                string `json:"vgpu,omitempty"`
 | 
			
		||||
	Zoneid              string `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename            string `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	Type string `json:"type,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										505
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AlertService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										505
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AlertService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,505 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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["alertType"] = 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 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 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,omitempty"`
 | 
			
		||||
	Id          string `json:"id,omitempty"`
 | 
			
		||||
	Name        string `json:"name,omitempty"`
 | 
			
		||||
	Sent        string `json:"sent,omitempty"`
 | 
			
		||||
	Type        int    `json:"type,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["alertType"] = 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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["alertType"] = 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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["alertType"] = 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["alertType"] = 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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										239
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AsyncjobService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										239
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AsyncjobService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,239 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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,omitempty"`
 | 
			
		||||
	Cmd             string          `json:"cmd,omitempty"`
 | 
			
		||||
	Created         string          `json:"created,omitempty"`
 | 
			
		||||
	Jobinstanceid   string          `json:"jobinstanceid,omitempty"`
 | 
			
		||||
	Jobinstancetype string          `json:"jobinstancetype,omitempty"`
 | 
			
		||||
	Jobprocstatus   int             `json:"jobprocstatus,omitempty"`
 | 
			
		||||
	Jobresult       json.RawMessage `json:"jobresult,omitempty"`
 | 
			
		||||
	Jobresultcode   int             `json:"jobresultcode,omitempty"`
 | 
			
		||||
	Jobresulttype   string          `json:"jobresulttype,omitempty"`
 | 
			
		||||
	Jobstatus       int             `json:"jobstatus,omitempty"`
 | 
			
		||||
	Userid          string          `json:"userid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Cmd             string          `json:"cmd,omitempty"`
 | 
			
		||||
	Created         string          `json:"created,omitempty"`
 | 
			
		||||
	Jobinstanceid   string          `json:"jobinstanceid,omitempty"`
 | 
			
		||||
	Jobinstancetype string          `json:"jobinstancetype,omitempty"`
 | 
			
		||||
	Jobprocstatus   int             `json:"jobprocstatus,omitempty"`
 | 
			
		||||
	Jobresult       json.RawMessage `json:"jobresult,omitempty"`
 | 
			
		||||
	Jobresultcode   int             `json:"jobresultcode,omitempty"`
 | 
			
		||||
	Jobresulttype   string          `json:"jobresulttype,omitempty"`
 | 
			
		||||
	Jobstatus       int             `json:"jobstatus,omitempty"`
 | 
			
		||||
	Userid          string          `json:"userid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										156
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AuthenticationService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										156
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AuthenticationService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,156 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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,omitempty"`
 | 
			
		||||
	Domainid   string `json:"domainid,omitempty"`
 | 
			
		||||
	Firstname  string `json:"firstname,omitempty"`
 | 
			
		||||
	Lastname   string `json:"lastname,omitempty"`
 | 
			
		||||
	Registered string `json:"registered,omitempty"`
 | 
			
		||||
	Sessionkey string `json:"sessionkey,omitempty"`
 | 
			
		||||
	Timeout    int    `json:"timeout,omitempty"`
 | 
			
		||||
	Timezone   string `json:"timezone,omitempty"`
 | 
			
		||||
	Type       string `json:"type,omitempty"`
 | 
			
		||||
	Userid     string `json:"userid,omitempty"`
 | 
			
		||||
	Username   string `json:"username,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2759
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AutoScaleService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2759
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/AutoScaleService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										918
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/BaremetalService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										918
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/BaremetalService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,918 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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 {
 | 
			
		||||
	JobID   string `json:"jobid,omitempty"`
 | 
			
		||||
	Tftpdir string `json:"tftpdir,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID               string `json:"jobid,omitempty"`
 | 
			
		||||
	Pingdir             string `json:"pingdir,omitempty"`
 | 
			
		||||
	Pingstorageserverip string `json:"pingstorageserverip,omitempty"`
 | 
			
		||||
	Tftpdir             string `json:"tftpdir,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID             string `json:"jobid,omitempty"`
 | 
			
		||||
	Dhcpservertype    string `json:"dhcpservertype,omitempty"`
 | 
			
		||||
	Id                string `json:"id,omitempty"`
 | 
			
		||||
	Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Provider          string `json:"provider,omitempty"`
 | 
			
		||||
	Url               string `json:"url,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Id                string `json:"id,omitempty"`
 | 
			
		||||
	Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Provider          string `json:"provider,omitempty"`
 | 
			
		||||
	Url               string `json:"url,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Provider          string `json:"provider,omitempty"`
 | 
			
		||||
	Url               string `json:"url,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID string `json:"jobid,omitempty"`
 | 
			
		||||
	Id    string `json:"id,omitempty"`
 | 
			
		||||
	Url   string `json:"url,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Url string `json:"url,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										140
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/CertificateService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										140
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/CertificateService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,140 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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,omitempty"`
 | 
			
		||||
	Message string `json:"message,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										74
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/CloudIdentifierService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/CloudIdentifierService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,74 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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,omitempty"`
 | 
			
		||||
	Signature       string `json:"signature,omitempty"`
 | 
			
		||||
	Userid          string `json:"userid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1059
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ClusterService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1059
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ClusterService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										633
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ConfigurationService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										633
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ConfigurationService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,633 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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["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) 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,omitempty"`
 | 
			
		||||
	Description string `json:"description,omitempty"`
 | 
			
		||||
	Id          int64  `json:"id,omitempty"`
 | 
			
		||||
	Name        string `json:"name,omitempty"`
 | 
			
		||||
	Scope       string `json:"scope,omitempty"`
 | 
			
		||||
	Value       string `json:"value,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["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) 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,omitempty"`
 | 
			
		||||
	Description string `json:"description,omitempty"`
 | 
			
		||||
	Id          int64  `json:"id,omitempty"`
 | 
			
		||||
	Name        string `json:"name,omitempty"`
 | 
			
		||||
	Scope       string `json:"scope,omitempty"`
 | 
			
		||||
	Value       string `json:"value,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Allowuserexpungerecovervm bool   `json:"allowuserexpungerecovervm,omitempty"`
 | 
			
		||||
	Allowuserviewdestroyedvm  bool   `json:"allowuserviewdestroyedvm,omitempty"`
 | 
			
		||||
	Apilimitinterval          int    `json:"apilimitinterval,omitempty"`
 | 
			
		||||
	Apilimitmax               int    `json:"apilimitmax,omitempty"`
 | 
			
		||||
	Cloudstackversion         string `json:"cloudstackversion,omitempty"`
 | 
			
		||||
	Customdiskofferingmaxsize int64  `json:"customdiskofferingmaxsize,omitempty"`
 | 
			
		||||
	Customdiskofferingminsize int64  `json:"customdiskofferingminsize,omitempty"`
 | 
			
		||||
	Kvmsnapshotenabled        bool   `json:"kvmsnapshotenabled,omitempty"`
 | 
			
		||||
	Projectinviterequired     bool   `json:"projectinviterequired,omitempty"`
 | 
			
		||||
	Regionsecondaryenabled    bool   `json:"regionsecondaryenabled,omitempty"`
 | 
			
		||||
	Securitygroupsenabled     bool   `json:"securitygroupsenabled,omitempty"`
 | 
			
		||||
	SupportELB                string `json:"supportELB,omitempty"`
 | 
			
		||||
	Userpublictemplateenabled bool   `json:"userpublictemplateenabled,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	Name string `json:"name,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["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) 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 *ConfigurationService) NewListLdapConfigurationsParams() *ListLdapConfigurationsParams {
 | 
			
		||||
	p := &ListLdapConfigurationsParams{}
 | 
			
		||||
	p.p = make(map[string]interface{})
 | 
			
		||||
	return p
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Lists all LDAP configurations
 | 
			
		||||
func (s *ConfigurationService) 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 {
 | 
			
		||||
	Hostname string `json:"hostname,omitempty"`
 | 
			
		||||
	Port     int    `json:"port,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["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) 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 *ConfigurationService) 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 *ConfigurationService) 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 {
 | 
			
		||||
	Hostname string `json:"hostname,omitempty"`
 | 
			
		||||
	Port     int    `json:"port,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["hostname"]; found {
 | 
			
		||||
		u.Set("hostname", v.(string))
 | 
			
		||||
	}
 | 
			
		||||
	return u
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (p *DeleteLdapConfigurationParams) SetHostname(v string) {
 | 
			
		||||
	if p.p == nil {
 | 
			
		||||
		p.p = make(map[string]interface{})
 | 
			
		||||
	}
 | 
			
		||||
	p.p["hostname"] = 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 *ConfigurationService) NewDeleteLdapConfigurationParams(hostname string) *DeleteLdapConfigurationParams {
 | 
			
		||||
	p := &DeleteLdapConfigurationParams{}
 | 
			
		||||
	p.p = make(map[string]interface{})
 | 
			
		||||
	p.p["hostname"] = hostname
 | 
			
		||||
	return p
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Remove an Ldap Configuration
 | 
			
		||||
func (s *ConfigurationService) 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 {
 | 
			
		||||
	Hostname string `json:"hostname,omitempty"`
 | 
			
		||||
	Port     int    `json:"port,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										688
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/DiskOfferingService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										688
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/DiskOfferingService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,688 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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["byteswriterate"]; found {
 | 
			
		||||
		vv := strconv.FormatInt(v.(int64), 10)
 | 
			
		||||
		u.Set("byteswriterate", 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["iopswriterate"]; found {
 | 
			
		||||
		vv := strconv.FormatInt(v.(int64), 10)
 | 
			
		||||
		u.Set("iopswriterate", 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) SetByteswriterate(v int64) {
 | 
			
		||||
	if p.p == nil {
 | 
			
		||||
		p.p = make(map[string]interface{})
 | 
			
		||||
	}
 | 
			
		||||
	p.p["byteswriterate"] = 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) SetIopswriterate(v int64) {
 | 
			
		||||
	if p.p == nil {
 | 
			
		||||
		p.p = make(map[string]interface{})
 | 
			
		||||
	}
 | 
			
		||||
	p.p["iopswriterate"] = 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,omitempty"`
 | 
			
		||||
	Created                   string `json:"created,omitempty"`
 | 
			
		||||
	DiskBytesReadRate         int64  `json:"diskBytesReadRate,omitempty"`
 | 
			
		||||
	DiskBytesWriteRate        int64  `json:"diskBytesWriteRate,omitempty"`
 | 
			
		||||
	DiskIopsReadRate          int64  `json:"diskIopsReadRate,omitempty"`
 | 
			
		||||
	DiskIopsWriteRate         int64  `json:"diskIopsWriteRate,omitempty"`
 | 
			
		||||
	Disksize                  int64  `json:"disksize,omitempty"`
 | 
			
		||||
	Displayoffering           bool   `json:"displayoffering,omitempty"`
 | 
			
		||||
	Displaytext               string `json:"displaytext,omitempty"`
 | 
			
		||||
	Domain                    string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid                  string `json:"domainid,omitempty"`
 | 
			
		||||
	Hypervisorsnapshotreserve int    `json:"hypervisorsnapshotreserve,omitempty"`
 | 
			
		||||
	Id                        string `json:"id,omitempty"`
 | 
			
		||||
	Iscustomized              bool   `json:"iscustomized,omitempty"`
 | 
			
		||||
	Iscustomizediops          bool   `json:"iscustomizediops,omitempty"`
 | 
			
		||||
	Maxiops                   int64  `json:"maxiops,omitempty"`
 | 
			
		||||
	Miniops                   int64  `json:"miniops,omitempty"`
 | 
			
		||||
	Name                      string `json:"name,omitempty"`
 | 
			
		||||
	Provisioningtype          string `json:"provisioningtype,omitempty"`
 | 
			
		||||
	Storagetype               string `json:"storagetype,omitempty"`
 | 
			
		||||
	Tags                      string `json:"tags,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Created                   string `json:"created,omitempty"`
 | 
			
		||||
	DiskBytesReadRate         int64  `json:"diskBytesReadRate,omitempty"`
 | 
			
		||||
	DiskBytesWriteRate        int64  `json:"diskBytesWriteRate,omitempty"`
 | 
			
		||||
	DiskIopsReadRate          int64  `json:"diskIopsReadRate,omitempty"`
 | 
			
		||||
	DiskIopsWriteRate         int64  `json:"diskIopsWriteRate,omitempty"`
 | 
			
		||||
	Disksize                  int64  `json:"disksize,omitempty"`
 | 
			
		||||
	Displayoffering           bool   `json:"displayoffering,omitempty"`
 | 
			
		||||
	Displaytext               string `json:"displaytext,omitempty"`
 | 
			
		||||
	Domain                    string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid                  string `json:"domainid,omitempty"`
 | 
			
		||||
	Hypervisorsnapshotreserve int    `json:"hypervisorsnapshotreserve,omitempty"`
 | 
			
		||||
	Id                        string `json:"id,omitempty"`
 | 
			
		||||
	Iscustomized              bool   `json:"iscustomized,omitempty"`
 | 
			
		||||
	Iscustomizediops          bool   `json:"iscustomizediops,omitempty"`
 | 
			
		||||
	Maxiops                   int64  `json:"maxiops,omitempty"`
 | 
			
		||||
	Miniops                   int64  `json:"miniops,omitempty"`
 | 
			
		||||
	Name                      string `json:"name,omitempty"`
 | 
			
		||||
	Provisioningtype          string `json:"provisioningtype,omitempty"`
 | 
			
		||||
	Storagetype               string `json:"storagetype,omitempty"`
 | 
			
		||||
	Tags                      string `json:"tags,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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 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,omitempty"`
 | 
			
		||||
	Created                   string `json:"created,omitempty"`
 | 
			
		||||
	DiskBytesReadRate         int64  `json:"diskBytesReadRate,omitempty"`
 | 
			
		||||
	DiskBytesWriteRate        int64  `json:"diskBytesWriteRate,omitempty"`
 | 
			
		||||
	DiskIopsReadRate          int64  `json:"diskIopsReadRate,omitempty"`
 | 
			
		||||
	DiskIopsWriteRate         int64  `json:"diskIopsWriteRate,omitempty"`
 | 
			
		||||
	Disksize                  int64  `json:"disksize,omitempty"`
 | 
			
		||||
	Displayoffering           bool   `json:"displayoffering,omitempty"`
 | 
			
		||||
	Displaytext               string `json:"displaytext,omitempty"`
 | 
			
		||||
	Domain                    string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid                  string `json:"domainid,omitempty"`
 | 
			
		||||
	Hypervisorsnapshotreserve int    `json:"hypervisorsnapshotreserve,omitempty"`
 | 
			
		||||
	Id                        string `json:"id,omitempty"`
 | 
			
		||||
	Iscustomized              bool   `json:"iscustomized,omitempty"`
 | 
			
		||||
	Iscustomizediops          bool   `json:"iscustomizediops,omitempty"`
 | 
			
		||||
	Maxiops                   int64  `json:"maxiops,omitempty"`
 | 
			
		||||
	Miniops                   int64  `json:"miniops,omitempty"`
 | 
			
		||||
	Name                      string `json:"name,omitempty"`
 | 
			
		||||
	Provisioningtype          string `json:"provisioningtype,omitempty"`
 | 
			
		||||
	Storagetype               string `json:"storagetype,omitempty"`
 | 
			
		||||
	Tags                      string `json:"tags,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										951
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/DomainService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										951
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/DomainService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,951 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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,omitempty"`
 | 
			
		||||
	Cpulimit                  string `json:"cpulimit,omitempty"`
 | 
			
		||||
	Cputotal                  int64  `json:"cputotal,omitempty"`
 | 
			
		||||
	Haschild                  bool   `json:"haschild,omitempty"`
 | 
			
		||||
	Id                        string `json:"id,omitempty"`
 | 
			
		||||
	Ipavailable               string `json:"ipavailable,omitempty"`
 | 
			
		||||
	Iplimit                   string `json:"iplimit,omitempty"`
 | 
			
		||||
	Iptotal                   int64  `json:"iptotal,omitempty"`
 | 
			
		||||
	Level                     int    `json:"level,omitempty"`
 | 
			
		||||
	Memoryavailable           string `json:"memoryavailable,omitempty"`
 | 
			
		||||
	Memorylimit               string `json:"memorylimit,omitempty"`
 | 
			
		||||
	Memorytotal               int64  `json:"memorytotal,omitempty"`
 | 
			
		||||
	Name                      string `json:"name,omitempty"`
 | 
			
		||||
	Networkavailable          string `json:"networkavailable,omitempty"`
 | 
			
		||||
	Networkdomain             string `json:"networkdomain,omitempty"`
 | 
			
		||||
	Networklimit              string `json:"networklimit,omitempty"`
 | 
			
		||||
	Networktotal              int64  `json:"networktotal,omitempty"`
 | 
			
		||||
	Parentdomainid            string `json:"parentdomainid,omitempty"`
 | 
			
		||||
	Parentdomainname          string `json:"parentdomainname,omitempty"`
 | 
			
		||||
	Path                      string `json:"path,omitempty"`
 | 
			
		||||
	Primarystorageavailable   string `json:"primarystorageavailable,omitempty"`
 | 
			
		||||
	Primarystoragelimit       string `json:"primarystoragelimit,omitempty"`
 | 
			
		||||
	Primarystoragetotal       int64  `json:"primarystoragetotal,omitempty"`
 | 
			
		||||
	Projectavailable          string `json:"projectavailable,omitempty"`
 | 
			
		||||
	Projectlimit              string `json:"projectlimit,omitempty"`
 | 
			
		||||
	Projecttotal              int64  `json:"projecttotal,omitempty"`
 | 
			
		||||
	Secondarystorageavailable string `json:"secondarystorageavailable,omitempty"`
 | 
			
		||||
	Secondarystoragelimit     string `json:"secondarystoragelimit,omitempty"`
 | 
			
		||||
	Secondarystoragetotal     int64  `json:"secondarystoragetotal,omitempty"`
 | 
			
		||||
	Snapshotavailable         string `json:"snapshotavailable,omitempty"`
 | 
			
		||||
	Snapshotlimit             string `json:"snapshotlimit,omitempty"`
 | 
			
		||||
	Snapshottotal             int64  `json:"snapshottotal,omitempty"`
 | 
			
		||||
	State                     string `json:"state,omitempty"`
 | 
			
		||||
	Templateavailable         string `json:"templateavailable,omitempty"`
 | 
			
		||||
	Templatelimit             string `json:"templatelimit,omitempty"`
 | 
			
		||||
	Templatetotal             int64  `json:"templatetotal,omitempty"`
 | 
			
		||||
	Vmavailable               string `json:"vmavailable,omitempty"`
 | 
			
		||||
	Vmlimit                   string `json:"vmlimit,omitempty"`
 | 
			
		||||
	Vmtotal                   int64  `json:"vmtotal,omitempty"`
 | 
			
		||||
	Volumeavailable           string `json:"volumeavailable,omitempty"`
 | 
			
		||||
	Volumelimit               string `json:"volumelimit,omitempty"`
 | 
			
		||||
	Volumetotal               int64  `json:"volumetotal,omitempty"`
 | 
			
		||||
	Vpcavailable              string `json:"vpcavailable,omitempty"`
 | 
			
		||||
	Vpclimit                  string `json:"vpclimit,omitempty"`
 | 
			
		||||
	Vpctotal                  int64  `json:"vpctotal,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Cpulimit                  string `json:"cpulimit,omitempty"`
 | 
			
		||||
	Cputotal                  int64  `json:"cputotal,omitempty"`
 | 
			
		||||
	Haschild                  bool   `json:"haschild,omitempty"`
 | 
			
		||||
	Id                        string `json:"id,omitempty"`
 | 
			
		||||
	Ipavailable               string `json:"ipavailable,omitempty"`
 | 
			
		||||
	Iplimit                   string `json:"iplimit,omitempty"`
 | 
			
		||||
	Iptotal                   int64  `json:"iptotal,omitempty"`
 | 
			
		||||
	Level                     int    `json:"level,omitempty"`
 | 
			
		||||
	Memoryavailable           string `json:"memoryavailable,omitempty"`
 | 
			
		||||
	Memorylimit               string `json:"memorylimit,omitempty"`
 | 
			
		||||
	Memorytotal               int64  `json:"memorytotal,omitempty"`
 | 
			
		||||
	Name                      string `json:"name,omitempty"`
 | 
			
		||||
	Networkavailable          string `json:"networkavailable,omitempty"`
 | 
			
		||||
	Networkdomain             string `json:"networkdomain,omitempty"`
 | 
			
		||||
	Networklimit              string `json:"networklimit,omitempty"`
 | 
			
		||||
	Networktotal              int64  `json:"networktotal,omitempty"`
 | 
			
		||||
	Parentdomainid            string `json:"parentdomainid,omitempty"`
 | 
			
		||||
	Parentdomainname          string `json:"parentdomainname,omitempty"`
 | 
			
		||||
	Path                      string `json:"path,omitempty"`
 | 
			
		||||
	Primarystorageavailable   string `json:"primarystorageavailable,omitempty"`
 | 
			
		||||
	Primarystoragelimit       string `json:"primarystoragelimit,omitempty"`
 | 
			
		||||
	Primarystoragetotal       int64  `json:"primarystoragetotal,omitempty"`
 | 
			
		||||
	Projectavailable          string `json:"projectavailable,omitempty"`
 | 
			
		||||
	Projectlimit              string `json:"projectlimit,omitempty"`
 | 
			
		||||
	Projecttotal              int64  `json:"projecttotal,omitempty"`
 | 
			
		||||
	Secondarystorageavailable string `json:"secondarystorageavailable,omitempty"`
 | 
			
		||||
	Secondarystoragelimit     string `json:"secondarystoragelimit,omitempty"`
 | 
			
		||||
	Secondarystoragetotal     int64  `json:"secondarystoragetotal,omitempty"`
 | 
			
		||||
	Snapshotavailable         string `json:"snapshotavailable,omitempty"`
 | 
			
		||||
	Snapshotlimit             string `json:"snapshotlimit,omitempty"`
 | 
			
		||||
	Snapshottotal             int64  `json:"snapshottotal,omitempty"`
 | 
			
		||||
	State                     string `json:"state,omitempty"`
 | 
			
		||||
	Templateavailable         string `json:"templateavailable,omitempty"`
 | 
			
		||||
	Templatelimit             string `json:"templatelimit,omitempty"`
 | 
			
		||||
	Templatetotal             int64  `json:"templatetotal,omitempty"`
 | 
			
		||||
	Vmavailable               string `json:"vmavailable,omitempty"`
 | 
			
		||||
	Vmlimit                   string `json:"vmlimit,omitempty"`
 | 
			
		||||
	Vmtotal                   int64  `json:"vmtotal,omitempty"`
 | 
			
		||||
	Volumeavailable           string `json:"volumeavailable,omitempty"`
 | 
			
		||||
	Volumelimit               string `json:"volumelimit,omitempty"`
 | 
			
		||||
	Volumetotal               int64  `json:"volumetotal,omitempty"`
 | 
			
		||||
	Vpcavailable              string `json:"vpcavailable,omitempty"`
 | 
			
		||||
	Vpclimit                  string `json:"vpclimit,omitempty"`
 | 
			
		||||
	Vpctotal                  int64  `json:"vpctotal,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["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) 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 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 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,omitempty"`
 | 
			
		||||
	Cpulimit                  string `json:"cpulimit,omitempty"`
 | 
			
		||||
	Cputotal                  int64  `json:"cputotal,omitempty"`
 | 
			
		||||
	Haschild                  bool   `json:"haschild,omitempty"`
 | 
			
		||||
	Id                        string `json:"id,omitempty"`
 | 
			
		||||
	Ipavailable               string `json:"ipavailable,omitempty"`
 | 
			
		||||
	Iplimit                   string `json:"iplimit,omitempty"`
 | 
			
		||||
	Iptotal                   int64  `json:"iptotal,omitempty"`
 | 
			
		||||
	Level                     int    `json:"level,omitempty"`
 | 
			
		||||
	Memoryavailable           string `json:"memoryavailable,omitempty"`
 | 
			
		||||
	Memorylimit               string `json:"memorylimit,omitempty"`
 | 
			
		||||
	Memorytotal               int64  `json:"memorytotal,omitempty"`
 | 
			
		||||
	Name                      string `json:"name,omitempty"`
 | 
			
		||||
	Networkavailable          string `json:"networkavailable,omitempty"`
 | 
			
		||||
	Networkdomain             string `json:"networkdomain,omitempty"`
 | 
			
		||||
	Networklimit              string `json:"networklimit,omitempty"`
 | 
			
		||||
	Networktotal              int64  `json:"networktotal,omitempty"`
 | 
			
		||||
	Parentdomainid            string `json:"parentdomainid,omitempty"`
 | 
			
		||||
	Parentdomainname          string `json:"parentdomainname,omitempty"`
 | 
			
		||||
	Path                      string `json:"path,omitempty"`
 | 
			
		||||
	Primarystorageavailable   string `json:"primarystorageavailable,omitempty"`
 | 
			
		||||
	Primarystoragelimit       string `json:"primarystoragelimit,omitempty"`
 | 
			
		||||
	Primarystoragetotal       int64  `json:"primarystoragetotal,omitempty"`
 | 
			
		||||
	Projectavailable          string `json:"projectavailable,omitempty"`
 | 
			
		||||
	Projectlimit              string `json:"projectlimit,omitempty"`
 | 
			
		||||
	Projecttotal              int64  `json:"projecttotal,omitempty"`
 | 
			
		||||
	Secondarystorageavailable string `json:"secondarystorageavailable,omitempty"`
 | 
			
		||||
	Secondarystoragelimit     string `json:"secondarystoragelimit,omitempty"`
 | 
			
		||||
	Secondarystoragetotal     int64  `json:"secondarystoragetotal,omitempty"`
 | 
			
		||||
	Snapshotavailable         string `json:"snapshotavailable,omitempty"`
 | 
			
		||||
	Snapshotlimit             string `json:"snapshotlimit,omitempty"`
 | 
			
		||||
	Snapshottotal             int64  `json:"snapshottotal,omitempty"`
 | 
			
		||||
	State                     string `json:"state,omitempty"`
 | 
			
		||||
	Templateavailable         string `json:"templateavailable,omitempty"`
 | 
			
		||||
	Templatelimit             string `json:"templatelimit,omitempty"`
 | 
			
		||||
	Templatetotal             int64  `json:"templatetotal,omitempty"`
 | 
			
		||||
	Vmavailable               string `json:"vmavailable,omitempty"`
 | 
			
		||||
	Vmlimit                   string `json:"vmlimit,omitempty"`
 | 
			
		||||
	Vmtotal                   int64  `json:"vmtotal,omitempty"`
 | 
			
		||||
	Volumeavailable           string `json:"volumeavailable,omitempty"`
 | 
			
		||||
	Volumelimit               string `json:"volumelimit,omitempty"`
 | 
			
		||||
	Volumetotal               int64  `json:"volumetotal,omitempty"`
 | 
			
		||||
	Vpcavailable              string `json:"vpcavailable,omitempty"`
 | 
			
		||||
	Vpclimit                  string `json:"vpclimit,omitempty"`
 | 
			
		||||
	Vpctotal                  int64  `json:"vpctotal,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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 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,omitempty"`
 | 
			
		||||
	Cpulimit                  string `json:"cpulimit,omitempty"`
 | 
			
		||||
	Cputotal                  int64  `json:"cputotal,omitempty"`
 | 
			
		||||
	Haschild                  bool   `json:"haschild,omitempty"`
 | 
			
		||||
	Id                        string `json:"id,omitempty"`
 | 
			
		||||
	Ipavailable               string `json:"ipavailable,omitempty"`
 | 
			
		||||
	Iplimit                   string `json:"iplimit,omitempty"`
 | 
			
		||||
	Iptotal                   int64  `json:"iptotal,omitempty"`
 | 
			
		||||
	Level                     int    `json:"level,omitempty"`
 | 
			
		||||
	Memoryavailable           string `json:"memoryavailable,omitempty"`
 | 
			
		||||
	Memorylimit               string `json:"memorylimit,omitempty"`
 | 
			
		||||
	Memorytotal               int64  `json:"memorytotal,omitempty"`
 | 
			
		||||
	Name                      string `json:"name,omitempty"`
 | 
			
		||||
	Networkavailable          string `json:"networkavailable,omitempty"`
 | 
			
		||||
	Networkdomain             string `json:"networkdomain,omitempty"`
 | 
			
		||||
	Networklimit              string `json:"networklimit,omitempty"`
 | 
			
		||||
	Networktotal              int64  `json:"networktotal,omitempty"`
 | 
			
		||||
	Parentdomainid            string `json:"parentdomainid,omitempty"`
 | 
			
		||||
	Parentdomainname          string `json:"parentdomainname,omitempty"`
 | 
			
		||||
	Path                      string `json:"path,omitempty"`
 | 
			
		||||
	Primarystorageavailable   string `json:"primarystorageavailable,omitempty"`
 | 
			
		||||
	Primarystoragelimit       string `json:"primarystoragelimit,omitempty"`
 | 
			
		||||
	Primarystoragetotal       int64  `json:"primarystoragetotal,omitempty"`
 | 
			
		||||
	Projectavailable          string `json:"projectavailable,omitempty"`
 | 
			
		||||
	Projectlimit              string `json:"projectlimit,omitempty"`
 | 
			
		||||
	Projecttotal              int64  `json:"projecttotal,omitempty"`
 | 
			
		||||
	Secondarystorageavailable string `json:"secondarystorageavailable,omitempty"`
 | 
			
		||||
	Secondarystoragelimit     string `json:"secondarystoragelimit,omitempty"`
 | 
			
		||||
	Secondarystoragetotal     int64  `json:"secondarystoragetotal,omitempty"`
 | 
			
		||||
	Snapshotavailable         string `json:"snapshotavailable,omitempty"`
 | 
			
		||||
	Snapshotlimit             string `json:"snapshotlimit,omitempty"`
 | 
			
		||||
	Snapshottotal             int64  `json:"snapshottotal,omitempty"`
 | 
			
		||||
	State                     string `json:"state,omitempty"`
 | 
			
		||||
	Templateavailable         string `json:"templateavailable,omitempty"`
 | 
			
		||||
	Templatelimit             string `json:"templatelimit,omitempty"`
 | 
			
		||||
	Templatetotal             int64  `json:"templatetotal,omitempty"`
 | 
			
		||||
	Vmavailable               string `json:"vmavailable,omitempty"`
 | 
			
		||||
	Vmlimit                   string `json:"vmlimit,omitempty"`
 | 
			
		||||
	Vmtotal                   int64  `json:"vmtotal,omitempty"`
 | 
			
		||||
	Volumeavailable           string `json:"volumeavailable,omitempty"`
 | 
			
		||||
	Volumelimit               string `json:"volumelimit,omitempty"`
 | 
			
		||||
	Volumetotal               int64  `json:"volumetotal,omitempty"`
 | 
			
		||||
	Vpcavailable              string `json:"vpcavailable,omitempty"`
 | 
			
		||||
	Vpclimit                  string `json:"vpclimit,omitempty"`
 | 
			
		||||
	Vpctotal                  int64  `json:"vpctotal,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["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) 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["domainType"] = 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 *DomainService) NewLinkDomainToLdapParams(accounttype int, domainid string, name string, domainType string) *LinkDomainToLdapParams {
 | 
			
		||||
	p := &LinkDomainToLdapParams{}
 | 
			
		||||
	p.p = make(map[string]interface{})
 | 
			
		||||
	p.p["accounttype"] = accounttype
 | 
			
		||||
	p.p["domainid"] = domainid
 | 
			
		||||
	p.p["name"] = name
 | 
			
		||||
	p.p["domainType"] = domainType
 | 
			
		||||
	return p
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// link an existing cloudstack domain to group or OU in ldap
 | 
			
		||||
func (s *DomainService) 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,omitempty"`
 | 
			
		||||
	Accounttype int    `json:"accounttype,omitempty"`
 | 
			
		||||
	Domainid    int64  `json:"domainid,omitempty"`
 | 
			
		||||
	Name        string `json:"name,omitempty"`
 | 
			
		||||
	Type        string `json:"type,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										495
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/EventService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										495
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/EventService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,495 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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["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) SetType(v string) {
 | 
			
		||||
	if p.p == nil {
 | 
			
		||||
		p.p = make(map[string]interface{})
 | 
			
		||||
	}
 | 
			
		||||
	p.p["eventType"] = 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 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,omitempty"`
 | 
			
		||||
	Created     string `json:"created,omitempty"`
 | 
			
		||||
	Description string `json:"description,omitempty"`
 | 
			
		||||
	Domain      string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid    string `json:"domainid,omitempty"`
 | 
			
		||||
	Id          string `json:"id,omitempty"`
 | 
			
		||||
	Level       string `json:"level,omitempty"`
 | 
			
		||||
	Parentid    string `json:"parentid,omitempty"`
 | 
			
		||||
	Project     string `json:"project,omitempty"`
 | 
			
		||||
	Projectid   string `json:"projectid,omitempty"`
 | 
			
		||||
	State       string `json:"state,omitempty"`
 | 
			
		||||
	Type        string `json:"type,omitempty"`
 | 
			
		||||
	Username    string `json:"username,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	Name string `json:"name,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["eventType"] = 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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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["eventType"] = 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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2587
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/FirewallService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2587
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/FirewallService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1046
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/GuestOSService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1046
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/GuestOSService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2296
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/HostService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2296
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/HostService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										299
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/HypervisorService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										299
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/HypervisorService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,299 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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 {
 | 
			
		||||
	Name string `json:"name,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Hypervisorversion    string `json:"hypervisorversion,omitempty"`
 | 
			
		||||
	Id                   string `json:"id,omitempty"`
 | 
			
		||||
	Maxdatavolumeslimit  int    `json:"maxdatavolumeslimit,omitempty"`
 | 
			
		||||
	Maxguestslimit       int64  `json:"maxguestslimit,omitempty"`
 | 
			
		||||
	Maxhostspercluster   int    `json:"maxhostspercluster,omitempty"`
 | 
			
		||||
	Securitygroupenabled bool   `json:"securitygroupenabled,omitempty"`
 | 
			
		||||
	Storagemotionenabled bool   `json:"storagemotionenabled,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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,omitempty"`
 | 
			
		||||
	Hypervisorversion    string `json:"hypervisorversion,omitempty"`
 | 
			
		||||
	Id                   string `json:"id,omitempty"`
 | 
			
		||||
	Maxdatavolumeslimit  int    `json:"maxdatavolumeslimit,omitempty"`
 | 
			
		||||
	Maxguestslimit       int64  `json:"maxguestslimit,omitempty"`
 | 
			
		||||
	Maxhostspercluster   int    `json:"maxhostspercluster,omitempty"`
 | 
			
		||||
	Securitygroupenabled bool   `json:"securitygroupenabled,omitempty"`
 | 
			
		||||
	Storagemotionenabled bool   `json:"storagemotionenabled,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1944
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ISOService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1944
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ISOService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1062
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ImageStoreService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1062
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ImageStoreService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1004
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/InternalLBService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1004
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/InternalLBService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										239
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/LDAPService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										239
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/LDAPService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,239 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("accountdetails[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("accountdetails[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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["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) 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(accounttype int, username string) *LdapCreateAccountParams {
 | 
			
		||||
	p := &LdapCreateAccountParams{}
 | 
			
		||||
	p.p = make(map[string]interface{})
 | 
			
		||||
	p.p["accounttype"] = accounttype
 | 
			
		||||
	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,omitempty"`
 | 
			
		||||
	Accounttype               int               `json:"accounttype,omitempty"`
 | 
			
		||||
	Cpuavailable              string            `json:"cpuavailable,omitempty"`
 | 
			
		||||
	Cpulimit                  string            `json:"cpulimit,omitempty"`
 | 
			
		||||
	Cputotal                  int64             `json:"cputotal,omitempty"`
 | 
			
		||||
	Defaultzoneid             string            `json:"defaultzoneid,omitempty"`
 | 
			
		||||
	Domain                    string            `json:"domain,omitempty"`
 | 
			
		||||
	Domainid                  string            `json:"domainid,omitempty"`
 | 
			
		||||
	Groups                    []string          `json:"groups,omitempty"`
 | 
			
		||||
	Id                        string            `json:"id,omitempty"`
 | 
			
		||||
	Ipavailable               string            `json:"ipavailable,omitempty"`
 | 
			
		||||
	Iplimit                   string            `json:"iplimit,omitempty"`
 | 
			
		||||
	Iptotal                   int64             `json:"iptotal,omitempty"`
 | 
			
		||||
	Iscleanuprequired         bool              `json:"iscleanuprequired,omitempty"`
 | 
			
		||||
	Isdefault                 bool              `json:"isdefault,omitempty"`
 | 
			
		||||
	Memoryavailable           string            `json:"memoryavailable,omitempty"`
 | 
			
		||||
	Memorylimit               string            `json:"memorylimit,omitempty"`
 | 
			
		||||
	Memorytotal               int64             `json:"memorytotal,omitempty"`
 | 
			
		||||
	Name                      string            `json:"name,omitempty"`
 | 
			
		||||
	Networkavailable          string            `json:"networkavailable,omitempty"`
 | 
			
		||||
	Networkdomain             string            `json:"networkdomain,omitempty"`
 | 
			
		||||
	Networklimit              string            `json:"networklimit,omitempty"`
 | 
			
		||||
	Networktotal              int64             `json:"networktotal,omitempty"`
 | 
			
		||||
	Primarystorageavailable   string            `json:"primarystorageavailable,omitempty"`
 | 
			
		||||
	Primarystoragelimit       string            `json:"primarystoragelimit,omitempty"`
 | 
			
		||||
	Primarystoragetotal       int64             `json:"primarystoragetotal,omitempty"`
 | 
			
		||||
	Projectavailable          string            `json:"projectavailable,omitempty"`
 | 
			
		||||
	Projectlimit              string            `json:"projectlimit,omitempty"`
 | 
			
		||||
	Projecttotal              int64             `json:"projecttotal,omitempty"`
 | 
			
		||||
	Receivedbytes             int64             `json:"receivedbytes,omitempty"`
 | 
			
		||||
	Secondarystorageavailable string            `json:"secondarystorageavailable,omitempty"`
 | 
			
		||||
	Secondarystoragelimit     string            `json:"secondarystoragelimit,omitempty"`
 | 
			
		||||
	Secondarystoragetotal     int64             `json:"secondarystoragetotal,omitempty"`
 | 
			
		||||
	Sentbytes                 int64             `json:"sentbytes,omitempty"`
 | 
			
		||||
	Snapshotavailable         string            `json:"snapshotavailable,omitempty"`
 | 
			
		||||
	Snapshotlimit             string            `json:"snapshotlimit,omitempty"`
 | 
			
		||||
	Snapshottotal             int64             `json:"snapshottotal,omitempty"`
 | 
			
		||||
	State                     string            `json:"state,omitempty"`
 | 
			
		||||
	Templateavailable         string            `json:"templateavailable,omitempty"`
 | 
			
		||||
	Templatelimit             string            `json:"templatelimit,omitempty"`
 | 
			
		||||
	Templatetotal             int64             `json:"templatetotal,omitempty"`
 | 
			
		||||
	User                      []struct {
 | 
			
		||||
		Account             string `json:"account,omitempty"`
 | 
			
		||||
		Accountid           string `json:"accountid,omitempty"`
 | 
			
		||||
		Accounttype         int    `json:"accounttype,omitempty"`
 | 
			
		||||
		Apikey              string `json:"apikey,omitempty"`
 | 
			
		||||
		Created             string `json:"created,omitempty"`
 | 
			
		||||
		Domain              string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid            string `json:"domainid,omitempty"`
 | 
			
		||||
		Email               string `json:"email,omitempty"`
 | 
			
		||||
		Firstname           string `json:"firstname,omitempty"`
 | 
			
		||||
		Id                  string `json:"id,omitempty"`
 | 
			
		||||
		Iscallerchilddomain bool   `json:"iscallerchilddomain,omitempty"`
 | 
			
		||||
		Isdefault           bool   `json:"isdefault,omitempty"`
 | 
			
		||||
		Lastname            string `json:"lastname,omitempty"`
 | 
			
		||||
		Secretkey           string `json:"secretkey,omitempty"`
 | 
			
		||||
		State               string `json:"state,omitempty"`
 | 
			
		||||
		Timezone            string `json:"timezone,omitempty"`
 | 
			
		||||
		Username            string `json:"username,omitempty"`
 | 
			
		||||
	} `json:"user,omitempty"`
 | 
			
		||||
	Vmavailable     string `json:"vmavailable,omitempty"`
 | 
			
		||||
	Vmlimit         string `json:"vmlimit,omitempty"`
 | 
			
		||||
	Vmrunning       int    `json:"vmrunning,omitempty"`
 | 
			
		||||
	Vmstopped       int    `json:"vmstopped,omitempty"`
 | 
			
		||||
	Vmtotal         int64  `json:"vmtotal,omitempty"`
 | 
			
		||||
	Volumeavailable string `json:"volumeavailable,omitempty"`
 | 
			
		||||
	Volumelimit     string `json:"volumelimit,omitempty"`
 | 
			
		||||
	Volumetotal     int64  `json:"volumetotal,omitempty"`
 | 
			
		||||
	Vpcavailable    string `json:"vpcavailable,omitempty"`
 | 
			
		||||
	Vpclimit        string `json:"vpclimit,omitempty"`
 | 
			
		||||
	Vpctotal        int64  `json:"vpctotal,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										201
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										201
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,201 @@
 | 
			
		||||
Apache 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.
 | 
			
		||||
							
								
								
									
										475
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/LimitService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										475
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/LimitService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,475 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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,omitempty"`
 | 
			
		||||
	Domain       string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
	Max          int64  `json:"max,omitempty"`
 | 
			
		||||
	Project      string `json:"project,omitempty"`
 | 
			
		||||
	Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
	Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Domain        string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid      string `json:"domainid,omitempty"`
 | 
			
		||||
	Project       string `json:"project,omitempty"`
 | 
			
		||||
	Projectid     string `json:"projectid,omitempty"`
 | 
			
		||||
	Resourcecount int64  `json:"resourcecount,omitempty"`
 | 
			
		||||
	Resourcetype  string `json:"resourcetype,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
	}
 | 
			
		||||
	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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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,omitempty"`
 | 
			
		||||
	Domain       string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
	Max          int64  `json:"max,omitempty"`
 | 
			
		||||
	Project      string `json:"project,omitempty"`
 | 
			
		||||
	Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
	Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Accountid   string `json:"accountid,omitempty"`
 | 
			
		||||
	ApiAllowed  int    `json:"apiAllowed,omitempty"`
 | 
			
		||||
	ApiIssued   int    `json:"apiIssued,omitempty"`
 | 
			
		||||
	ExpireAfter int64  `json:"expireAfter,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Accountid   string `json:"accountid,omitempty"`
 | 
			
		||||
	ApiAllowed  int    `json:"apiAllowed,omitempty"`
 | 
			
		||||
	ApiIssued   int    `json:"apiIssued,omitempty"`
 | 
			
		||||
	ExpireAfter int64  `json:"expireAfter,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4745
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/LoadBalancerService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4745
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/LoadBalancerService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										631
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NATService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										631
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NATService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,631 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID          string `json:"jobid,omitempty"`
 | 
			
		||||
	Cidrlist       string `json:"cidrlist,omitempty"`
 | 
			
		||||
	Fordisplay     bool   `json:"fordisplay,omitempty"`
 | 
			
		||||
	Id             string `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress      string `json:"ipaddress,omitempty"`
 | 
			
		||||
	Ipaddressid    string `json:"ipaddressid,omitempty"`
 | 
			
		||||
	Networkid      string `json:"networkid,omitempty"`
 | 
			
		||||
	Privateendport string `json:"privateendport,omitempty"`
 | 
			
		||||
	Privateport    string `json:"privateport,omitempty"`
 | 
			
		||||
	Protocol       string `json:"protocol,omitempty"`
 | 
			
		||||
	Publicendport  string `json:"publicendport,omitempty"`
 | 
			
		||||
	Publicport     string `json:"publicport,omitempty"`
 | 
			
		||||
	State          string `json:"state,omitempty"`
 | 
			
		||||
	Tags           []struct {
 | 
			
		||||
		Account      string `json:"account,omitempty"`
 | 
			
		||||
		Customer     string `json:"customer,omitempty"`
 | 
			
		||||
		Domain       string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
		Key          string `json:"key,omitempty"`
 | 
			
		||||
		Project      string `json:"project,omitempty"`
 | 
			
		||||
		Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
		Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
		Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
		Value        string `json:"value,omitempty"`
 | 
			
		||||
	} `json:"tags,omitempty"`
 | 
			
		||||
	Virtualmachinedisplayname string `json:"virtualmachinedisplayname,omitempty"`
 | 
			
		||||
	Virtualmachineid          string `json:"virtualmachineid,omitempty"`
 | 
			
		||||
	Virtualmachinename        string `json:"virtualmachinename,omitempty"`
 | 
			
		||||
	Vmguestip                 string `json:"vmguestip,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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,omitempty"`
 | 
			
		||||
	Fordisplay     bool   `json:"fordisplay,omitempty"`
 | 
			
		||||
	Id             string `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress      string `json:"ipaddress,omitempty"`
 | 
			
		||||
	Ipaddressid    string `json:"ipaddressid,omitempty"`
 | 
			
		||||
	Networkid      string `json:"networkid,omitempty"`
 | 
			
		||||
	Privateendport string `json:"privateendport,omitempty"`
 | 
			
		||||
	Privateport    string `json:"privateport,omitempty"`
 | 
			
		||||
	Protocol       string `json:"protocol,omitempty"`
 | 
			
		||||
	Publicendport  string `json:"publicendport,omitempty"`
 | 
			
		||||
	Publicport     string `json:"publicport,omitempty"`
 | 
			
		||||
	State          string `json:"state,omitempty"`
 | 
			
		||||
	Tags           []struct {
 | 
			
		||||
		Account      string `json:"account,omitempty"`
 | 
			
		||||
		Customer     string `json:"customer,omitempty"`
 | 
			
		||||
		Domain       string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
		Key          string `json:"key,omitempty"`
 | 
			
		||||
		Project      string `json:"project,omitempty"`
 | 
			
		||||
		Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
		Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
		Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
		Value        string `json:"value,omitempty"`
 | 
			
		||||
	} `json:"tags,omitempty"`
 | 
			
		||||
	Virtualmachinedisplayname string `json:"virtualmachinedisplayname,omitempty"`
 | 
			
		||||
	Virtualmachineid          string `json:"virtualmachineid,omitempty"`
 | 
			
		||||
	Virtualmachinename        string `json:"virtualmachinename,omitempty"`
 | 
			
		||||
	Vmguestip                 string `json:"vmguestip,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1458
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NetworkACLService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1458
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NetworkACLService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										245
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NetworkDeviceService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										245
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NetworkDeviceService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,245 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										951
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NetworkOfferingService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										951
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NetworkOfferingService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,951 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("details[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("details[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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["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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("servicecapabilitylist[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("servicecapabilitylist[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if v, found := p.p["serviceofferingid"]; found {
 | 
			
		||||
		u.Set("serviceofferingid", v.(string))
 | 
			
		||||
	}
 | 
			
		||||
	if v, found := p.p["serviceproviderlist"]; found {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("serviceproviderlist[%d].service", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("serviceproviderlist[%d].provider", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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) 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,omitempty"`
 | 
			
		||||
	Conservemode        bool              `json:"conservemode,omitempty"`
 | 
			
		||||
	Created             string            `json:"created,omitempty"`
 | 
			
		||||
	Details             map[string]string `json:"details,omitempty"`
 | 
			
		||||
	Displaytext         string            `json:"displaytext,omitempty"`
 | 
			
		||||
	Egressdefaultpolicy bool              `json:"egressdefaultpolicy,omitempty"`
 | 
			
		||||
	Forvpc              bool              `json:"forvpc,omitempty"`
 | 
			
		||||
	Guestiptype         string            `json:"guestiptype,omitempty"`
 | 
			
		||||
	Id                  string            `json:"id,omitempty"`
 | 
			
		||||
	Isdefault           bool              `json:"isdefault,omitempty"`
 | 
			
		||||
	Ispersistent        bool              `json:"ispersistent,omitempty"`
 | 
			
		||||
	Maxconnections      int               `json:"maxconnections,omitempty"`
 | 
			
		||||
	Name                string            `json:"name,omitempty"`
 | 
			
		||||
	Networkrate         int               `json:"networkrate,omitempty"`
 | 
			
		||||
	Service             []struct {
 | 
			
		||||
		Capability []struct {
 | 
			
		||||
			Canchooseservicecapability bool   `json:"canchooseservicecapability,omitempty"`
 | 
			
		||||
			Name                       string `json:"name,omitempty"`
 | 
			
		||||
			Value                      string `json:"value,omitempty"`
 | 
			
		||||
		} `json:"capability,omitempty"`
 | 
			
		||||
		Name     string `json:"name,omitempty"`
 | 
			
		||||
		Provider []struct {
 | 
			
		||||
			Canenableindividualservice   bool     `json:"canenableindividualservice,omitempty"`
 | 
			
		||||
			Destinationphysicalnetworkid string   `json:"destinationphysicalnetworkid,omitempty"`
 | 
			
		||||
			Id                           string   `json:"id,omitempty"`
 | 
			
		||||
			Name                         string   `json:"name,omitempty"`
 | 
			
		||||
			Physicalnetworkid            string   `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
			Servicelist                  []string `json:"servicelist,omitempty"`
 | 
			
		||||
			State                        string   `json:"state,omitempty"`
 | 
			
		||||
		} `json:"provider,omitempty"`
 | 
			
		||||
	} `json:"service,omitempty"`
 | 
			
		||||
	Serviceofferingid        string `json:"serviceofferingid,omitempty"`
 | 
			
		||||
	Specifyipranges          bool   `json:"specifyipranges,omitempty"`
 | 
			
		||||
	Specifyvlan              bool   `json:"specifyvlan,omitempty"`
 | 
			
		||||
	State                    string `json:"state,omitempty"`
 | 
			
		||||
	Supportsstrechedl2subnet bool   `json:"supportsstrechedl2subnet,omitempty"`
 | 
			
		||||
	Tags                     string `json:"tags,omitempty"`
 | 
			
		||||
	Traffictype              string `json:"traffictype,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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))
 | 
			
		||||
	}
 | 
			
		||||
	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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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,omitempty"`
 | 
			
		||||
	Conservemode        bool              `json:"conservemode,omitempty"`
 | 
			
		||||
	Created             string            `json:"created,omitempty"`
 | 
			
		||||
	Details             map[string]string `json:"details,omitempty"`
 | 
			
		||||
	Displaytext         string            `json:"displaytext,omitempty"`
 | 
			
		||||
	Egressdefaultpolicy bool              `json:"egressdefaultpolicy,omitempty"`
 | 
			
		||||
	Forvpc              bool              `json:"forvpc,omitempty"`
 | 
			
		||||
	Guestiptype         string            `json:"guestiptype,omitempty"`
 | 
			
		||||
	Id                  string            `json:"id,omitempty"`
 | 
			
		||||
	Isdefault           bool              `json:"isdefault,omitempty"`
 | 
			
		||||
	Ispersistent        bool              `json:"ispersistent,omitempty"`
 | 
			
		||||
	Maxconnections      int               `json:"maxconnections,omitempty"`
 | 
			
		||||
	Name                string            `json:"name,omitempty"`
 | 
			
		||||
	Networkrate         int               `json:"networkrate,omitempty"`
 | 
			
		||||
	Service             []struct {
 | 
			
		||||
		Capability []struct {
 | 
			
		||||
			Canchooseservicecapability bool   `json:"canchooseservicecapability,omitempty"`
 | 
			
		||||
			Name                       string `json:"name,omitempty"`
 | 
			
		||||
			Value                      string `json:"value,omitempty"`
 | 
			
		||||
		} `json:"capability,omitempty"`
 | 
			
		||||
		Name     string `json:"name,omitempty"`
 | 
			
		||||
		Provider []struct {
 | 
			
		||||
			Canenableindividualservice   bool     `json:"canenableindividualservice,omitempty"`
 | 
			
		||||
			Destinationphysicalnetworkid string   `json:"destinationphysicalnetworkid,omitempty"`
 | 
			
		||||
			Id                           string   `json:"id,omitempty"`
 | 
			
		||||
			Name                         string   `json:"name,omitempty"`
 | 
			
		||||
			Physicalnetworkid            string   `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
			Servicelist                  []string `json:"servicelist,omitempty"`
 | 
			
		||||
			State                        string   `json:"state,omitempty"`
 | 
			
		||||
		} `json:"provider,omitempty"`
 | 
			
		||||
	} `json:"service,omitempty"`
 | 
			
		||||
	Serviceofferingid        string `json:"serviceofferingid,omitempty"`
 | 
			
		||||
	Specifyipranges          bool   `json:"specifyipranges,omitempty"`
 | 
			
		||||
	Specifyvlan              bool   `json:"specifyvlan,omitempty"`
 | 
			
		||||
	State                    string `json:"state,omitempty"`
 | 
			
		||||
	Supportsstrechedl2subnet bool   `json:"supportsstrechedl2subnet,omitempty"`
 | 
			
		||||
	Tags                     string `json:"tags,omitempty"`
 | 
			
		||||
	Traffictype              string `json:"traffictype,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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 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,omitempty"`
 | 
			
		||||
	Conservemode        bool              `json:"conservemode,omitempty"`
 | 
			
		||||
	Created             string            `json:"created,omitempty"`
 | 
			
		||||
	Details             map[string]string `json:"details,omitempty"`
 | 
			
		||||
	Displaytext         string            `json:"displaytext,omitempty"`
 | 
			
		||||
	Egressdefaultpolicy bool              `json:"egressdefaultpolicy,omitempty"`
 | 
			
		||||
	Forvpc              bool              `json:"forvpc,omitempty"`
 | 
			
		||||
	Guestiptype         string            `json:"guestiptype,omitempty"`
 | 
			
		||||
	Id                  string            `json:"id,omitempty"`
 | 
			
		||||
	Isdefault           bool              `json:"isdefault,omitempty"`
 | 
			
		||||
	Ispersistent        bool              `json:"ispersistent,omitempty"`
 | 
			
		||||
	Maxconnections      int               `json:"maxconnections,omitempty"`
 | 
			
		||||
	Name                string            `json:"name,omitempty"`
 | 
			
		||||
	Networkrate         int               `json:"networkrate,omitempty"`
 | 
			
		||||
	Service             []struct {
 | 
			
		||||
		Capability []struct {
 | 
			
		||||
			Canchooseservicecapability bool   `json:"canchooseservicecapability,omitempty"`
 | 
			
		||||
			Name                       string `json:"name,omitempty"`
 | 
			
		||||
			Value                      string `json:"value,omitempty"`
 | 
			
		||||
		} `json:"capability,omitempty"`
 | 
			
		||||
		Name     string `json:"name,omitempty"`
 | 
			
		||||
		Provider []struct {
 | 
			
		||||
			Canenableindividualservice   bool     `json:"canenableindividualservice,omitempty"`
 | 
			
		||||
			Destinationphysicalnetworkid string   `json:"destinationphysicalnetworkid,omitempty"`
 | 
			
		||||
			Id                           string   `json:"id,omitempty"`
 | 
			
		||||
			Name                         string   `json:"name,omitempty"`
 | 
			
		||||
			Physicalnetworkid            string   `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
			Servicelist                  []string `json:"servicelist,omitempty"`
 | 
			
		||||
			State                        string   `json:"state,omitempty"`
 | 
			
		||||
		} `json:"provider,omitempty"`
 | 
			
		||||
	} `json:"service,omitempty"`
 | 
			
		||||
	Serviceofferingid        string `json:"serviceofferingid,omitempty"`
 | 
			
		||||
	Specifyipranges          bool   `json:"specifyipranges,omitempty"`
 | 
			
		||||
	Specifyvlan              bool   `json:"specifyvlan,omitempty"`
 | 
			
		||||
	State                    string `json:"state,omitempty"`
 | 
			
		||||
	Supportsstrechedl2subnet bool   `json:"supportsstrechedl2subnet,omitempty"`
 | 
			
		||||
	Tags                     string `json:"tags,omitempty"`
 | 
			
		||||
	Traffictype              string `json:"traffictype,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4024
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NetworkService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4024
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NetworkService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										574
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NicService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										574
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NicService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,574 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 {
 | 
			
		||||
	JobID            string `json:"jobid,omitempty"`
 | 
			
		||||
	Id               string `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress        string `json:"ipaddress,omitempty"`
 | 
			
		||||
	Networkid        string `json:"networkid,omitempty"`
 | 
			
		||||
	Nicid            string `json:"nicid,omitempty"`
 | 
			
		||||
	Virtualmachineid string `json:"virtualmachineid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID         string `json:"jobid,omitempty"`
 | 
			
		||||
	Account       string `json:"account,omitempty"`
 | 
			
		||||
	Affinitygroup []struct {
 | 
			
		||||
		Account           string   `json:"account,omitempty"`
 | 
			
		||||
		Description       string   `json:"description,omitempty"`
 | 
			
		||||
		Domain            string   `json:"domain,omitempty"`
 | 
			
		||||
		Domainid          string   `json:"domainid,omitempty"`
 | 
			
		||||
		Id                string   `json:"id,omitempty"`
 | 
			
		||||
		Name              string   `json:"name,omitempty"`
 | 
			
		||||
		Project           string   `json:"project,omitempty"`
 | 
			
		||||
		Projectid         string   `json:"projectid,omitempty"`
 | 
			
		||||
		Type              string   `json:"type,omitempty"`
 | 
			
		||||
		VirtualmachineIds []string `json:"virtualmachineIds,omitempty"`
 | 
			
		||||
	} `json:"affinitygroup,omitempty"`
 | 
			
		||||
	Cpunumber             int               `json:"cpunumber,omitempty"`
 | 
			
		||||
	Cpuspeed              int               `json:"cpuspeed,omitempty"`
 | 
			
		||||
	Cpuused               string            `json:"cpuused,omitempty"`
 | 
			
		||||
	Created               string            `json:"created,omitempty"`
 | 
			
		||||
	Details               map[string]string `json:"details,omitempty"`
 | 
			
		||||
	Diskioread            int64             `json:"diskioread,omitempty"`
 | 
			
		||||
	Diskiowrite           int64             `json:"diskiowrite,omitempty"`
 | 
			
		||||
	Diskkbsread           int64             `json:"diskkbsread,omitempty"`
 | 
			
		||||
	Diskkbswrite          int64             `json:"diskkbswrite,omitempty"`
 | 
			
		||||
	Diskofferingid        string            `json:"diskofferingid,omitempty"`
 | 
			
		||||
	Diskofferingname      string            `json:"diskofferingname,omitempty"`
 | 
			
		||||
	Displayname           string            `json:"displayname,omitempty"`
 | 
			
		||||
	Displayvm             bool              `json:"displayvm,omitempty"`
 | 
			
		||||
	Domain                string            `json:"domain,omitempty"`
 | 
			
		||||
	Domainid              string            `json:"domainid,omitempty"`
 | 
			
		||||
	Forvirtualnetwork     bool              `json:"forvirtualnetwork,omitempty"`
 | 
			
		||||
	Group                 string            `json:"group,omitempty"`
 | 
			
		||||
	Groupid               string            `json:"groupid,omitempty"`
 | 
			
		||||
	Guestosid             string            `json:"guestosid,omitempty"`
 | 
			
		||||
	Haenable              bool              `json:"haenable,omitempty"`
 | 
			
		||||
	Hostid                string            `json:"hostid,omitempty"`
 | 
			
		||||
	Hostname              string            `json:"hostname,omitempty"`
 | 
			
		||||
	Hypervisor            string            `json:"hypervisor,omitempty"`
 | 
			
		||||
	Id                    string            `json:"id,omitempty"`
 | 
			
		||||
	Instancename          string            `json:"instancename,omitempty"`
 | 
			
		||||
	Isdynamicallyscalable bool              `json:"isdynamicallyscalable,omitempty"`
 | 
			
		||||
	Isodisplaytext        string            `json:"isodisplaytext,omitempty"`
 | 
			
		||||
	Isoid                 string            `json:"isoid,omitempty"`
 | 
			
		||||
	Isoname               string            `json:"isoname,omitempty"`
 | 
			
		||||
	Keypair               string            `json:"keypair,omitempty"`
 | 
			
		||||
	Memory                int               `json:"memory,omitempty"`
 | 
			
		||||
	Name                  string            `json:"name,omitempty"`
 | 
			
		||||
	Networkkbsread        int64             `json:"networkkbsread,omitempty"`
 | 
			
		||||
	Networkkbswrite       int64             `json:"networkkbswrite,omitempty"`
 | 
			
		||||
	Nic                   []struct {
 | 
			
		||||
		Broadcasturi string `json:"broadcasturi,omitempty"`
 | 
			
		||||
		Deviceid     string `json:"deviceid,omitempty"`
 | 
			
		||||
		Gateway      string `json:"gateway,omitempty"`
 | 
			
		||||
		Id           string `json:"id,omitempty"`
 | 
			
		||||
		Ip6address   string `json:"ip6address,omitempty"`
 | 
			
		||||
		Ip6cidr      string `json:"ip6cidr,omitempty"`
 | 
			
		||||
		Ip6gateway   string `json:"ip6gateway,omitempty"`
 | 
			
		||||
		Ipaddress    string `json:"ipaddress,omitempty"`
 | 
			
		||||
		Isdefault    bool   `json:"isdefault,omitempty"`
 | 
			
		||||
		Isolationuri string `json:"isolationuri,omitempty"`
 | 
			
		||||
		Macaddress   string `json:"macaddress,omitempty"`
 | 
			
		||||
		Netmask      string `json:"netmask,omitempty"`
 | 
			
		||||
		Networkid    string `json:"networkid,omitempty"`
 | 
			
		||||
		Networkname  string `json:"networkname,omitempty"`
 | 
			
		||||
		Secondaryip  []struct {
 | 
			
		||||
			Id        string `json:"id,omitempty"`
 | 
			
		||||
			Ipaddress string `json:"ipaddress,omitempty"`
 | 
			
		||||
		} `json:"secondaryip,omitempty"`
 | 
			
		||||
		Traffictype      string `json:"traffictype,omitempty"`
 | 
			
		||||
		Type             string `json:"type,omitempty"`
 | 
			
		||||
		Virtualmachineid string `json:"virtualmachineid,omitempty"`
 | 
			
		||||
	} `json:"nic,omitempty"`
 | 
			
		||||
	Ostypeid        int64  `json:"ostypeid,omitempty"`
 | 
			
		||||
	Password        string `json:"password,omitempty"`
 | 
			
		||||
	Passwordenabled bool   `json:"passwordenabled,omitempty"`
 | 
			
		||||
	Project         string `json:"project,omitempty"`
 | 
			
		||||
	Projectid       string `json:"projectid,omitempty"`
 | 
			
		||||
	Publicip        string `json:"publicip,omitempty"`
 | 
			
		||||
	Publicipid      string `json:"publicipid,omitempty"`
 | 
			
		||||
	Rootdeviceid    int64  `json:"rootdeviceid,omitempty"`
 | 
			
		||||
	Rootdevicetype  string `json:"rootdevicetype,omitempty"`
 | 
			
		||||
	Securitygroup   []struct {
 | 
			
		||||
		Account     string `json:"account,omitempty"`
 | 
			
		||||
		Description string `json:"description,omitempty"`
 | 
			
		||||
		Domain      string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid    string `json:"domainid,omitempty"`
 | 
			
		||||
		Egressrule  []struct {
 | 
			
		||||
			Account           string `json:"account,omitempty"`
 | 
			
		||||
			Cidr              string `json:"cidr,omitempty"`
 | 
			
		||||
			Endport           int    `json:"endport,omitempty"`
 | 
			
		||||
			Icmpcode          int    `json:"icmpcode,omitempty"`
 | 
			
		||||
			Icmptype          int    `json:"icmptype,omitempty"`
 | 
			
		||||
			Protocol          string `json:"protocol,omitempty"`
 | 
			
		||||
			Ruleid            string `json:"ruleid,omitempty"`
 | 
			
		||||
			Securitygroupname string `json:"securitygroupname,omitempty"`
 | 
			
		||||
			Startport         int    `json:"startport,omitempty"`
 | 
			
		||||
			Tags              []struct {
 | 
			
		||||
				Account      string `json:"account,omitempty"`
 | 
			
		||||
				Customer     string `json:"customer,omitempty"`
 | 
			
		||||
				Domain       string `json:"domain,omitempty"`
 | 
			
		||||
				Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
				Key          string `json:"key,omitempty"`
 | 
			
		||||
				Project      string `json:"project,omitempty"`
 | 
			
		||||
				Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
				Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
				Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
				Value        string `json:"value,omitempty"`
 | 
			
		||||
			} `json:"tags,omitempty"`
 | 
			
		||||
		} `json:"egressrule,omitempty"`
 | 
			
		||||
		Id          string `json:"id,omitempty"`
 | 
			
		||||
		Ingressrule []struct {
 | 
			
		||||
			Account           string `json:"account,omitempty"`
 | 
			
		||||
			Cidr              string `json:"cidr,omitempty"`
 | 
			
		||||
			Endport           int    `json:"endport,omitempty"`
 | 
			
		||||
			Icmpcode          int    `json:"icmpcode,omitempty"`
 | 
			
		||||
			Icmptype          int    `json:"icmptype,omitempty"`
 | 
			
		||||
			Protocol          string `json:"protocol,omitempty"`
 | 
			
		||||
			Ruleid            string `json:"ruleid,omitempty"`
 | 
			
		||||
			Securitygroupname string `json:"securitygroupname,omitempty"`
 | 
			
		||||
			Startport         int    `json:"startport,omitempty"`
 | 
			
		||||
			Tags              []struct {
 | 
			
		||||
				Account      string `json:"account,omitempty"`
 | 
			
		||||
				Customer     string `json:"customer,omitempty"`
 | 
			
		||||
				Domain       string `json:"domain,omitempty"`
 | 
			
		||||
				Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
				Key          string `json:"key,omitempty"`
 | 
			
		||||
				Project      string `json:"project,omitempty"`
 | 
			
		||||
				Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
				Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
				Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
				Value        string `json:"value,omitempty"`
 | 
			
		||||
			} `json:"tags,omitempty"`
 | 
			
		||||
		} `json:"ingressrule,omitempty"`
 | 
			
		||||
		Name      string `json:"name,omitempty"`
 | 
			
		||||
		Project   string `json:"project,omitempty"`
 | 
			
		||||
		Projectid string `json:"projectid,omitempty"`
 | 
			
		||||
		Tags      []struct {
 | 
			
		||||
			Account      string `json:"account,omitempty"`
 | 
			
		||||
			Customer     string `json:"customer,omitempty"`
 | 
			
		||||
			Domain       string `json:"domain,omitempty"`
 | 
			
		||||
			Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
			Key          string `json:"key,omitempty"`
 | 
			
		||||
			Project      string `json:"project,omitempty"`
 | 
			
		||||
			Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
			Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
			Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
			Value        string `json:"value,omitempty"`
 | 
			
		||||
		} `json:"tags,omitempty"`
 | 
			
		||||
		Virtualmachinecount int      `json:"virtualmachinecount,omitempty"`
 | 
			
		||||
		Virtualmachineids   []string `json:"virtualmachineids,omitempty"`
 | 
			
		||||
	} `json:"securitygroup,omitempty"`
 | 
			
		||||
	Serviceofferingid   string `json:"serviceofferingid,omitempty"`
 | 
			
		||||
	Serviceofferingname string `json:"serviceofferingname,omitempty"`
 | 
			
		||||
	Servicestate        string `json:"servicestate,omitempty"`
 | 
			
		||||
	State               string `json:"state,omitempty"`
 | 
			
		||||
	Tags                []struct {
 | 
			
		||||
		Account      string `json:"account,omitempty"`
 | 
			
		||||
		Customer     string `json:"customer,omitempty"`
 | 
			
		||||
		Domain       string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
		Key          string `json:"key,omitempty"`
 | 
			
		||||
		Project      string `json:"project,omitempty"`
 | 
			
		||||
		Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
		Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
		Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
		Value        string `json:"value,omitempty"`
 | 
			
		||||
	} `json:"tags,omitempty"`
 | 
			
		||||
	Templatedisplaytext string `json:"templatedisplaytext,omitempty"`
 | 
			
		||||
	Templateid          string `json:"templateid,omitempty"`
 | 
			
		||||
	Templatename        string `json:"templatename,omitempty"`
 | 
			
		||||
	Userid              string `json:"userid,omitempty"`
 | 
			
		||||
	Username            string `json:"username,omitempty"`
 | 
			
		||||
	Vgpu                string `json:"vgpu,omitempty"`
 | 
			
		||||
	Zoneid              string `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename            string `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Deviceid     string `json:"deviceid,omitempty"`
 | 
			
		||||
	Gateway      string `json:"gateway,omitempty"`
 | 
			
		||||
	Id           string `json:"id,omitempty"`
 | 
			
		||||
	Ip6address   string `json:"ip6address,omitempty"`
 | 
			
		||||
	Ip6cidr      string `json:"ip6cidr,omitempty"`
 | 
			
		||||
	Ip6gateway   string `json:"ip6gateway,omitempty"`
 | 
			
		||||
	Ipaddress    string `json:"ipaddress,omitempty"`
 | 
			
		||||
	Isdefault    bool   `json:"isdefault,omitempty"`
 | 
			
		||||
	Isolationuri string `json:"isolationuri,omitempty"`
 | 
			
		||||
	Macaddress   string `json:"macaddress,omitempty"`
 | 
			
		||||
	Netmask      string `json:"netmask,omitempty"`
 | 
			
		||||
	Networkid    string `json:"networkid,omitempty"`
 | 
			
		||||
	Networkname  string `json:"networkname,omitempty"`
 | 
			
		||||
	Secondaryip  []struct {
 | 
			
		||||
		Id        string `json:"id,omitempty"`
 | 
			
		||||
		Ipaddress string `json:"ipaddress,omitempty"`
 | 
			
		||||
	} `json:"secondaryip,omitempty"`
 | 
			
		||||
	Traffictype      string `json:"traffictype,omitempty"`
 | 
			
		||||
	Type             string `json:"type,omitempty"`
 | 
			
		||||
	Virtualmachineid string `json:"virtualmachineid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										332
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NiciraNVPService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										332
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/NiciraNVPService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,332 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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["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) 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 {
 | 
			
		||||
	JobID                string `json:"jobid,omitempty"`
 | 
			
		||||
	Hostname             string `json:"hostname,omitempty"`
 | 
			
		||||
	L3gatewayserviceuuid string `json:"l3gatewayserviceuuid,omitempty"`
 | 
			
		||||
	Niciradevicename     string `json:"niciradevicename,omitempty"`
 | 
			
		||||
	Nvpdeviceid          string `json:"nvpdeviceid,omitempty"`
 | 
			
		||||
	Physicalnetworkid    string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Provider             string `json:"provider,omitempty"`
 | 
			
		||||
	Transportzoneuuid    string `json:"transportzoneuuid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	L3gatewayserviceuuid string `json:"l3gatewayserviceuuid,omitempty"`
 | 
			
		||||
	Niciradevicename     string `json:"niciradevicename,omitempty"`
 | 
			
		||||
	Nvpdeviceid          string `json:"nvpdeviceid,omitempty"`
 | 
			
		||||
	Physicalnetworkid    string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Provider             string `json:"provider,omitempty"`
 | 
			
		||||
	Transportzoneuuid    string `json:"transportzoneuuid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										268
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/OvsElementService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										268
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/OvsElementService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,268 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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) (*ConfigureOvsElementResponse, error) {
 | 
			
		||||
	resp, err := s.cs.newRequest("configureOvsElement", p.toURLValues())
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var r ConfigureOvsElementResponse
 | 
			
		||||
	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 ConfigureOvsElementResponse struct {
 | 
			
		||||
	JobID     string `json:"jobid,omitempty"`
 | 
			
		||||
	Account   string `json:"account,omitempty"`
 | 
			
		||||
	Domain    string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid  string `json:"domainid,omitempty"`
 | 
			
		||||
	Enabled   bool   `json:"enabled,omitempty"`
 | 
			
		||||
	Id        string `json:"id,omitempty"`
 | 
			
		||||
	Nspid     string `json:"nspid,omitempty"`
 | 
			
		||||
	Project   string `json:"project,omitempty"`
 | 
			
		||||
	Projectid string `json:"projectid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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,omitempty"`
 | 
			
		||||
	Domain    string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid  string `json:"domainid,omitempty"`
 | 
			
		||||
	Enabled   bool   `json:"enabled,omitempty"`
 | 
			
		||||
	Id        string `json:"id,omitempty"`
 | 
			
		||||
	Nspid     string `json:"nspid,omitempty"`
 | 
			
		||||
	Project   string `json:"project,omitempty"`
 | 
			
		||||
	Projectid string `json:"projectid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										882
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/PodService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										882
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/PodService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,882 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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,omitempty"`
 | 
			
		||||
	Capacity        []struct {
 | 
			
		||||
		Capacitytotal int64  `json:"capacitytotal,omitempty"`
 | 
			
		||||
		Capacityused  int64  `json:"capacityused,omitempty"`
 | 
			
		||||
		Clusterid     string `json:"clusterid,omitempty"`
 | 
			
		||||
		Clustername   string `json:"clustername,omitempty"`
 | 
			
		||||
		Percentused   string `json:"percentused,omitempty"`
 | 
			
		||||
		Podid         string `json:"podid,omitempty"`
 | 
			
		||||
		Podname       string `json:"podname,omitempty"`
 | 
			
		||||
		Type          int    `json:"type,omitempty"`
 | 
			
		||||
		Zoneid        string `json:"zoneid,omitempty"`
 | 
			
		||||
		Zonename      string `json:"zonename,omitempty"`
 | 
			
		||||
	} `json:"capacity,omitempty"`
 | 
			
		||||
	Endip    string `json:"endip,omitempty"`
 | 
			
		||||
	Gateway  string `json:"gateway,omitempty"`
 | 
			
		||||
	Id       string `json:"id,omitempty"`
 | 
			
		||||
	Name     string `json:"name,omitempty"`
 | 
			
		||||
	Netmask  string `json:"netmask,omitempty"`
 | 
			
		||||
	Startip  string `json:"startip,omitempty"`
 | 
			
		||||
	Zoneid   string `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename string `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Capacity        []struct {
 | 
			
		||||
		Capacitytotal int64  `json:"capacitytotal,omitempty"`
 | 
			
		||||
		Capacityused  int64  `json:"capacityused,omitempty"`
 | 
			
		||||
		Clusterid     string `json:"clusterid,omitempty"`
 | 
			
		||||
		Clustername   string `json:"clustername,omitempty"`
 | 
			
		||||
		Percentused   string `json:"percentused,omitempty"`
 | 
			
		||||
		Podid         string `json:"podid,omitempty"`
 | 
			
		||||
		Podname       string `json:"podname,omitempty"`
 | 
			
		||||
		Type          int    `json:"type,omitempty"`
 | 
			
		||||
		Zoneid        string `json:"zoneid,omitempty"`
 | 
			
		||||
		Zonename      string `json:"zonename,omitempty"`
 | 
			
		||||
	} `json:"capacity,omitempty"`
 | 
			
		||||
	Endip    string `json:"endip,omitempty"`
 | 
			
		||||
	Gateway  string `json:"gateway,omitempty"`
 | 
			
		||||
	Id       string `json:"id,omitempty"`
 | 
			
		||||
	Name     string `json:"name,omitempty"`
 | 
			
		||||
	Netmask  string `json:"netmask,omitempty"`
 | 
			
		||||
	Startip  string `json:"startip,omitempty"`
 | 
			
		||||
	Zoneid   string `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename string `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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 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,omitempty"`
 | 
			
		||||
	Capacity        []struct {
 | 
			
		||||
		Capacitytotal int64  `json:"capacitytotal,omitempty"`
 | 
			
		||||
		Capacityused  int64  `json:"capacityused,omitempty"`
 | 
			
		||||
		Clusterid     string `json:"clusterid,omitempty"`
 | 
			
		||||
		Clustername   string `json:"clustername,omitempty"`
 | 
			
		||||
		Percentused   string `json:"percentused,omitempty"`
 | 
			
		||||
		Podid         string `json:"podid,omitempty"`
 | 
			
		||||
		Podname       string `json:"podname,omitempty"`
 | 
			
		||||
		Type          int    `json:"type,omitempty"`
 | 
			
		||||
		Zoneid        string `json:"zoneid,omitempty"`
 | 
			
		||||
		Zonename      string `json:"zonename,omitempty"`
 | 
			
		||||
	} `json:"capacity,omitempty"`
 | 
			
		||||
	Endip    string `json:"endip,omitempty"`
 | 
			
		||||
	Gateway  string `json:"gateway,omitempty"`
 | 
			
		||||
	Id       string `json:"id,omitempty"`
 | 
			
		||||
	Name     string `json:"name,omitempty"`
 | 
			
		||||
	Netmask  string `json:"netmask,omitempty"`
 | 
			
		||||
	Startip  string `json:"startip,omitempty"`
 | 
			
		||||
	Zoneid   string `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename string `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID           string `json:"jobid,omitempty"`
 | 
			
		||||
	Accountid       string `json:"accountid,omitempty"`
 | 
			
		||||
	Affinitygroupid string `json:"affinitygroupid,omitempty"`
 | 
			
		||||
	Domainid        string `json:"domainid,omitempty"`
 | 
			
		||||
	Id              string `json:"id,omitempty"`
 | 
			
		||||
	Podid           string `json:"podid,omitempty"`
 | 
			
		||||
	Podname         string `json:"podname,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Affinitygroupid string `json:"affinitygroupid,omitempty"`
 | 
			
		||||
	Domainid        string `json:"domainid,omitempty"`
 | 
			
		||||
	Id              string `json:"id,omitempty"`
 | 
			
		||||
	Podid           string `json:"podid,omitempty"`
 | 
			
		||||
	Podname         string `json:"podname,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										800
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/PoolService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										800
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/PoolService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,800 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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 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 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 {
 | 
			
		||||
	Capacityiops         int64             `json:"capacityiops,omitempty"`
 | 
			
		||||
	Clusterid            string            `json:"clusterid,omitempty"`
 | 
			
		||||
	Clustername          string            `json:"clustername,omitempty"`
 | 
			
		||||
	Created              string            `json:"created,omitempty"`
 | 
			
		||||
	Disksizeallocated    int64             `json:"disksizeallocated,omitempty"`
 | 
			
		||||
	Disksizetotal        int64             `json:"disksizetotal,omitempty"`
 | 
			
		||||
	Disksizeused         int64             `json:"disksizeused,omitempty"`
 | 
			
		||||
	Hypervisor           string            `json:"hypervisor,omitempty"`
 | 
			
		||||
	Id                   string            `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress            string            `json:"ipaddress,omitempty"`
 | 
			
		||||
	Name                 string            `json:"name,omitempty"`
 | 
			
		||||
	Overprovisionfactor  string            `json:"overprovisionfactor,omitempty"`
 | 
			
		||||
	Path                 string            `json:"path,omitempty"`
 | 
			
		||||
	Podid                string            `json:"podid,omitempty"`
 | 
			
		||||
	Podname              string            `json:"podname,omitempty"`
 | 
			
		||||
	Scope                string            `json:"scope,omitempty"`
 | 
			
		||||
	State                string            `json:"state,omitempty"`
 | 
			
		||||
	Storagecapabilities  map[string]string `json:"storagecapabilities,omitempty"`
 | 
			
		||||
	Suitableformigration bool              `json:"suitableformigration,omitempty"`
 | 
			
		||||
	Tags                 string            `json:"tags,omitempty"`
 | 
			
		||||
	Type                 string            `json:"type,omitempty"`
 | 
			
		||||
	Zoneid               string            `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename             string            `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("details[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("details[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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 {
 | 
			
		||||
	Capacityiops         int64             `json:"capacityiops,omitempty"`
 | 
			
		||||
	Clusterid            string            `json:"clusterid,omitempty"`
 | 
			
		||||
	Clustername          string            `json:"clustername,omitempty"`
 | 
			
		||||
	Created              string            `json:"created,omitempty"`
 | 
			
		||||
	Disksizeallocated    int64             `json:"disksizeallocated,omitempty"`
 | 
			
		||||
	Disksizetotal        int64             `json:"disksizetotal,omitempty"`
 | 
			
		||||
	Disksizeused         int64             `json:"disksizeused,omitempty"`
 | 
			
		||||
	Hypervisor           string            `json:"hypervisor,omitempty"`
 | 
			
		||||
	Id                   string            `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress            string            `json:"ipaddress,omitempty"`
 | 
			
		||||
	Name                 string            `json:"name,omitempty"`
 | 
			
		||||
	Overprovisionfactor  string            `json:"overprovisionfactor,omitempty"`
 | 
			
		||||
	Path                 string            `json:"path,omitempty"`
 | 
			
		||||
	Podid                string            `json:"podid,omitempty"`
 | 
			
		||||
	Podname              string            `json:"podname,omitempty"`
 | 
			
		||||
	Scope                string            `json:"scope,omitempty"`
 | 
			
		||||
	State                string            `json:"state,omitempty"`
 | 
			
		||||
	Storagecapabilities  map[string]string `json:"storagecapabilities,omitempty"`
 | 
			
		||||
	Suitableformigration bool              `json:"suitableformigration,omitempty"`
 | 
			
		||||
	Tags                 string            `json:"tags,omitempty"`
 | 
			
		||||
	Type                 string            `json:"type,omitempty"`
 | 
			
		||||
	Zoneid               string            `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename             string            `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	Capacityiops         int64             `json:"capacityiops,omitempty"`
 | 
			
		||||
	Clusterid            string            `json:"clusterid,omitempty"`
 | 
			
		||||
	Clustername          string            `json:"clustername,omitempty"`
 | 
			
		||||
	Created              string            `json:"created,omitempty"`
 | 
			
		||||
	Disksizeallocated    int64             `json:"disksizeallocated,omitempty"`
 | 
			
		||||
	Disksizetotal        int64             `json:"disksizetotal,omitempty"`
 | 
			
		||||
	Disksizeused         int64             `json:"disksizeused,omitempty"`
 | 
			
		||||
	Hypervisor           string            `json:"hypervisor,omitempty"`
 | 
			
		||||
	Id                   string            `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress            string            `json:"ipaddress,omitempty"`
 | 
			
		||||
	Name                 string            `json:"name,omitempty"`
 | 
			
		||||
	Overprovisionfactor  string            `json:"overprovisionfactor,omitempty"`
 | 
			
		||||
	Path                 string            `json:"path,omitempty"`
 | 
			
		||||
	Podid                string            `json:"podid,omitempty"`
 | 
			
		||||
	Podname              string            `json:"podname,omitempty"`
 | 
			
		||||
	Scope                string            `json:"scope,omitempty"`
 | 
			
		||||
	State                string            `json:"state,omitempty"`
 | 
			
		||||
	Storagecapabilities  map[string]string `json:"storagecapabilities,omitempty"`
 | 
			
		||||
	Suitableformigration bool              `json:"suitableformigration,omitempty"`
 | 
			
		||||
	Tags                 string            `json:"tags,omitempty"`
 | 
			
		||||
	Type                 string            `json:"type,omitempty"`
 | 
			
		||||
	Zoneid               string            `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename             string            `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	Capacityiops         int64             `json:"capacityiops,omitempty"`
 | 
			
		||||
	Clusterid            string            `json:"clusterid,omitempty"`
 | 
			
		||||
	Clustername          string            `json:"clustername,omitempty"`
 | 
			
		||||
	Created              string            `json:"created,omitempty"`
 | 
			
		||||
	Disksizeallocated    int64             `json:"disksizeallocated,omitempty"`
 | 
			
		||||
	Disksizetotal        int64             `json:"disksizetotal,omitempty"`
 | 
			
		||||
	Disksizeused         int64             `json:"disksizeused,omitempty"`
 | 
			
		||||
	Hypervisor           string            `json:"hypervisor,omitempty"`
 | 
			
		||||
	Id                   string            `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress            string            `json:"ipaddress,omitempty"`
 | 
			
		||||
	Name                 string            `json:"name,omitempty"`
 | 
			
		||||
	Overprovisionfactor  string            `json:"overprovisionfactor,omitempty"`
 | 
			
		||||
	Path                 string            `json:"path,omitempty"`
 | 
			
		||||
	Podid                string            `json:"podid,omitempty"`
 | 
			
		||||
	Podname              string            `json:"podname,omitempty"`
 | 
			
		||||
	Scope                string            `json:"scope,omitempty"`
 | 
			
		||||
	State                string            `json:"state,omitempty"`
 | 
			
		||||
	Storagecapabilities  map[string]string `json:"storagecapabilities,omitempty"`
 | 
			
		||||
	Suitableformigration bool              `json:"suitableformigration,omitempty"`
 | 
			
		||||
	Tags                 string            `json:"tags,omitempty"`
 | 
			
		||||
	Type                 string            `json:"type,omitempty"`
 | 
			
		||||
	Zoneid               string            `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename             string            `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										393
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/PortableIPService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										393
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/PortableIPService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,393 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 {
 | 
			
		||||
	JobID             string `json:"jobid,omitempty"`
 | 
			
		||||
	Endip             string `json:"endip,omitempty"`
 | 
			
		||||
	Gateway           string `json:"gateway,omitempty"`
 | 
			
		||||
	Id                string `json:"id,omitempty"`
 | 
			
		||||
	Netmask           string `json:"netmask,omitempty"`
 | 
			
		||||
	Portableipaddress []struct {
 | 
			
		||||
		Accountid         string `json:"accountid,omitempty"`
 | 
			
		||||
		Allocated         string `json:"allocated,omitempty"`
 | 
			
		||||
		Domainid          string `json:"domainid,omitempty"`
 | 
			
		||||
		Ipaddress         string `json:"ipaddress,omitempty"`
 | 
			
		||||
		Networkid         string `json:"networkid,omitempty"`
 | 
			
		||||
		Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
		Regionid          int    `json:"regionid,omitempty"`
 | 
			
		||||
		State             string `json:"state,omitempty"`
 | 
			
		||||
		Vpcid             string `json:"vpcid,omitempty"`
 | 
			
		||||
		Zoneid            string `json:"zoneid,omitempty"`
 | 
			
		||||
	} `json:"portableipaddress,omitempty"`
 | 
			
		||||
	Regionid int    `json:"regionid,omitempty"`
 | 
			
		||||
	Startip  string `json:"startip,omitempty"`
 | 
			
		||||
	Vlan     string `json:"vlan,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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,omitempty"`
 | 
			
		||||
	Gateway           string `json:"gateway,omitempty"`
 | 
			
		||||
	Id                string `json:"id,omitempty"`
 | 
			
		||||
	Netmask           string `json:"netmask,omitempty"`
 | 
			
		||||
	Portableipaddress []struct {
 | 
			
		||||
		Accountid         string `json:"accountid,omitempty"`
 | 
			
		||||
		Allocated         string `json:"allocated,omitempty"`
 | 
			
		||||
		Domainid          string `json:"domainid,omitempty"`
 | 
			
		||||
		Ipaddress         string `json:"ipaddress,omitempty"`
 | 
			
		||||
		Networkid         string `json:"networkid,omitempty"`
 | 
			
		||||
		Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
		Regionid          int    `json:"regionid,omitempty"`
 | 
			
		||||
		State             string `json:"state,omitempty"`
 | 
			
		||||
		Vpcid             string `json:"vpcid,omitempty"`
 | 
			
		||||
		Zoneid            string `json:"zoneid,omitempty"`
 | 
			
		||||
	} `json:"portableipaddress,omitempty"`
 | 
			
		||||
	Regionid int    `json:"regionid,omitempty"`
 | 
			
		||||
	Startip  string `json:"startip,omitempty"`
 | 
			
		||||
	Vlan     string `json:"vlan,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1341
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ProjectService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1341
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ProjectService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										60
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/QuotaService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/QuotaService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										336
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/RegionService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										336
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/RegionService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,336 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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,omitempty"`
 | 
			
		||||
	Gslbserviceenabled       bool   `json:"gslbserviceenabled,omitempty"`
 | 
			
		||||
	Id                       int    `json:"id,omitempty"`
 | 
			
		||||
	Name                     string `json:"name,omitempty"`
 | 
			
		||||
	Portableipserviceenabled bool   `json:"portableipserviceenabled,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Gslbserviceenabled       bool   `json:"gslbserviceenabled,omitempty"`
 | 
			
		||||
	Id                       int    `json:"id,omitempty"`
 | 
			
		||||
	Name                     string `json:"name,omitempty"`
 | 
			
		||||
	Portableipserviceenabled bool   `json:"portableipserviceenabled,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Gslbserviceenabled       bool   `json:"gslbserviceenabled,omitempty"`
 | 
			
		||||
	Id                       int    `json:"id,omitempty"`
 | 
			
		||||
	Name                     string `json:"name,omitempty"`
 | 
			
		||||
	Portableipserviceenabled bool   `json:"portableipserviceenabled,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										423
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ResourcemetadataService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										423
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ResourcemetadataService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,423 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("details[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("details[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Customer     string `json:"customer,omitempty"`
 | 
			
		||||
	Domain       string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
	Key          string `json:"key,omitempty"`
 | 
			
		||||
	Project      string `json:"project,omitempty"`
 | 
			
		||||
	Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
	Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
	Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
	Value        string `json:"value,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										544
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ResourcetagsService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										544
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ResourcetagsService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,544 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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 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,omitempty"`
 | 
			
		||||
	Name   string `json:"name,omitempty"`
 | 
			
		||||
	Poolid int64  `json:"poolid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("tags[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("tags[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("tags[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("tags[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Customer     string `json:"customer,omitempty"`
 | 
			
		||||
	Domain       string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
	Key          string `json:"key,omitempty"`
 | 
			
		||||
	Project      string `json:"project,omitempty"`
 | 
			
		||||
	Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
	Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
	Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
	Value        string `json:"value,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1457
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/RouterService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1457
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/RouterService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										746
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SSHService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										746
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SSHService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,746 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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 {
 | 
			
		||||
	JobID         string `json:"jobid,omitempty"`
 | 
			
		||||
	Account       string `json:"account,omitempty"`
 | 
			
		||||
	Affinitygroup []struct {
 | 
			
		||||
		Account           string   `json:"account,omitempty"`
 | 
			
		||||
		Description       string   `json:"description,omitempty"`
 | 
			
		||||
		Domain            string   `json:"domain,omitempty"`
 | 
			
		||||
		Domainid          string   `json:"domainid,omitempty"`
 | 
			
		||||
		Id                string   `json:"id,omitempty"`
 | 
			
		||||
		Name              string   `json:"name,omitempty"`
 | 
			
		||||
		Project           string   `json:"project,omitempty"`
 | 
			
		||||
		Projectid         string   `json:"projectid,omitempty"`
 | 
			
		||||
		Type              string   `json:"type,omitempty"`
 | 
			
		||||
		VirtualmachineIds []string `json:"virtualmachineIds,omitempty"`
 | 
			
		||||
	} `json:"affinitygroup,omitempty"`
 | 
			
		||||
	Cpunumber             int               `json:"cpunumber,omitempty"`
 | 
			
		||||
	Cpuspeed              int               `json:"cpuspeed,omitempty"`
 | 
			
		||||
	Cpuused               string            `json:"cpuused,omitempty"`
 | 
			
		||||
	Created               string            `json:"created,omitempty"`
 | 
			
		||||
	Details               map[string]string `json:"details,omitempty"`
 | 
			
		||||
	Diskioread            int64             `json:"diskioread,omitempty"`
 | 
			
		||||
	Diskiowrite           int64             `json:"diskiowrite,omitempty"`
 | 
			
		||||
	Diskkbsread           int64             `json:"diskkbsread,omitempty"`
 | 
			
		||||
	Diskkbswrite          int64             `json:"diskkbswrite,omitempty"`
 | 
			
		||||
	Diskofferingid        string            `json:"diskofferingid,omitempty"`
 | 
			
		||||
	Diskofferingname      string            `json:"diskofferingname,omitempty"`
 | 
			
		||||
	Displayname           string            `json:"displayname,omitempty"`
 | 
			
		||||
	Displayvm             bool              `json:"displayvm,omitempty"`
 | 
			
		||||
	Domain                string            `json:"domain,omitempty"`
 | 
			
		||||
	Domainid              string            `json:"domainid,omitempty"`
 | 
			
		||||
	Forvirtualnetwork     bool              `json:"forvirtualnetwork,omitempty"`
 | 
			
		||||
	Group                 string            `json:"group,omitempty"`
 | 
			
		||||
	Groupid               string            `json:"groupid,omitempty"`
 | 
			
		||||
	Guestosid             string            `json:"guestosid,omitempty"`
 | 
			
		||||
	Haenable              bool              `json:"haenable,omitempty"`
 | 
			
		||||
	Hostid                string            `json:"hostid,omitempty"`
 | 
			
		||||
	Hostname              string            `json:"hostname,omitempty"`
 | 
			
		||||
	Hypervisor            string            `json:"hypervisor,omitempty"`
 | 
			
		||||
	Id                    string            `json:"id,omitempty"`
 | 
			
		||||
	Instancename          string            `json:"instancename,omitempty"`
 | 
			
		||||
	Isdynamicallyscalable bool              `json:"isdynamicallyscalable,omitempty"`
 | 
			
		||||
	Isodisplaytext        string            `json:"isodisplaytext,omitempty"`
 | 
			
		||||
	Isoid                 string            `json:"isoid,omitempty"`
 | 
			
		||||
	Isoname               string            `json:"isoname,omitempty"`
 | 
			
		||||
	Keypair               string            `json:"keypair,omitempty"`
 | 
			
		||||
	Memory                int               `json:"memory,omitempty"`
 | 
			
		||||
	Name                  string            `json:"name,omitempty"`
 | 
			
		||||
	Networkkbsread        int64             `json:"networkkbsread,omitempty"`
 | 
			
		||||
	Networkkbswrite       int64             `json:"networkkbswrite,omitempty"`
 | 
			
		||||
	Nic                   []struct {
 | 
			
		||||
		Broadcasturi string `json:"broadcasturi,omitempty"`
 | 
			
		||||
		Deviceid     string `json:"deviceid,omitempty"`
 | 
			
		||||
		Gateway      string `json:"gateway,omitempty"`
 | 
			
		||||
		Id           string `json:"id,omitempty"`
 | 
			
		||||
		Ip6address   string `json:"ip6address,omitempty"`
 | 
			
		||||
		Ip6cidr      string `json:"ip6cidr,omitempty"`
 | 
			
		||||
		Ip6gateway   string `json:"ip6gateway,omitempty"`
 | 
			
		||||
		Ipaddress    string `json:"ipaddress,omitempty"`
 | 
			
		||||
		Isdefault    bool   `json:"isdefault,omitempty"`
 | 
			
		||||
		Isolationuri string `json:"isolationuri,omitempty"`
 | 
			
		||||
		Macaddress   string `json:"macaddress,omitempty"`
 | 
			
		||||
		Netmask      string `json:"netmask,omitempty"`
 | 
			
		||||
		Networkid    string `json:"networkid,omitempty"`
 | 
			
		||||
		Networkname  string `json:"networkname,omitempty"`
 | 
			
		||||
		Secondaryip  []struct {
 | 
			
		||||
			Id        string `json:"id,omitempty"`
 | 
			
		||||
			Ipaddress string `json:"ipaddress,omitempty"`
 | 
			
		||||
		} `json:"secondaryip,omitempty"`
 | 
			
		||||
		Traffictype      string `json:"traffictype,omitempty"`
 | 
			
		||||
		Type             string `json:"type,omitempty"`
 | 
			
		||||
		Virtualmachineid string `json:"virtualmachineid,omitempty"`
 | 
			
		||||
	} `json:"nic,omitempty"`
 | 
			
		||||
	Ostypeid        int64  `json:"ostypeid,omitempty"`
 | 
			
		||||
	Password        string `json:"password,omitempty"`
 | 
			
		||||
	Passwordenabled bool   `json:"passwordenabled,omitempty"`
 | 
			
		||||
	Project         string `json:"project,omitempty"`
 | 
			
		||||
	Projectid       string `json:"projectid,omitempty"`
 | 
			
		||||
	Publicip        string `json:"publicip,omitempty"`
 | 
			
		||||
	Publicipid      string `json:"publicipid,omitempty"`
 | 
			
		||||
	Rootdeviceid    int64  `json:"rootdeviceid,omitempty"`
 | 
			
		||||
	Rootdevicetype  string `json:"rootdevicetype,omitempty"`
 | 
			
		||||
	Securitygroup   []struct {
 | 
			
		||||
		Account     string `json:"account,omitempty"`
 | 
			
		||||
		Description string `json:"description,omitempty"`
 | 
			
		||||
		Domain      string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid    string `json:"domainid,omitempty"`
 | 
			
		||||
		Egressrule  []struct {
 | 
			
		||||
			Account           string `json:"account,omitempty"`
 | 
			
		||||
			Cidr              string `json:"cidr,omitempty"`
 | 
			
		||||
			Endport           int    `json:"endport,omitempty"`
 | 
			
		||||
			Icmpcode          int    `json:"icmpcode,omitempty"`
 | 
			
		||||
			Icmptype          int    `json:"icmptype,omitempty"`
 | 
			
		||||
			Protocol          string `json:"protocol,omitempty"`
 | 
			
		||||
			Ruleid            string `json:"ruleid,omitempty"`
 | 
			
		||||
			Securitygroupname string `json:"securitygroupname,omitempty"`
 | 
			
		||||
			Startport         int    `json:"startport,omitempty"`
 | 
			
		||||
			Tags              []struct {
 | 
			
		||||
				Account      string `json:"account,omitempty"`
 | 
			
		||||
				Customer     string `json:"customer,omitempty"`
 | 
			
		||||
				Domain       string `json:"domain,omitempty"`
 | 
			
		||||
				Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
				Key          string `json:"key,omitempty"`
 | 
			
		||||
				Project      string `json:"project,omitempty"`
 | 
			
		||||
				Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
				Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
				Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
				Value        string `json:"value,omitempty"`
 | 
			
		||||
			} `json:"tags,omitempty"`
 | 
			
		||||
		} `json:"egressrule,omitempty"`
 | 
			
		||||
		Id          string `json:"id,omitempty"`
 | 
			
		||||
		Ingressrule []struct {
 | 
			
		||||
			Account           string `json:"account,omitempty"`
 | 
			
		||||
			Cidr              string `json:"cidr,omitempty"`
 | 
			
		||||
			Endport           int    `json:"endport,omitempty"`
 | 
			
		||||
			Icmpcode          int    `json:"icmpcode,omitempty"`
 | 
			
		||||
			Icmptype          int    `json:"icmptype,omitempty"`
 | 
			
		||||
			Protocol          string `json:"protocol,omitempty"`
 | 
			
		||||
			Ruleid            string `json:"ruleid,omitempty"`
 | 
			
		||||
			Securitygroupname string `json:"securitygroupname,omitempty"`
 | 
			
		||||
			Startport         int    `json:"startport,omitempty"`
 | 
			
		||||
			Tags              []struct {
 | 
			
		||||
				Account      string `json:"account,omitempty"`
 | 
			
		||||
				Customer     string `json:"customer,omitempty"`
 | 
			
		||||
				Domain       string `json:"domain,omitempty"`
 | 
			
		||||
				Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
				Key          string `json:"key,omitempty"`
 | 
			
		||||
				Project      string `json:"project,omitempty"`
 | 
			
		||||
				Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
				Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
				Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
				Value        string `json:"value,omitempty"`
 | 
			
		||||
			} `json:"tags,omitempty"`
 | 
			
		||||
		} `json:"ingressrule,omitempty"`
 | 
			
		||||
		Name      string `json:"name,omitempty"`
 | 
			
		||||
		Project   string `json:"project,omitempty"`
 | 
			
		||||
		Projectid string `json:"projectid,omitempty"`
 | 
			
		||||
		Tags      []struct {
 | 
			
		||||
			Account      string `json:"account,omitempty"`
 | 
			
		||||
			Customer     string `json:"customer,omitempty"`
 | 
			
		||||
			Domain       string `json:"domain,omitempty"`
 | 
			
		||||
			Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
			Key          string `json:"key,omitempty"`
 | 
			
		||||
			Project      string `json:"project,omitempty"`
 | 
			
		||||
			Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
			Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
			Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
			Value        string `json:"value,omitempty"`
 | 
			
		||||
		} `json:"tags,omitempty"`
 | 
			
		||||
		Virtualmachinecount int      `json:"virtualmachinecount,omitempty"`
 | 
			
		||||
		Virtualmachineids   []string `json:"virtualmachineids,omitempty"`
 | 
			
		||||
	} `json:"securitygroup,omitempty"`
 | 
			
		||||
	Serviceofferingid   string `json:"serviceofferingid,omitempty"`
 | 
			
		||||
	Serviceofferingname string `json:"serviceofferingname,omitempty"`
 | 
			
		||||
	Servicestate        string `json:"servicestate,omitempty"`
 | 
			
		||||
	State               string `json:"state,omitempty"`
 | 
			
		||||
	Tags                []struct {
 | 
			
		||||
		Account      string `json:"account,omitempty"`
 | 
			
		||||
		Customer     string `json:"customer,omitempty"`
 | 
			
		||||
		Domain       string `json:"domain,omitempty"`
 | 
			
		||||
		Domainid     string `json:"domainid,omitempty"`
 | 
			
		||||
		Key          string `json:"key,omitempty"`
 | 
			
		||||
		Project      string `json:"project,omitempty"`
 | 
			
		||||
		Projectid    string `json:"projectid,omitempty"`
 | 
			
		||||
		Resourceid   string `json:"resourceid,omitempty"`
 | 
			
		||||
		Resourcetype string `json:"resourcetype,omitempty"`
 | 
			
		||||
		Value        string `json:"value,omitempty"`
 | 
			
		||||
	} `json:"tags,omitempty"`
 | 
			
		||||
	Templatedisplaytext string `json:"templatedisplaytext,omitempty"`
 | 
			
		||||
	Templateid          string `json:"templateid,omitempty"`
 | 
			
		||||
	Templatename        string `json:"templatename,omitempty"`
 | 
			
		||||
	Userid              string `json:"userid,omitempty"`
 | 
			
		||||
	Username            string `json:"username,omitempty"`
 | 
			
		||||
	Vgpu                string `json:"vgpu,omitempty"`
 | 
			
		||||
	Zoneid              string `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename            string `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Domain      string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid    string `json:"domainid,omitempty"`
 | 
			
		||||
	Fingerprint string `json:"fingerprint,omitempty"`
 | 
			
		||||
	Name        string `json:"name,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	Privatekey string `json:"privatekey,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Domain      string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid    string `json:"domainid,omitempty"`
 | 
			
		||||
	Fingerprint string `json:"fingerprint,omitempty"`
 | 
			
		||||
	Name        string `json:"name,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1190
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SecurityGroupService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1190
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SecurityGroupService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										853
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ServiceOfferingService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										853
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ServiceOfferingService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,853 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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["byteswriterate"]; found {
 | 
			
		||||
		vv := strconv.FormatInt(v.(int64), 10)
 | 
			
		||||
		u.Set("byteswriterate", 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["iopswriterate"]; found {
 | 
			
		||||
		vv := strconv.FormatInt(v.(int64), 10)
 | 
			
		||||
		u.Set("iopswriterate", 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 {
 | 
			
		||||
		i := 0
 | 
			
		||||
		for k, vv := range v.(map[string]string) {
 | 
			
		||||
			u.Set(fmt.Sprintf("serviceofferingdetails[%d].key", i), k)
 | 
			
		||||
			u.Set(fmt.Sprintf("serviceofferingdetails[%d].value", i), vv)
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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) SetByteswriterate(v int64) {
 | 
			
		||||
	if p.p == nil {
 | 
			
		||||
		p.p = make(map[string]interface{})
 | 
			
		||||
	}
 | 
			
		||||
	p.p["byteswriterate"] = 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) SetIopswriterate(v int64) {
 | 
			
		||||
	if p.p == nil {
 | 
			
		||||
		p.p = make(map[string]interface{})
 | 
			
		||||
	}
 | 
			
		||||
	p.p["iopswriterate"] = 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,omitempty"`
 | 
			
		||||
	Cpuspeed                  int               `json:"cpuspeed,omitempty"`
 | 
			
		||||
	Created                   string            `json:"created,omitempty"`
 | 
			
		||||
	Defaultuse                bool              `json:"defaultuse,omitempty"`
 | 
			
		||||
	Deploymentplanner         string            `json:"deploymentplanner,omitempty"`
 | 
			
		||||
	DiskBytesReadRate         int64             `json:"diskBytesReadRate,omitempty"`
 | 
			
		||||
	DiskBytesWriteRate        int64             `json:"diskBytesWriteRate,omitempty"`
 | 
			
		||||
	DiskIopsReadRate          int64             `json:"diskIopsReadRate,omitempty"`
 | 
			
		||||
	DiskIopsWriteRate         int64             `json:"diskIopsWriteRate,omitempty"`
 | 
			
		||||
	Displaytext               string            `json:"displaytext,omitempty"`
 | 
			
		||||
	Domain                    string            `json:"domain,omitempty"`
 | 
			
		||||
	Domainid                  string            `json:"domainid,omitempty"`
 | 
			
		||||
	Hosttags                  string            `json:"hosttags,omitempty"`
 | 
			
		||||
	Hypervisorsnapshotreserve int               `json:"hypervisorsnapshotreserve,omitempty"`
 | 
			
		||||
	Id                        string            `json:"id,omitempty"`
 | 
			
		||||
	Iscustomized              bool              `json:"iscustomized,omitempty"`
 | 
			
		||||
	Iscustomizediops          bool              `json:"iscustomizediops,omitempty"`
 | 
			
		||||
	Issystem                  bool              `json:"issystem,omitempty"`
 | 
			
		||||
	Isvolatile                bool              `json:"isvolatile,omitempty"`
 | 
			
		||||
	Limitcpuuse               bool              `json:"limitcpuuse,omitempty"`
 | 
			
		||||
	Maxiops                   int64             `json:"maxiops,omitempty"`
 | 
			
		||||
	Memory                    int               `json:"memory,omitempty"`
 | 
			
		||||
	Miniops                   int64             `json:"miniops,omitempty"`
 | 
			
		||||
	Name                      string            `json:"name,omitempty"`
 | 
			
		||||
	Networkrate               int               `json:"networkrate,omitempty"`
 | 
			
		||||
	Offerha                   bool              `json:"offerha,omitempty"`
 | 
			
		||||
	Provisioningtype          string            `json:"provisioningtype,omitempty"`
 | 
			
		||||
	Serviceofferingdetails    map[string]string `json:"serviceofferingdetails,omitempty"`
 | 
			
		||||
	Storagetype               string            `json:"storagetype,omitempty"`
 | 
			
		||||
	Systemvmtype              string            `json:"systemvmtype,omitempty"`
 | 
			
		||||
	Tags                      string            `json:"tags,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Cpuspeed                  int               `json:"cpuspeed,omitempty"`
 | 
			
		||||
	Created                   string            `json:"created,omitempty"`
 | 
			
		||||
	Defaultuse                bool              `json:"defaultuse,omitempty"`
 | 
			
		||||
	Deploymentplanner         string            `json:"deploymentplanner,omitempty"`
 | 
			
		||||
	DiskBytesReadRate         int64             `json:"diskBytesReadRate,omitempty"`
 | 
			
		||||
	DiskBytesWriteRate        int64             `json:"diskBytesWriteRate,omitempty"`
 | 
			
		||||
	DiskIopsReadRate          int64             `json:"diskIopsReadRate,omitempty"`
 | 
			
		||||
	DiskIopsWriteRate         int64             `json:"diskIopsWriteRate,omitempty"`
 | 
			
		||||
	Displaytext               string            `json:"displaytext,omitempty"`
 | 
			
		||||
	Domain                    string            `json:"domain,omitempty"`
 | 
			
		||||
	Domainid                  string            `json:"domainid,omitempty"`
 | 
			
		||||
	Hosttags                  string            `json:"hosttags,omitempty"`
 | 
			
		||||
	Hypervisorsnapshotreserve int               `json:"hypervisorsnapshotreserve,omitempty"`
 | 
			
		||||
	Id                        string            `json:"id,omitempty"`
 | 
			
		||||
	Iscustomized              bool              `json:"iscustomized,omitempty"`
 | 
			
		||||
	Iscustomizediops          bool              `json:"iscustomizediops,omitempty"`
 | 
			
		||||
	Issystem                  bool              `json:"issystem,omitempty"`
 | 
			
		||||
	Isvolatile                bool              `json:"isvolatile,omitempty"`
 | 
			
		||||
	Limitcpuuse               bool              `json:"limitcpuuse,omitempty"`
 | 
			
		||||
	Maxiops                   int64             `json:"maxiops,omitempty"`
 | 
			
		||||
	Memory                    int               `json:"memory,omitempty"`
 | 
			
		||||
	Miniops                   int64             `json:"miniops,omitempty"`
 | 
			
		||||
	Name                      string            `json:"name,omitempty"`
 | 
			
		||||
	Networkrate               int               `json:"networkrate,omitempty"`
 | 
			
		||||
	Offerha                   bool              `json:"offerha,omitempty"`
 | 
			
		||||
	Provisioningtype          string            `json:"provisioningtype,omitempty"`
 | 
			
		||||
	Serviceofferingdetails    map[string]string `json:"serviceofferingdetails,omitempty"`
 | 
			
		||||
	Storagetype               string            `json:"storagetype,omitempty"`
 | 
			
		||||
	Systemvmtype              string            `json:"systemvmtype,omitempty"`
 | 
			
		||||
	Tags                      string            `json:"tags,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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 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,omitempty"`
 | 
			
		||||
	Cpuspeed                  int               `json:"cpuspeed,omitempty"`
 | 
			
		||||
	Created                   string            `json:"created,omitempty"`
 | 
			
		||||
	Defaultuse                bool              `json:"defaultuse,omitempty"`
 | 
			
		||||
	Deploymentplanner         string            `json:"deploymentplanner,omitempty"`
 | 
			
		||||
	DiskBytesReadRate         int64             `json:"diskBytesReadRate,omitempty"`
 | 
			
		||||
	DiskBytesWriteRate        int64             `json:"diskBytesWriteRate,omitempty"`
 | 
			
		||||
	DiskIopsReadRate          int64             `json:"diskIopsReadRate,omitempty"`
 | 
			
		||||
	DiskIopsWriteRate         int64             `json:"diskIopsWriteRate,omitempty"`
 | 
			
		||||
	Displaytext               string            `json:"displaytext,omitempty"`
 | 
			
		||||
	Domain                    string            `json:"domain,omitempty"`
 | 
			
		||||
	Domainid                  string            `json:"domainid,omitempty"`
 | 
			
		||||
	Hosttags                  string            `json:"hosttags,omitempty"`
 | 
			
		||||
	Hypervisorsnapshotreserve int               `json:"hypervisorsnapshotreserve,omitempty"`
 | 
			
		||||
	Id                        string            `json:"id,omitempty"`
 | 
			
		||||
	Iscustomized              bool              `json:"iscustomized,omitempty"`
 | 
			
		||||
	Iscustomizediops          bool              `json:"iscustomizediops,omitempty"`
 | 
			
		||||
	Issystem                  bool              `json:"issystem,omitempty"`
 | 
			
		||||
	Isvolatile                bool              `json:"isvolatile,omitempty"`
 | 
			
		||||
	Limitcpuuse               bool              `json:"limitcpuuse,omitempty"`
 | 
			
		||||
	Maxiops                   int64             `json:"maxiops,omitempty"`
 | 
			
		||||
	Memory                    int               `json:"memory,omitempty"`
 | 
			
		||||
	Miniops                   int64             `json:"miniops,omitempty"`
 | 
			
		||||
	Name                      string            `json:"name,omitempty"`
 | 
			
		||||
	Networkrate               int               `json:"networkrate,omitempty"`
 | 
			
		||||
	Offerha                   bool              `json:"offerha,omitempty"`
 | 
			
		||||
	Provisioningtype          string            `json:"provisioningtype,omitempty"`
 | 
			
		||||
	Serviceofferingdetails    map[string]string `json:"serviceofferingdetails,omitempty"`
 | 
			
		||||
	Storagetype               string            `json:"storagetype,omitempty"`
 | 
			
		||||
	Systemvmtype              string            `json:"systemvmtype,omitempty"`
 | 
			
		||||
	Tags                      string            `json:"tags,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1793
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SnapshotService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1793
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SnapshotService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										300
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/StoragePoolService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										300
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/StoragePoolService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,300 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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["storagePoolType"] = 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["storagePoolType"] = 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 {
 | 
			
		||||
	Name string `json:"name,omitempty"`
 | 
			
		||||
	Type string `json:"type,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID                string            `json:"jobid,omitempty"`
 | 
			
		||||
	Capacityiops         int64             `json:"capacityiops,omitempty"`
 | 
			
		||||
	Clusterid            string            `json:"clusterid,omitempty"`
 | 
			
		||||
	Clustername          string            `json:"clustername,omitempty"`
 | 
			
		||||
	Created              string            `json:"created,omitempty"`
 | 
			
		||||
	Disksizeallocated    int64             `json:"disksizeallocated,omitempty"`
 | 
			
		||||
	Disksizetotal        int64             `json:"disksizetotal,omitempty"`
 | 
			
		||||
	Disksizeused         int64             `json:"disksizeused,omitempty"`
 | 
			
		||||
	Hypervisor           string            `json:"hypervisor,omitempty"`
 | 
			
		||||
	Id                   string            `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress            string            `json:"ipaddress,omitempty"`
 | 
			
		||||
	Name                 string            `json:"name,omitempty"`
 | 
			
		||||
	Overprovisionfactor  string            `json:"overprovisionfactor,omitempty"`
 | 
			
		||||
	Path                 string            `json:"path,omitempty"`
 | 
			
		||||
	Podid                string            `json:"podid,omitempty"`
 | 
			
		||||
	Podname              string            `json:"podname,omitempty"`
 | 
			
		||||
	Scope                string            `json:"scope,omitempty"`
 | 
			
		||||
	State                string            `json:"state,omitempty"`
 | 
			
		||||
	Storagecapabilities  map[string]string `json:"storagecapabilities,omitempty"`
 | 
			
		||||
	Suitableformigration bool              `json:"suitableformigration,omitempty"`
 | 
			
		||||
	Tags                 string            `json:"tags,omitempty"`
 | 
			
		||||
	Type                 string            `json:"type,omitempty"`
 | 
			
		||||
	Zoneid               string            `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename             string            `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID                string            `json:"jobid,omitempty"`
 | 
			
		||||
	Capacityiops         int64             `json:"capacityiops,omitempty"`
 | 
			
		||||
	Clusterid            string            `json:"clusterid,omitempty"`
 | 
			
		||||
	Clustername          string            `json:"clustername,omitempty"`
 | 
			
		||||
	Created              string            `json:"created,omitempty"`
 | 
			
		||||
	Disksizeallocated    int64             `json:"disksizeallocated,omitempty"`
 | 
			
		||||
	Disksizetotal        int64             `json:"disksizetotal,omitempty"`
 | 
			
		||||
	Disksizeused         int64             `json:"disksizeused,omitempty"`
 | 
			
		||||
	Hypervisor           string            `json:"hypervisor,omitempty"`
 | 
			
		||||
	Id                   string            `json:"id,omitempty"`
 | 
			
		||||
	Ipaddress            string            `json:"ipaddress,omitempty"`
 | 
			
		||||
	Name                 string            `json:"name,omitempty"`
 | 
			
		||||
	Overprovisionfactor  string            `json:"overprovisionfactor,omitempty"`
 | 
			
		||||
	Path                 string            `json:"path,omitempty"`
 | 
			
		||||
	Podid                string            `json:"podid,omitempty"`
 | 
			
		||||
	Podname              string            `json:"podname,omitempty"`
 | 
			
		||||
	Scope                string            `json:"scope,omitempty"`
 | 
			
		||||
	State                string            `json:"state,omitempty"`
 | 
			
		||||
	Storagecapabilities  map[string]string `json:"storagecapabilities,omitempty"`
 | 
			
		||||
	Suitableformigration bool              `json:"suitableformigration,omitempty"`
 | 
			
		||||
	Tags                 string            `json:"tags,omitempty"`
 | 
			
		||||
	Type                 string            `json:"type,omitempty"`
 | 
			
		||||
	Zoneid               string            `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename             string            `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										132
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/StratosphereSSPService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/StratosphereSSPService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,132 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 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,omitempty"`
 | 
			
		||||
	Name   string `json:"name,omitempty"`
 | 
			
		||||
	Url    string `json:"url,omitempty"`
 | 
			
		||||
	Zoneid string `json:"zoneid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										249
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SwiftService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										249
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SwiftService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,249 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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 {
 | 
			
		||||
	Details      []string `json:"details,omitempty"`
 | 
			
		||||
	Id           string   `json:"id,omitempty"`
 | 
			
		||||
	Name         string   `json:"name,omitempty"`
 | 
			
		||||
	Protocol     string   `json:"protocol,omitempty"`
 | 
			
		||||
	Providername string   `json:"providername,omitempty"`
 | 
			
		||||
	Scope        string   `json:"scope,omitempty"`
 | 
			
		||||
	Url          string   `json:"url,omitempty"`
 | 
			
		||||
	Zoneid       string   `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename     string   `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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 {
 | 
			
		||||
	Details      []string `json:"details,omitempty"`
 | 
			
		||||
	Id           string   `json:"id,omitempty"`
 | 
			
		||||
	Name         string   `json:"name,omitempty"`
 | 
			
		||||
	Protocol     string   `json:"protocol,omitempty"`
 | 
			
		||||
	Providername string   `json:"providername,omitempty"`
 | 
			
		||||
	Scope        string   `json:"scope,omitempty"`
 | 
			
		||||
	Url          string   `json:"url,omitempty"`
 | 
			
		||||
	Zoneid       string   `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename     string   `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										178
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SystemCapacityService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										178
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SystemCapacityService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,178 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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["systemCapacityType"] = 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 {
 | 
			
		||||
	Capacitytotal int64  `json:"capacitytotal,omitempty"`
 | 
			
		||||
	Capacityused  int64  `json:"capacityused,omitempty"`
 | 
			
		||||
	Clusterid     string `json:"clusterid,omitempty"`
 | 
			
		||||
	Clustername   string `json:"clustername,omitempty"`
 | 
			
		||||
	Percentused   string `json:"percentused,omitempty"`
 | 
			
		||||
	Podid         string `json:"podid,omitempty"`
 | 
			
		||||
	Podname       string `json:"podname,omitempty"`
 | 
			
		||||
	Type          int    `json:"type,omitempty"`
 | 
			
		||||
	Zoneid        string `json:"zoneid,omitempty"`
 | 
			
		||||
	Zonename      string `json:"zonename,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1046
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SystemVMService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1046
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/SystemVMService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2318
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/TemplateService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2318
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/TemplateService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										594
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/UCSService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										594
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/UCSService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,594 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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,omitempty"`
 | 
			
		||||
	Name   string `json:"name,omitempty"`
 | 
			
		||||
	Url    string `json:"url,omitempty"`
 | 
			
		||||
	Zoneid string `json:"zoneid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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 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,omitempty"`
 | 
			
		||||
	Name   string `json:"name,omitempty"`
 | 
			
		||||
	Url    string `json:"url,omitempty"`
 | 
			
		||||
	Zoneid string `json:"zoneid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	Ucsdn string `json:"ucsdn,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Hostid       string `json:"hostid,omitempty"`
 | 
			
		||||
	Id           string `json:"id,omitempty"`
 | 
			
		||||
	Profiledn    string `json:"profiledn,omitempty"`
 | 
			
		||||
	Ucsmanagerid string `json:"ucsmanagerid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID        string `json:"jobid,omitempty"`
 | 
			
		||||
	Bladedn      string `json:"bladedn,omitempty"`
 | 
			
		||||
	Hostid       string `json:"hostid,omitempty"`
 | 
			
		||||
	Id           string `json:"id,omitempty"`
 | 
			
		||||
	Profiledn    string `json:"profiledn,omitempty"`
 | 
			
		||||
	Ucsmanagerid string `json:"ucsmanagerid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1213
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/UsageService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1213
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/UsageService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1239
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/UserService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1239
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/UserService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										934
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VLANService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										934
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VLANService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,934 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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["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) 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,omitempty"`
 | 
			
		||||
	Description       string `json:"description,omitempty"`
 | 
			
		||||
	Domain            string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid          string `json:"domainid,omitempty"`
 | 
			
		||||
	Endip             string `json:"endip,omitempty"`
 | 
			
		||||
	Endipv6           string `json:"endipv6,omitempty"`
 | 
			
		||||
	Forvirtualnetwork bool   `json:"forvirtualnetwork,omitempty"`
 | 
			
		||||
	Gateway           string `json:"gateway,omitempty"`
 | 
			
		||||
	Id                string `json:"id,omitempty"`
 | 
			
		||||
	Ip6cidr           string `json:"ip6cidr,omitempty"`
 | 
			
		||||
	Ip6gateway        string `json:"ip6gateway,omitempty"`
 | 
			
		||||
	Netmask           string `json:"netmask,omitempty"`
 | 
			
		||||
	Networkid         string `json:"networkid,omitempty"`
 | 
			
		||||
	Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Podid             string `json:"podid,omitempty"`
 | 
			
		||||
	Podname           string `json:"podname,omitempty"`
 | 
			
		||||
	Project           string `json:"project,omitempty"`
 | 
			
		||||
	Projectid         string `json:"projectid,omitempty"`
 | 
			
		||||
	Startip           string `json:"startip,omitempty"`
 | 
			
		||||
	Startipv6         string `json:"startipv6,omitempty"`
 | 
			
		||||
	Vlan              string `json:"vlan,omitempty"`
 | 
			
		||||
	Zoneid            string `json:"zoneid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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,omitempty"`
 | 
			
		||||
	Description       string `json:"description,omitempty"`
 | 
			
		||||
	Domain            string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid          string `json:"domainid,omitempty"`
 | 
			
		||||
	Endip             string `json:"endip,omitempty"`
 | 
			
		||||
	Endipv6           string `json:"endipv6,omitempty"`
 | 
			
		||||
	Forvirtualnetwork bool   `json:"forvirtualnetwork,omitempty"`
 | 
			
		||||
	Gateway           string `json:"gateway,omitempty"`
 | 
			
		||||
	Id                string `json:"id,omitempty"`
 | 
			
		||||
	Ip6cidr           string `json:"ip6cidr,omitempty"`
 | 
			
		||||
	Ip6gateway        string `json:"ip6gateway,omitempty"`
 | 
			
		||||
	Netmask           string `json:"netmask,omitempty"`
 | 
			
		||||
	Networkid         string `json:"networkid,omitempty"`
 | 
			
		||||
	Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Podid             string `json:"podid,omitempty"`
 | 
			
		||||
	Podname           string `json:"podname,omitempty"`
 | 
			
		||||
	Project           string `json:"project,omitempty"`
 | 
			
		||||
	Projectid         string `json:"projectid,omitempty"`
 | 
			
		||||
	Startip           string `json:"startip,omitempty"`
 | 
			
		||||
	Startipv6         string `json:"startipv6,omitempty"`
 | 
			
		||||
	Vlan              string `json:"vlan,omitempty"`
 | 
			
		||||
	Zoneid            string `json:"zoneid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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(account string, domainid string, physicalnetworkid string, vlanrange string) *DedicateGuestVlanRangeParams {
 | 
			
		||||
	p := &DedicateGuestVlanRangeParams{}
 | 
			
		||||
	p.p = make(map[string]interface{})
 | 
			
		||||
	p.p["account"] = account
 | 
			
		||||
	p.p["domainid"] = domainid
 | 
			
		||||
	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,omitempty"`
 | 
			
		||||
	Domain            string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid          string `json:"domainid,omitempty"`
 | 
			
		||||
	Guestvlanrange    string `json:"guestvlanrange,omitempty"`
 | 
			
		||||
	Id                string `json:"id,omitempty"`
 | 
			
		||||
	Physicalnetworkid int64  `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Project           string `json:"project,omitempty"`
 | 
			
		||||
	Projectid         string `json:"projectid,omitempty"`
 | 
			
		||||
	Zoneid            int64  `json:"zoneid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
	JobID       string `json:"jobid,omitempty"`
 | 
			
		||||
	Displaytext string `json:"displaytext,omitempty"`
 | 
			
		||||
	Success     bool   `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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,omitempty"`
 | 
			
		||||
	Domain            string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid          string `json:"domainid,omitempty"`
 | 
			
		||||
	Guestvlanrange    string `json:"guestvlanrange,omitempty"`
 | 
			
		||||
	Id                string `json:"id,omitempty"`
 | 
			
		||||
	Physicalnetworkid int64  `json:"physicalnetworkid,omitempty"`
 | 
			
		||||
	Project           string `json:"project,omitempty"`
 | 
			
		||||
	Projectid         string `json:"projectid,omitempty"`
 | 
			
		||||
	Zoneid            int64  `json:"zoneid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										481
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VMGroupService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										481
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VMGroupService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,481 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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,omitempty"`
 | 
			
		||||
	Created   string `json:"created,omitempty"`
 | 
			
		||||
	Domain    string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid  string `json:"domainid,omitempty"`
 | 
			
		||||
	Id        string `json:"id,omitempty"`
 | 
			
		||||
	Name      string `json:"name,omitempty"`
 | 
			
		||||
	Project   string `json:"project,omitempty"`
 | 
			
		||||
	Projectid string `json:"projectid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Success     string `json:"success,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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,omitempty"`
 | 
			
		||||
	Created   string `json:"created,omitempty"`
 | 
			
		||||
	Domain    string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid  string `json:"domainid,omitempty"`
 | 
			
		||||
	Id        string `json:"id,omitempty"`
 | 
			
		||||
	Name      string `json:"name,omitempty"`
 | 
			
		||||
	Project   string `json:"project,omitempty"`
 | 
			
		||||
	Projectid string `json:"projectid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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 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,omitempty"`
 | 
			
		||||
	Created   string `json:"created,omitempty"`
 | 
			
		||||
	Domain    string `json:"domain,omitempty"`
 | 
			
		||||
	Domainid  string `json:"domainid,omitempty"`
 | 
			
		||||
	Id        string `json:"id,omitempty"`
 | 
			
		||||
	Name      string `json:"name,omitempty"`
 | 
			
		||||
	Project   string `json:"project,omitempty"`
 | 
			
		||||
	Projectid string `json:"projectid,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2843
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VPCService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2843
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VPCService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2874
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VPNService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2874
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VPNService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										5445
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VirtualMachineService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5445
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VirtualMachineService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2275
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VolumeService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2275
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/VolumeService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1167
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ZoneService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1167
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/ZoneService.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										936
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/cloudstack.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										936
									
								
								vendor/github.com/xanzy/go-cloudstack/cloudstack/cloudstack.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,936 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2016, 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/http"
 | 
			
		||||
	"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)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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
 | 
			
		||||
	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
 | 
			
		||||
	Certificate      *CertificateService
 | 
			
		||||
	CloudIdentifier  *CloudIdentifierService
 | 
			
		||||
	Cluster          *ClusterService
 | 
			
		||||
	Configuration    *ConfigurationService
 | 
			
		||||
	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
 | 
			
		||||
	OvsElement       *OvsElementService
 | 
			
		||||
	Pod              *PodService
 | 
			
		||||
	Pool             *PoolService
 | 
			
		||||
	PortableIP       *PortableIPService
 | 
			
		||||
	Project          *ProjectService
 | 
			
		||||
	Quota            *QuotaService
 | 
			
		||||
	Region           *RegionService
 | 
			
		||||
	Resourcemetadata *ResourcemetadataService
 | 
			
		||||
	Resourcetags     *ResourcetagsService
 | 
			
		||||
	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) *CloudStackClient {
 | 
			
		||||
	cs := &CloudStackClient{
 | 
			
		||||
		client: &http.Client{
 | 
			
		||||
			Transport: &http.Transport{
 | 
			
		||||
				Proxy:           http.ProxyFromEnvironment,
 | 
			
		||||
				TLSClientConfig: &tls.Config{InsecureSkipVerify: !verifyssl}, // If verifyssl is true, skipping the verify should be false and vice versa
 | 
			
		||||
			},
 | 
			
		||||
			Timeout: time.Duration(60 * time.Second),
 | 
			
		||||
		},
 | 
			
		||||
		baseURL: apiurl,
 | 
			
		||||
		apiKey:  apikey,
 | 
			
		||||
		secret:  secret,
 | 
			
		||||
		async:   async,
 | 
			
		||||
		timeout: 300,
 | 
			
		||||
	}
 | 
			
		||||
	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.Certificate = NewCertificateService(cs)
 | 
			
		||||
	cs.CloudIdentifier = NewCloudIdentifierService(cs)
 | 
			
		||||
	cs.Cluster = NewClusterService(cs)
 | 
			
		||||
	cs.Configuration = NewConfigurationService(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.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.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) *CloudStackClient {
 | 
			
		||||
	cs := newClient(apiurl, apikey, secret, false, verifyssl)
 | 
			
		||||
	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) *CloudStackClient {
 | 
			
		||||
	cs := newClient(apiurl, apikey, secret, true, verifyssl)
 | 
			
		||||
	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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 == "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))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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 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 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 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}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user