diff --git a/gpl-3.0.txt b/gpl-3.0.txt
index 30ace6a..bb4435f 100644
--- a/gpl-3.0.txt
+++ b/gpl-3.0.txt
@@ -1,674 +1,674 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- {one line to give the program's name and a brief idea of what it does.}
- Copyright (C) {year} {name of author}
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- {project} Copyright (C) {year} {fullname}
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ {one line to give the program's name and a brief idea of what it does.}
+ Copyright (C) {year} {name of author}
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ {project} Copyright (C) {year} {fullname}
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
.
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 914e3aa..ea09684 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
it.corsinvest.proxmoxve.api
cv4pve-api-java
- 2.1.0
+ 2.1.1
jar
cv4pve-api-java
Corsinvest for Proxmox VE Client API JAVA
diff --git a/src/main/java/it/corsinvest/proxmoxve/api/PveClient.java b/src/main/java/it/corsinvest/proxmoxve/api/PveClient.java
index e7f8195..359e38c 100644
--- a/src/main/java/it/corsinvest/proxmoxve/api/PveClient.java
+++ b/src/main/java/it/corsinvest/proxmoxve/api/PveClient.java
@@ -1,25388 +1,26289 @@
-/*
- * This file is part of the cv4pve-api-java https://github.com/Corsinvest/cv4pve-api-java,
- *
- * This source file is available under two different licenses:
- * - GNU General Public License version 3 (GPLv3)
- * - Corsinvest Enterprise License (CEL)
- * Full copyright and license information is available in
- * LICENSE.md which is distributed with this source code.
- *
- * Copyright (C) 2016 Corsinvest Srl GPLv3 and CEL
- */
-package it.corsinvest.proxmoxve.api;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.json.JSONException;
-
-/**
- * Proxmox VE Client
- */
-public class PveClient extends PveClientBase {
-
- private final PveClient _client;
-
- public PveClient(String hostname, int port) {
- super(hostname, port);
- _client = this;
- }
-
- private PVECluster _cluster;
-
- public PVECluster getCluster() {
- if (_cluster == null) {
- _cluster = new PVECluster(_client);
- }
-
- return _cluster;
- }
- private PVENodes _nodes;
-
- public PVENodes getNodes() {
- if (_nodes == null) {
- _nodes = new PVENodes(_client);
- }
-
- return _nodes;
- }
- private PVEStorage _storage;
-
- public PVEStorage getStorage() {
- if (_storage == null) {
- _storage = new PVEStorage(_client);
- }
-
- return _storage;
- }
- private PVEAccess _access;
-
- public PVEAccess getAccess() {
- if (_access == null) {
- _access = new PVEAccess(_client);
- }
-
- return _access;
- }
- private PVEPools _pools;
-
- public PVEPools getPools() {
- if (_pools == null) {
- _pools = new PVEPools(_client);
- }
-
- return _pools;
- }
- private PVEVersion _version;
-
- public PVEVersion getVersion() {
- if (_version == null) {
- _version = new PVEVersion(_client);
- }
-
- return _version;
- }
-
- public class PVECluster {
-
- private final PveClient _client;
-
- protected PVECluster(PveClient client) {
- _client = client;
-
- }
-
- private PVEReplication _replication;
-
- public PVEReplication getReplication() {
- if (_replication == null) {
- _replication = new PVEReplication(_client);
- }
-
- return _replication;
- }
- private PVEConfig _config;
-
- public PVEConfig getConfig() {
- if (_config == null) {
- _config = new PVEConfig(_client);
- }
-
- return _config;
- }
- private PVEFirewall _firewall;
-
- public PVEFirewall getFirewall() {
- if (_firewall == null) {
- _firewall = new PVEFirewall(_client);
- }
-
- return _firewall;
- }
- private PVEBackup _backup;
-
- public PVEBackup getBackup() {
- if (_backup == null) {
- _backup = new PVEBackup(_client);
- }
-
- return _backup;
- }
- private PVEHa _ha;
-
- public PVEHa getHa() {
- if (_ha == null) {
- _ha = new PVEHa(_client);
- }
-
- return _ha;
- }
- private PVEAcme _acme;
-
- public PVEAcme getAcme() {
- if (_acme == null) {
- _acme = new PVEAcme(_client);
- }
-
- return _acme;
- }
- private PVELog _log;
-
- public PVELog getLog() {
- if (_log == null) {
- _log = new PVELog(_client);
- }
-
- return _log;
- }
- private PVEResources _resources;
-
- public PVEResources getResources() {
- if (_resources == null) {
- _resources = new PVEResources(_client);
- }
-
- return _resources;
- }
- private PVETasks _tasks;
-
- public PVETasks getTasks() {
- if (_tasks == null) {
- _tasks = new PVETasks(_client);
- }
-
- return _tasks;
- }
- private PVEOptions _options;
-
- public PVEOptions getOptions() {
- if (_options == null) {
- _options = new PVEOptions(_client);
- }
-
- return _options;
- }
- private PVEStatus _status;
-
- public PVEStatus getStatus() {
- if (_status == null) {
- _status = new PVEStatus(_client);
- }
-
- return _status;
- }
- private PVENextid _nextid;
-
- public PVENextid getNextid() {
- if (_nextid == null) {
- _nextid = new PVENextid(_client);
- }
-
- return _nextid;
- }
- private PVECeph _ceph;
-
- public PVECeph getCeph() {
- if (_ceph == null) {
- _ceph = new PVECeph(_client);
- }
-
- return _ceph;
- }
-
- public class PVEReplication {
-
- private final PveClient _client;
-
- protected PVEReplication(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemId get(Object id) {
- return new PVEItemId(_client, id);
- }
-
- public class PVEItemId {
-
- private final PveClient _client;
- private final Object _id;
-
- protected PVEItemId(PveClient client, Object id) {
- _client = client;
- _id = id;
- }
-
- /**
- * Mark replication job for removal.
- *
- * @param force Will remove the jobconfig entry, but will not
- * cleanup.
- * @param keep Keep replicated data at target (do not remove).
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(Boolean force, Boolean keep) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("force", force);
- parameters.put("keep", keep);
- return _client.delete("/cluster/replication/" + _id + "", parameters);
- }
-
- /**
- * Mark replication job for removal.
- *
- * @param force Will remove the jobconfig entry, but will not
- * cleanup.
- * @param keep Keep replicated data at target (do not remove).
- * @return Result
- * @throws JSONException
- */
- public Result delete(Boolean force, Boolean keep) throws JSONException {
- return deleteRest(force, keep);
- }
-
- /**
- * Mark replication job for removal.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/replication/" + _id + "", null);
- }
-
- /**
- * Mark replication job for removal.
- *
- * @return Result
- * @throws JSONException
- */
- public Result delete() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Read replication job configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/replication/" + _id + "", null);
- }
-
- /**
- * Read replication job configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result read() throws JSONException {
- return getRest();
- }
-
- /**
- * Update replication job configuration.
- *
- * @param comment Description.
- * @param delete A list of settings you want to delete.
- * @param digest Prevent changes if current configuration file
- * has different SHA1 digest. This can be used to prevent
- * concurrent modifications.
- * @param disable Flag to disable/deactivate the entry.
- * @param rate Rate limit in mbps (megabytes per second) as
- * floating point number.
- * @param remove_job Mark the replication job for removal. The
- * job will remove all local replication snapshots. When set to
- * 'full', it also tries to remove replicated volumes on the
- * target. The job then removes itself from the configuration
- * file. Enum: local,full
- * @param schedule Storage replication schedule. The format is a
- * subset of `systemd` calender events.
- * @param source Source of the replication.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String comment, String delete, String digest, Boolean disable, Integer rate, String remove_job, String schedule, String source) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("comment", comment);
- parameters.put("delete", delete);
- parameters.put("digest", digest);
- parameters.put("disable", disable);
- parameters.put("rate", rate);
- parameters.put("remove_job", remove_job);
- parameters.put("schedule", schedule);
- parameters.put("source", source);
- return _client.set("/cluster/replication/" + _id + "", parameters);
- }
-
- /**
- * Update replication job configuration.
- *
- * @param comment Description.
- * @param delete A list of settings you want to delete.
- * @param digest Prevent changes if current configuration file
- * has different SHA1 digest. This can be used to prevent
- * concurrent modifications.
- * @param disable Flag to disable/deactivate the entry.
- * @param rate Rate limit in mbps (megabytes per second) as
- * floating point number.
- * @param remove_job Mark the replication job for removal. The
- * job will remove all local replication snapshots. When set to
- * 'full', it also tries to remove replicated volumes on the
- * target. The job then removes itself from the configuration
- * file. Enum: local,full
- * @param schedule Storage replication schedule. The format is a
- * subset of `systemd` calender events.
- * @param source Source of the replication.
- * @return Result
- * @throws JSONException
- */
- public Result update(String comment, String delete, String digest, Boolean disable, Integer rate, String remove_job, String schedule, String source) throws JSONException {
- return setRest(comment, delete, digest, disable, rate, remove_job, schedule, source);
- }
-
- /**
- * Update replication job configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/cluster/replication/" + _id + "", null);
- }
-
- /**
- * Update replication job configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result update() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * List replication jobs.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/replication", null);
- }
-
- /**
- * List replication jobs.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- /**
- * Create a new replication job
- *
- * @param id Replication Job ID. The ID is composed of a Guest ID
- * and a job number, separated by a hyphen, i.e.
- * '<GUEST>-<JOBNUM>'.
- * @param target Target node.
- * @param type Section type. Enum: local
- * @param comment Description.
- * @param disable Flag to disable/deactivate the entry.
- * @param rate Rate limit in mbps (megabytes per second) as floating
- * point number.
- * @param remove_job Mark the replication job for removal. The job
- * will remove all local replication snapshots. When set to 'full',
- * it also tries to remove replicated volumes on the target. The job
- * then removes itself from the configuration file. Enum: local,full
- * @param schedule Storage replication schedule. The format is a
- * subset of `systemd` calender events.
- * @param source Source of the replication.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String id, String target, String type, String comment, Boolean disable, Integer rate, String remove_job, String schedule, String source) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("id", id);
- parameters.put("target", target);
- parameters.put("type", type);
- parameters.put("comment", comment);
- parameters.put("disable", disable);
- parameters.put("rate", rate);
- parameters.put("remove_job", remove_job);
- parameters.put("schedule", schedule);
- parameters.put("source", source);
- return _client.create("/cluster/replication", parameters);
- }
-
- /**
- * Create a new replication job
- *
- * @param id Replication Job ID. The ID is composed of a Guest ID
- * and a job number, separated by a hyphen, i.e.
- * '<GUEST>-<JOBNUM>'.
- * @param target Target node.
- * @param type Section type. Enum: local
- * @param comment Description.
- * @param disable Flag to disable/deactivate the entry.
- * @param rate Rate limit in mbps (megabytes per second) as floating
- * point number.
- * @param remove_job Mark the replication job for removal. The job
- * will remove all local replication snapshots. When set to 'full',
- * it also tries to remove replicated volumes on the target. The job
- * then removes itself from the configuration file. Enum: local,full
- * @param schedule Storage replication schedule. The format is a
- * subset of `systemd` calender events.
- * @param source Source of the replication.
- * @return Result
- * @throws JSONException
- */
- public Result create(String id, String target, String type, String comment, Boolean disable, Integer rate, String remove_job, String schedule, String source) throws JSONException {
- return createRest(id, target, type, comment, disable, rate, remove_job, schedule, source);
- }
-
- /**
- * Create a new replication job
- *
- * @param id Replication Job ID. The ID is composed of a Guest ID
- * and a job number, separated by a hyphen, i.e.
- * '<GUEST>-<JOBNUM>'.
- * @param target Target node.
- * @param type Section type. Enum: local
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String id, String target, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("id", id);
- parameters.put("target", target);
- parameters.put("type", type);
- return _client.create("/cluster/replication", parameters);
- }
-
- /**
- * Create a new replication job
- *
- * @param id Replication Job ID. The ID is composed of a Guest ID
- * and a job number, separated by a hyphen, i.e.
- * '<GUEST>-<JOBNUM>'.
- * @param target Target node.
- * @param type Section type. Enum: local
- * @return Result
- * @throws JSONException
- */
- public Result create(String id, String target, String type) throws JSONException {
- return createRest(id, target, type);
- }
-
- }
-
- public class PVEConfig {
-
- private final PveClient _client;
-
- protected PVEConfig(PveClient client) {
- _client = client;
-
- }
-
- private PVENodes _nodes;
-
- public PVENodes getNodes() {
- if (_nodes == null) {
- _nodes = new PVENodes(_client);
- }
-
- return _nodes;
- }
- private PVEJoin _join;
-
- public PVEJoin getJoin() {
- if (_join == null) {
- _join = new PVEJoin(_client);
- }
-
- return _join;
- }
- private PVETotem _totem;
-
- public PVETotem getTotem() {
- if (_totem == null) {
- _totem = new PVETotem(_client);
- }
-
- return _totem;
- }
- private PVEQdevice _qdevice;
-
- public PVEQdevice getQdevice() {
- if (_qdevice == null) {
- _qdevice = new PVEQdevice(_client);
- }
-
- return _qdevice;
- }
-
- public class PVENodes {
-
- private final PveClient _client;
-
- protected PVENodes(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemNode get(Object node) {
- return new PVEItemNode(_client, node);
- }
-
- public class PVEItemNode {
-
- private final PveClient _client;
- private final Object _node;
-
- protected PVEItemNode(PveClient client, Object node) {
- _client = client;
- _node = node;
- }
-
- /**
- * Removes a node from the cluster configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/config/nodes/" + _node + "", null);
- }
-
- /**
- * Removes a node from the cluster configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result delnode() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Adds a node to the cluster configuration. This call is
- * for internal use.
- *
- * @param force Do not throw error if node already exists.
- * @param linkN Address and priority information of a single
- * corosync link.
- * @param nodeid Node id for this node.
- * @param votes Number of votes for this node
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean force, Map linkN, Integer nodeid, Integer votes) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("force", force);
- parameters.put("nodeid", nodeid);
- parameters.put("votes", votes);
- addIndexedParameter(parameters, "link", linkN);
- return _client.create("/cluster/config/nodes/" + _node + "", parameters);
- }
-
- /**
- * Adds a node to the cluster configuration. This call is
- * for internal use.
- *
- * @param force Do not throw error if node already exists.
- * @param linkN Address and priority information of a single
- * corosync link.
- * @param nodeid Node id for this node.
- * @param votes Number of votes for this node
- * @return Result
- * @throws JSONException
- */
- public Result addnode(Boolean force, Map linkN, Integer nodeid, Integer votes) throws JSONException {
- return createRest(force, linkN, nodeid, votes);
- }
-
- /**
- * Adds a node to the cluster configuration. This call is
- * for internal use.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/cluster/config/nodes/" + _node + "", null);
- }
-
- /**
- * Adds a node to the cluster configuration. This call is
- * for internal use.
- *
- * @return Result
- * @throws JSONException
- */
- public Result addnode() throws JSONException {
- return createRest();
- }
-
- }
-
- /**
- * Corosync node list.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/config/nodes", null);
- }
-
- /**
- * Corosync node list.
- *
- * @return Result
- * @throws JSONException
- */
- public Result nodes() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEJoin {
-
- private final PveClient _client;
-
- protected PVEJoin(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get information needed to join this cluster over the
- * connected node.
- *
- * @param node The node for which the joinee gets the nodeinfo.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String node) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("node", node);
- return _client.get("/cluster/config/join", parameters);
- }
-
- /**
- * Get information needed to join this cluster over the
- * connected node.
- *
- * @param node The node for which the joinee gets the nodeinfo.
- * @return Result
- * @throws JSONException
- */
- public Result joinInfo(String node) throws JSONException {
- return getRest(node);
- }
-
- /**
- * Get information needed to join this cluster over the
- * connected node.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/config/join", null);
- }
-
- /**
- * Get information needed to join this cluster over the
- * connected node.
- *
- * @return Result
- * @throws JSONException
- */
- public Result joinInfo() throws JSONException {
- return getRest();
- }
-
- /**
- * Joins this node into an existing cluster.
- *
- * @param fingerprint Certificate SHA 256 fingerprint.
- * @param hostname Hostname (or IP) of an existing cluster
- * member.
- * @param password Superuser (root) password of peer node.
- * @param force Do not throw error if node already exists.
- * @param linkN Address and priority information of a single
- * corosync link.
- * @param nodeid Node id for this node.
- * @param votes Number of votes for this node
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String fingerprint, String hostname, String password, Boolean force, Map linkN, Integer nodeid, Integer votes) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("fingerprint", fingerprint);
- parameters.put("hostname", hostname);
- parameters.put("password", password);
- parameters.put("force", force);
- parameters.put("nodeid", nodeid);
- parameters.put("votes", votes);
- addIndexedParameter(parameters, "link", linkN);
- return _client.create("/cluster/config/join", parameters);
- }
-
- /**
- * Joins this node into an existing cluster.
- *
- * @param fingerprint Certificate SHA 256 fingerprint.
- * @param hostname Hostname (or IP) of an existing cluster
- * member.
- * @param password Superuser (root) password of peer node.
- * @param force Do not throw error if node already exists.
- * @param linkN Address and priority information of a single
- * corosync link.
- * @param nodeid Node id for this node.
- * @param votes Number of votes for this node
- * @return Result
- * @throws JSONException
- */
- public Result join(String fingerprint, String hostname, String password, Boolean force, Map linkN, Integer nodeid, Integer votes) throws JSONException {
- return createRest(fingerprint, hostname, password, force, linkN, nodeid, votes);
- }
-
- /**
- * Joins this node into an existing cluster.
- *
- * @param fingerprint Certificate SHA 256 fingerprint.
- * @param hostname Hostname (or IP) of an existing cluster
- * member.
- * @param password Superuser (root) password of peer node.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String fingerprint, String hostname, String password) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("fingerprint", fingerprint);
- parameters.put("hostname", hostname);
- parameters.put("password", password);
- return _client.create("/cluster/config/join", parameters);
- }
-
- /**
- * Joins this node into an existing cluster.
- *
- * @param fingerprint Certificate SHA 256 fingerprint.
- * @param hostname Hostname (or IP) of an existing cluster
- * member.
- * @param password Superuser (root) password of peer node.
- * @return Result
- * @throws JSONException
- */
- public Result join(String fingerprint, String hostname, String password) throws JSONException {
- return createRest(fingerprint, hostname, password);
- }
-
- }
-
- public class PVETotem {
-
- private final PveClient _client;
-
- protected PVETotem(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get corosync totem protocol settings.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/config/totem", null);
- }
-
- /**
- * Get corosync totem protocol settings.
- *
- * @return Result
- * @throws JSONException
- */
- public Result totem() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEQdevice {
-
- private final PveClient _client;
-
- protected PVEQdevice(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get QDevice status
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/config/qdevice", null);
- }
-
- /**
- * Get QDevice status
- *
- * @return Result
- * @throws JSONException
- */
- public Result status() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/config", null);
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- /**
- * Generate new cluster configuration.
- *
- * @param clustername The name of the cluster.
- * @param linkN Address and priority information of a single
- * corosync link.
- * @param nodeid Node id for this node.
- * @param votes Number of votes for this node.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String clustername, Map linkN, Integer nodeid, Integer votes) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("clustername", clustername);
- parameters.put("nodeid", nodeid);
- parameters.put("votes", votes);
- addIndexedParameter(parameters, "link", linkN);
- return _client.create("/cluster/config", parameters);
- }
-
- /**
- * Generate new cluster configuration.
- *
- * @param clustername The name of the cluster.
- * @param linkN Address and priority information of a single
- * corosync link.
- * @param nodeid Node id for this node.
- * @param votes Number of votes for this node.
- * @return Result
- * @throws JSONException
- */
- public Result create(String clustername, Map linkN, Integer nodeid, Integer votes) throws JSONException {
- return createRest(clustername, linkN, nodeid, votes);
- }
-
- /**
- * Generate new cluster configuration.
- *
- * @param clustername The name of the cluster.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String clustername) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("clustername", clustername);
- return _client.create("/cluster/config", parameters);
- }
-
- /**
- * Generate new cluster configuration.
- *
- * @param clustername The name of the cluster.
- * @return Result
- * @throws JSONException
- */
- public Result create(String clustername) throws JSONException {
- return createRest(clustername);
- }
-
- }
-
- public class PVEFirewall {
-
- private final PveClient _client;
-
- protected PVEFirewall(PveClient client) {
- _client = client;
-
- }
-
- private PVEGroups _groups;
-
- public PVEGroups getGroups() {
- if (_groups == null) {
- _groups = new PVEGroups(_client);
- }
-
- return _groups;
- }
- private PVERules _rules;
-
- public PVERules getRules() {
- if (_rules == null) {
- _rules = new PVERules(_client);
- }
-
- return _rules;
- }
- private PVEIpset _ipset;
-
- public PVEIpset getIpset() {
- if (_ipset == null) {
- _ipset = new PVEIpset(_client);
- }
-
- return _ipset;
- }
- private PVEAliases _aliases;
-
- public PVEAliases getAliases() {
- if (_aliases == null) {
- _aliases = new PVEAliases(_client);
- }
-
- return _aliases;
- }
- private PVEOptions _options;
-
- public PVEOptions getOptions() {
- if (_options == null) {
- _options = new PVEOptions(_client);
- }
-
- return _options;
- }
- private PVEMacros _macros;
-
- public PVEMacros getMacros() {
- if (_macros == null) {
- _macros = new PVEMacros(_client);
- }
-
- return _macros;
- }
- private PVERefs _refs;
-
- public PVERefs getRefs() {
- if (_refs == null) {
- _refs = new PVERefs(_client);
- }
-
- return _refs;
- }
-
- public class PVEGroups {
-
- private final PveClient _client;
-
- protected PVEGroups(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemGroup get(Object group) {
- return new PVEItemGroup(_client, group);
- }
-
- public class PVEItemGroup {
-
- private final PveClient _client;
- private final Object _group;
-
- protected PVEItemGroup(PveClient client, Object group) {
- _client = client;
- _group = group;
- }
-
- public PVEItemPos get(Object pos) {
- return new PVEItemPos(_client, _group, pos);
- }
-
- public class PVEItemPos {
-
- private final PveClient _client;
- private final Object _group;
- private final Object _pos;
-
- protected PVEItemPos(PveClient client, Object group, Object pos) {
- _client = client;
- _group = group;
- _pos = pos;
- }
-
- /**
- * Delete rule.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("digest", digest);
- return _client.delete("/cluster/firewall/groups/" + _group + "/" + _pos + "", parameters);
- }
-
- /**
- * Delete rule.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRule(String digest) throws JSONException {
- return deleteRest(digest);
- }
-
- /**
- * Delete rule.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/firewall/groups/" + _group + "/" + _pos + "", null);
- }
-
- /**
- * Delete rule.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRule() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Get single rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/groups/" + _group + "/" + _pos + "", null);
- }
-
- /**
- * Get single rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRule() throws JSONException {
- return getRest();
- }
-
- /**
- * Modify rule data.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param comment Descriptive comment.
- * @param delete A list of settings you want to delete.
- * @param dest Restrict packet destination address. This
- * can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP addresses
- * and networks (entries are separated by comma). Please
- * do not mix IPv4 and IPv6 addresses inside such lists.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param dport Restrict TCP/UDP destination port. You
- * can use service names or simple numbers (0-65535), as
- * defined in '/etc/services'. Port ranges can be
- * specified with '\d+:\d+', for example '80:85', and
- * you can use comma separated list to match several
- * ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to use
- * network configuration key names for VMs and
- * containers ('net\d+'). Host related rules can use
- * arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param moveto Move rule to new position
- * <moveto>. Other arguments are ignored.
- * @param proto IP protocol. You can use protocol names
- * ('tcp'/'udp') or simple numbers, as defined in
- * '/etc/protocols'.
- * @param source Restrict packet source address. This
- * can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP addresses
- * and networks (entries are separated by comma). Please
- * do not mix IPv4 and IPv6 addresses inside such lists.
- * @param sport Restrict TCP/UDP source port. You can
- * use service names or simple numbers (0-65535), as
- * defined in '/etc/services'. Port ranges can be
- * specified with '\d+:\d+', for example '80:85', and
- * you can use comma separated list to match several
- * ports or ranges.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("comment", comment);
- parameters.put("delete", delete);
- parameters.put("dest", dest);
- parameters.put("digest", digest);
- parameters.put("dport", dport);
- parameters.put("enable", enable);
- parameters.put("iface", iface);
- parameters.put("log", log);
- parameters.put("macro", macro);
- parameters.put("moveto", moveto);
- parameters.put("proto", proto);
- parameters.put("source", source);
- parameters.put("sport", sport);
- parameters.put("type", type);
- return _client.set("/cluster/firewall/groups/" + _group + "/" + _pos + "", parameters);
- }
-
- /**
- * Modify rule data.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param comment Descriptive comment.
- * @param delete A list of settings you want to delete.
- * @param dest Restrict packet destination address. This
- * can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP addresses
- * and networks (entries are separated by comma). Please
- * do not mix IPv4 and IPv6 addresses inside such lists.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param dport Restrict TCP/UDP destination port. You
- * can use service names or simple numbers (0-65535), as
- * defined in '/etc/services'. Port ranges can be
- * specified with '\d+:\d+', for example '80:85', and
- * you can use comma separated list to match several
- * ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to use
- * network configuration key names for VMs and
- * containers ('net\d+'). Host related rules can use
- * arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param moveto Move rule to new position
- * <moveto>. Other arguments are ignored.
- * @param proto IP protocol. You can use protocol names
- * ('tcp'/'udp') or simple numbers, as defined in
- * '/etc/protocols'.
- * @param source Restrict packet source address. This
- * can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP addresses
- * and networks (entries are separated by comma). Please
- * do not mix IPv4 and IPv6 addresses inside such lists.
- * @param sport Restrict TCP/UDP source port. You can
- * use service names or simple numbers (0-65535), as
- * defined in '/etc/services'. Port ranges can be
- * specified with '\d+:\d+', for example '80:85', and
- * you can use comma separated list to match several
- * ports or ranges.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result updateRule(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
- return setRest(action, comment, delete, dest, digest, dport, enable, iface, log, macro, moveto, proto, source, sport, type);
- }
-
- /**
- * Modify rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/cluster/firewall/groups/" + _group + "/" + _pos + "", null);
- }
-
- /**
- * Modify rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateRule() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * Delete security group.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/firewall/groups/" + _group + "", null);
- }
-
- /**
- * Delete security group.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteSecurityGroup() throws JSONException {
- return deleteRest();
- }
-
- /**
- * List rules.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/groups/" + _group + "", null);
- }
-
- /**
- * List rules.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRules() throws JSONException {
- return getRest();
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP', 'REJECT') or
- * security group name.
- * @param type Rule type. Enum: in,out,group
- * @param comment Descriptive comment.
- * @param dest Restrict packet destination address. This can
- * refer to a single IP address, an IP set ('+ipsetname') or
- * an IP alias definition. You can also specify an address
- * range like '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by comma).
- * Please do not mix IPv4 and IPv6 addresses inside such
- * lists.
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @param dport Restrict TCP/UDP destination port. You can
- * use service names or simple numbers (0-65535), as defined
- * in '/etc/services'. Port ranges can be specified with
- * '\d+:\d+', for example '80:85', and you can use comma
- * separated list to match several ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to use
- * network configuration key names for VMs and containers
- * ('net\d+'). Host related rules can use arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param pos Update rule at position <pos>.
- * @param proto IP protocol. You can use protocol names
- * ('tcp'/'udp') or simple numbers, as defined in
- * '/etc/protocols'.
- * @param source Restrict packet source address. This can
- * refer to a single IP address, an IP set ('+ipsetname') or
- * an IP alias definition. You can also specify an address
- * range like '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by comma).
- * Please do not mix IPv4 and IPv6 addresses inside such
- * lists.
- * @param sport Restrict TCP/UDP source port. You can use
- * service names or simple numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified with
- * '\d+:\d+', for example '80:85', and you can use comma
- * separated list to match several ports or ranges.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("type", type);
- parameters.put("comment", comment);
- parameters.put("dest", dest);
- parameters.put("digest", digest);
- parameters.put("dport", dport);
- parameters.put("enable", enable);
- parameters.put("iface", iface);
- parameters.put("log", log);
- parameters.put("macro", macro);
- parameters.put("pos", pos);
- parameters.put("proto", proto);
- parameters.put("source", source);
- parameters.put("sport", sport);
- return _client.create("/cluster/firewall/groups/" + _group + "", parameters);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP', 'REJECT') or
- * security group name.
- * @param type Rule type. Enum: in,out,group
- * @param comment Descriptive comment.
- * @param dest Restrict packet destination address. This can
- * refer to a single IP address, an IP set ('+ipsetname') or
- * an IP alias definition. You can also specify an address
- * range like '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by comma).
- * Please do not mix IPv4 and IPv6 addresses inside such
- * lists.
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @param dport Restrict TCP/UDP destination port. You can
- * use service names or simple numbers (0-65535), as defined
- * in '/etc/services'. Port ranges can be specified with
- * '\d+:\d+', for example '80:85', and you can use comma
- * separated list to match several ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to use
- * network configuration key names for VMs and containers
- * ('net\d+'). Host related rules can use arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param pos Update rule at position <pos>.
- * @param proto IP protocol. You can use protocol names
- * ('tcp'/'udp') or simple numbers, as defined in
- * '/etc/protocols'.
- * @param source Restrict packet source address. This can
- * refer to a single IP address, an IP set ('+ipsetname') or
- * an IP alias definition. You can also specify an address
- * range like '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by comma).
- * Please do not mix IPv4 and IPv6 addresses inside such
- * lists.
- * @param sport Restrict TCP/UDP source port. You can use
- * service names or simple numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified with
- * '\d+:\d+', for example '80:85', and you can use comma
- * separated list to match several ports or ranges.
- * @return Result
- * @throws JSONException
- */
- public Result createRule(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
- return createRest(action, type, comment, dest, digest, dport, enable, iface, log, macro, pos, proto, source, sport);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP', 'REJECT') or
- * security group name.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String action, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("type", type);
- return _client.create("/cluster/firewall/groups/" + _group + "", parameters);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP', 'REJECT') or
- * security group name.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result createRule(String action, String type) throws JSONException {
- return createRest(action, type);
- }
-
- }
-
- /**
- * List security groups.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/groups", null);
- }
-
- /**
- * List security groups.
- *
- * @return Result
- * @throws JSONException
- */
- public Result listSecurityGroups() throws JSONException {
- return getRest();
- }
-
- /**
- * Create new security group.
- *
- * @param group Security Group name.
- * @param comment
- * @param digest Prevent changes if current configuration file
- * has different SHA1 digest. This can be used to prevent
- * concurrent modifications.
- * @param rename Rename/update an existing security group. You
- * can set 'rename' to the same value as 'name' to update the
- * 'comment' of an existing group.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String group, String comment, String digest, String rename) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("group", group);
- parameters.put("comment", comment);
- parameters.put("digest", digest);
- parameters.put("rename", rename);
- return _client.create("/cluster/firewall/groups", parameters);
- }
-
- /**
- * Create new security group.
- *
- * @param group Security Group name.
- * @param comment
- * @param digest Prevent changes if current configuration file
- * has different SHA1 digest. This can be used to prevent
- * concurrent modifications.
- * @param rename Rename/update an existing security group. You
- * can set 'rename' to the same value as 'name' to update the
- * 'comment' of an existing group.
- * @return Result
- * @throws JSONException
- */
- public Result createSecurityGroup(String group, String comment, String digest, String rename) throws JSONException {
- return createRest(group, comment, digest, rename);
- }
-
- /**
- * Create new security group.
- *
- * @param group Security Group name.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String group) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("group", group);
- return _client.create("/cluster/firewall/groups", parameters);
- }
-
- /**
- * Create new security group.
- *
- * @param group Security Group name.
- * @return Result
- * @throws JSONException
- */
- public Result createSecurityGroup(String group) throws JSONException {
- return createRest(group);
- }
-
- }
-
- public class PVERules {
-
- private final PveClient _client;
-
- protected PVERules(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemPos get(Object pos) {
- return new PVEItemPos(_client, pos);
- }
-
- public class PVEItemPos {
-
- private final PveClient _client;
- private final Object _pos;
-
- protected PVEItemPos(PveClient client, Object pos) {
- _client = client;
- _pos = pos;
- }
-
- /**
- * Delete rule.
- *
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("digest", digest);
- return _client.delete("/cluster/firewall/rules/" + _pos + "", parameters);
- }
-
- /**
- * Delete rule.
- *
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRule(String digest) throws JSONException {
- return deleteRest(digest);
- }
-
- /**
- * Delete rule.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/firewall/rules/" + _pos + "", null);
- }
-
- /**
- * Delete rule.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRule() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Get single rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/rules/" + _pos + "", null);
- }
-
- /**
- * Get single rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRule() throws JSONException {
- return getRest();
- }
-
- /**
- * Modify rule data.
- *
- * @param action Rule action ('ACCEPT', 'DROP', 'REJECT') or
- * security group name.
- * @param comment Descriptive comment.
- * @param delete A list of settings you want to delete.
- * @param dest Restrict packet destination address. This can
- * refer to a single IP address, an IP set ('+ipsetname') or
- * an IP alias definition. You can also specify an address
- * range like '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by comma).
- * Please do not mix IPv4 and IPv6 addresses inside such
- * lists.
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @param dport Restrict TCP/UDP destination port. You can
- * use service names or simple numbers (0-65535), as defined
- * in '/etc/services'. Port ranges can be specified with
- * '\d+:\d+', for example '80:85', and you can use comma
- * separated list to match several ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to use
- * network configuration key names for VMs and containers
- * ('net\d+'). Host related rules can use arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param moveto Move rule to new position
- * <moveto>. Other arguments are ignored.
- * @param proto IP protocol. You can use protocol names
- * ('tcp'/'udp') or simple numbers, as defined in
- * '/etc/protocols'.
- * @param source Restrict packet source address. This can
- * refer to a single IP address, an IP set ('+ipsetname') or
- * an IP alias definition. You can also specify an address
- * range like '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by comma).
- * Please do not mix IPv4 and IPv6 addresses inside such
- * lists.
- * @param sport Restrict TCP/UDP source port. You can use
- * service names or simple numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified with
- * '\d+:\d+', for example '80:85', and you can use comma
- * separated list to match several ports or ranges.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("comment", comment);
- parameters.put("delete", delete);
- parameters.put("dest", dest);
- parameters.put("digest", digest);
- parameters.put("dport", dport);
- parameters.put("enable", enable);
- parameters.put("iface", iface);
- parameters.put("log", log);
- parameters.put("macro", macro);
- parameters.put("moveto", moveto);
- parameters.put("proto", proto);
- parameters.put("source", source);
- parameters.put("sport", sport);
- parameters.put("type", type);
- return _client.set("/cluster/firewall/rules/" + _pos + "", parameters);
- }
-
- /**
- * Modify rule data.
- *
- * @param action Rule action ('ACCEPT', 'DROP', 'REJECT') or
- * security group name.
- * @param comment Descriptive comment.
- * @param delete A list of settings you want to delete.
- * @param dest Restrict packet destination address. This can
- * refer to a single IP address, an IP set ('+ipsetname') or
- * an IP alias definition. You can also specify an address
- * range like '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by comma).
- * Please do not mix IPv4 and IPv6 addresses inside such
- * lists.
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @param dport Restrict TCP/UDP destination port. You can
- * use service names or simple numbers (0-65535), as defined
- * in '/etc/services'. Port ranges can be specified with
- * '\d+:\d+', for example '80:85', and you can use comma
- * separated list to match several ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to use
- * network configuration key names for VMs and containers
- * ('net\d+'). Host related rules can use arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param moveto Move rule to new position
- * <moveto>. Other arguments are ignored.
- * @param proto IP protocol. You can use protocol names
- * ('tcp'/'udp') or simple numbers, as defined in
- * '/etc/protocols'.
- * @param source Restrict packet source address. This can
- * refer to a single IP address, an IP set ('+ipsetname') or
- * an IP alias definition. You can also specify an address
- * range like '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by comma).
- * Please do not mix IPv4 and IPv6 addresses inside such
- * lists.
- * @param sport Restrict TCP/UDP source port. You can use
- * service names or simple numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified with
- * '\d+:\d+', for example '80:85', and you can use comma
- * separated list to match several ports or ranges.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result updateRule(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
- return setRest(action, comment, delete, dest, digest, dport, enable, iface, log, macro, moveto, proto, source, sport, type);
- }
-
- /**
- * Modify rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/cluster/firewall/rules/" + _pos + "", null);
- }
-
- /**
- * Modify rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateRule() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * List rules.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/rules", null);
- }
-
- /**
- * List rules.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRules() throws JSONException {
- return getRest();
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP', 'REJECT') or
- * security group name.
- * @param type Rule type. Enum: in,out,group
- * @param comment Descriptive comment.
- * @param dest Restrict packet destination address. This can
- * refer to a single IP address, an IP set ('+ipsetname') or an
- * IP alias definition. You can also specify an address range
- * like '20.34.101.207-201.3.9.99', or a list of IP addresses
- * and networks (entries are separated by comma). Please do not
- * mix IPv4 and IPv6 addresses inside such lists.
- * @param digest Prevent changes if current configuration file
- * has different SHA1 digest. This can be used to prevent
- * concurrent modifications.
- * @param dport Restrict TCP/UDP destination port. You can use
- * service names or simple numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified with '\d+:\d+',
- * for example '80:85', and you can use comma separated list to
- * match several ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to use network
- * configuration key names for VMs and containers ('net\d+').
- * Host related rules can use arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param pos Update rule at position <pos>.
- * @param proto IP protocol. You can use protocol names
- * ('tcp'/'udp') or simple numbers, as defined in
- * '/etc/protocols'.
- * @param source Restrict packet source address. This can refer
- * to a single IP address, an IP set ('+ipsetname') or an IP
- * alias definition. You can also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP addresses and
- * networks (entries are separated by comma). Please do not mix
- * IPv4 and IPv6 addresses inside such lists.
- * @param sport Restrict TCP/UDP source port. You can use
- * service names or simple numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified with '\d+:\d+',
- * for example '80:85', and you can use comma separated list to
- * match several ports or ranges.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("type", type);
- parameters.put("comment", comment);
- parameters.put("dest", dest);
- parameters.put("digest", digest);
- parameters.put("dport", dport);
- parameters.put("enable", enable);
- parameters.put("iface", iface);
- parameters.put("log", log);
- parameters.put("macro", macro);
- parameters.put("pos", pos);
- parameters.put("proto", proto);
- parameters.put("source", source);
- parameters.put("sport", sport);
- return _client.create("/cluster/firewall/rules", parameters);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP', 'REJECT') or
- * security group name.
- * @param type Rule type. Enum: in,out,group
- * @param comment Descriptive comment.
- * @param dest Restrict packet destination address. This can
- * refer to a single IP address, an IP set ('+ipsetname') or an
- * IP alias definition. You can also specify an address range
- * like '20.34.101.207-201.3.9.99', or a list of IP addresses
- * and networks (entries are separated by comma). Please do not
- * mix IPv4 and IPv6 addresses inside such lists.
- * @param digest Prevent changes if current configuration file
- * has different SHA1 digest. This can be used to prevent
- * concurrent modifications.
- * @param dport Restrict TCP/UDP destination port. You can use
- * service names or simple numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified with '\d+:\d+',
- * for example '80:85', and you can use comma separated list to
- * match several ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to use network
- * configuration key names for VMs and containers ('net\d+').
- * Host related rules can use arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param pos Update rule at position <pos>.
- * @param proto IP protocol. You can use protocol names
- * ('tcp'/'udp') or simple numbers, as defined in
- * '/etc/protocols'.
- * @param source Restrict packet source address. This can refer
- * to a single IP address, an IP set ('+ipsetname') or an IP
- * alias definition. You can also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP addresses and
- * networks (entries are separated by comma). Please do not mix
- * IPv4 and IPv6 addresses inside such lists.
- * @param sport Restrict TCP/UDP source port. You can use
- * service names or simple numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified with '\d+:\d+',
- * for example '80:85', and you can use comma separated list to
- * match several ports or ranges.
- * @return Result
- * @throws JSONException
- */
- public Result createRule(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
- return createRest(action, type, comment, dest, digest, dport, enable, iface, log, macro, pos, proto, source, sport);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP', 'REJECT') or
- * security group name.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String action, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("type", type);
- return _client.create("/cluster/firewall/rules", parameters);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP', 'REJECT') or
- * security group name.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result createRule(String action, String type) throws JSONException {
- return createRest(action, type);
- }
-
- }
-
- public class PVEIpset {
-
- private final PveClient _client;
-
- protected PVEIpset(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemName get(Object name) {
- return new PVEItemName(_client, name);
- }
-
- public class PVEItemName {
-
- private final PveClient _client;
- private final Object _name;
-
- protected PVEItemName(PveClient client, Object name) {
- _client = client;
- _name = name;
- }
-
- public PVEItemCidr get(Object cidr) {
- return new PVEItemCidr(_client, _name, cidr);
- }
-
- public class PVEItemCidr {
-
- private final PveClient _client;
- private final Object _name;
- private final Object _cidr;
-
- protected PVEItemCidr(PveClient client, Object name, Object cidr) {
- _client = client;
- _name = name;
- _cidr = cidr;
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("digest", digest);
- return _client.delete("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", parameters);
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result removeIp(String digest) throws JSONException {
- return deleteRest(digest);
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", null);
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result removeIp() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Read IP or Network settings from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", null);
- }
-
- /**
- * Read IP or Network settings from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result readIp() throws JSONException {
- return getRest();
- }
-
- /**
- * Update IP or Network settings
- *
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String comment, String digest, Boolean nomatch) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("comment", comment);
- parameters.put("digest", digest);
- parameters.put("nomatch", nomatch);
- return _client.set("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", parameters);
- }
-
- /**
- * Update IP or Network settings
- *
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result updateIp(String comment, String digest, Boolean nomatch) throws JSONException {
- return setRest(comment, digest, nomatch);
- }
-
- /**
- * Update IP or Network settings
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", null);
- }
-
- /**
- * Update IP or Network settings
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateIp() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * Delete IPSet
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/firewall/ipset/" + _name + "", null);
- }
-
- /**
- * Delete IPSet
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteIpset() throws JSONException {
- return deleteRest();
- }
-
- /**
- * List IPSet content
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/ipset/" + _name + "", null);
- }
-
- /**
- * List IPSet content
- *
- * @return Result
- * @throws JSONException
- */
- public Result getIpset() throws JSONException {
- return getRest();
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @param comment
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr, String comment, Boolean nomatch) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("comment", comment);
- parameters.put("nomatch", nomatch);
- return _client.create("/cluster/firewall/ipset/" + _name + "", parameters);
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @param comment
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result createIp(String cidr, String comment, Boolean nomatch) throws JSONException {
- return createRest(cidr, comment, nomatch);
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- return _client.create("/cluster/firewall/ipset/" + _name + "", parameters);
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @return Result
- * @throws JSONException
- */
- public Result createIp(String cidr) throws JSONException {
- return createRest(cidr);
- }
-
- }
-
- /**
- * List IPSets
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/ipset", null);
- }
-
- /**
- * List IPSets
- *
- * @return Result
- * @throws JSONException
- */
- public Result ipsetIndex() throws JSONException {
- return getRest();
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @param comment
- * @param digest Prevent changes if current configuration file
- * has different SHA1 digest. This can be used to prevent
- * concurrent modifications.
- * @param rename Rename an existing IPSet. You can set 'rename'
- * to the same value as 'name' to update the 'comment' of an
- * existing IPSet.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String name, String comment, String digest, String rename) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("name", name);
- parameters.put("comment", comment);
- parameters.put("digest", digest);
- parameters.put("rename", rename);
- return _client.create("/cluster/firewall/ipset", parameters);
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @param comment
- * @param digest Prevent changes if current configuration file
- * has different SHA1 digest. This can be used to prevent
- * concurrent modifications.
- * @param rename Rename an existing IPSet. You can set 'rename'
- * to the same value as 'name' to update the 'comment' of an
- * existing IPSet.
- * @return Result
- * @throws JSONException
- */
- public Result createIpset(String name, String comment, String digest, String rename) throws JSONException {
- return createRest(name, comment, digest, rename);
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String name) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("name", name);
- return _client.create("/cluster/firewall/ipset", parameters);
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @return Result
- * @throws JSONException
- */
- public Result createIpset(String name) throws JSONException {
- return createRest(name);
- }
-
- }
-
- public class PVEAliases {
-
- private final PveClient _client;
-
- protected PVEAliases(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemName get(Object name) {
- return new PVEItemName(_client, name);
- }
-
- public class PVEItemName {
-
- private final PveClient _client;
- private final Object _name;
-
- protected PVEItemName(PveClient client, Object name) {
- _client = client;
- _name = name;
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("digest", digest);
- return _client.delete("/cluster/firewall/aliases/" + _name + "", parameters);
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result removeAlias(String digest) throws JSONException {
- return deleteRest(digest);
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/firewall/aliases/" + _name + "", null);
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result removeAlias() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Read alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/aliases/" + _name + "", null);
- }
-
- /**
- * Read alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result readAlias() throws JSONException {
- return getRest();
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @param comment
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @param rename Rename an existing alias.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String cidr, String comment, String digest, String rename) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("comment", comment);
- parameters.put("digest", digest);
- parameters.put("rename", rename);
- return _client.set("/cluster/firewall/aliases/" + _name + "", parameters);
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @param comment
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @param rename Rename an existing alias.
- * @return Result
- * @throws JSONException
- */
- public Result updateAlias(String cidr, String comment, String digest, String rename) throws JSONException {
- return setRest(cidr, comment, digest, rename);
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String cidr) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- return _client.set("/cluster/firewall/aliases/" + _name + "", parameters);
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @return Result
- * @throws JSONException
- */
- public Result updateAlias(String cidr) throws JSONException {
- return setRest(cidr);
- }
-
- }
-
- /**
- * List aliases
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/aliases", null);
- }
-
- /**
- * List aliases
- *
- * @return Result
- * @throws JSONException
- */
- public Result getAliases() throws JSONException {
- return getRest();
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @param name Alias name.
- * @param comment
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr, String name, String comment) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("name", name);
- parameters.put("comment", comment);
- return _client.create("/cluster/firewall/aliases", parameters);
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @param name Alias name.
- * @param comment
- * @return Result
- * @throws JSONException
- */
- public Result createAlias(String cidr, String name, String comment) throws JSONException {
- return createRest(cidr, name, comment);
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @param name Alias name.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr, String name) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("name", name);
- return _client.create("/cluster/firewall/aliases", parameters);
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR format.
- * @param name Alias name.
- * @return Result
- * @throws JSONException
- */
- public Result createAlias(String cidr, String name) throws JSONException {
- return createRest(cidr, name);
- }
-
- }
-
- public class PVEOptions {
-
- private final PveClient _client;
-
- protected PVEOptions(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get Firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/options", null);
- }
-
- /**
- * Get Firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getOptions() throws JSONException {
- return getRest();
- }
-
- /**
- * Set Firewall options.
- *
- * @param delete A list of settings you want to delete.
- * @param digest Prevent changes if current configuration file
- * has different SHA1 digest. This can be used to prevent
- * concurrent modifications.
- * @param ebtables Enable ebtables rules cluster wide.
- * @param enable Enable or disable the firewall cluster wide.
- * @param log_ratelimit Log ratelimiting settings
- * @param policy_in Input policy. Enum: ACCEPT,REJECT,DROP
- * @param policy_out Output policy. Enum: ACCEPT,REJECT,DROP
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String delete, String digest, Boolean ebtables, Integer enable, String log_ratelimit, String policy_in, String policy_out) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("delete", delete);
- parameters.put("digest", digest);
- parameters.put("ebtables", ebtables);
- parameters.put("enable", enable);
- parameters.put("log_ratelimit", log_ratelimit);
- parameters.put("policy_in", policy_in);
- parameters.put("policy_out", policy_out);
- return _client.set("/cluster/firewall/options", parameters);
- }
-
- /**
- * Set Firewall options.
- *
- * @param delete A list of settings you want to delete.
- * @param digest Prevent changes if current configuration file
- * has different SHA1 digest. This can be used to prevent
- * concurrent modifications.
- * @param ebtables Enable ebtables rules cluster wide.
- * @param enable Enable or disable the firewall cluster wide.
- * @param log_ratelimit Log ratelimiting settings
- * @param policy_in Input policy. Enum: ACCEPT,REJECT,DROP
- * @param policy_out Output policy. Enum: ACCEPT,REJECT,DROP
- * @return Result
- * @throws JSONException
- */
- public Result setOptions(String delete, String digest, Boolean ebtables, Integer enable, String log_ratelimit, String policy_in, String policy_out) throws JSONException {
- return setRest(delete, digest, ebtables, enable, log_ratelimit, policy_in, policy_out);
- }
-
- /**
- * Set Firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/cluster/firewall/options", null);
- }
-
- /**
- * Set Firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setOptions() throws JSONException {
- return setRest();
- }
-
- }
-
- public class PVEMacros {
-
- private final PveClient _client;
-
- protected PVEMacros(PveClient client) {
- _client = client;
-
- }
-
- /**
- * List available macros
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/macros", null);
- }
-
- /**
- * List available macros
- *
- * @return Result
- * @throws JSONException
- */
- public Result getMacros() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVERefs {
-
- private final PveClient _client;
-
- protected PVERefs(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Lists possible IPSet/Alias reference which are allowed in
- * source/dest properties.
- *
- * @param type Only list references of specified type. Enum:
- * alias,ipset
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("type", type);
- return _client.get("/cluster/firewall/refs", parameters);
- }
-
- /**
- * Lists possible IPSet/Alias reference which are allowed in
- * source/dest properties.
- *
- * @param type Only list references of specified type. Enum:
- * alias,ipset
- * @return Result
- * @throws JSONException
- */
- public Result refs(String type) throws JSONException {
- return getRest(type);
- }
-
- /**
- * Lists possible IPSet/Alias reference which are allowed in
- * source/dest properties.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall/refs", null);
- }
-
- /**
- * Lists possible IPSet/Alias reference which are allowed in
- * source/dest properties.
- *
- * @return Result
- * @throws JSONException
- */
- public Result refs() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/firewall", null);
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEBackup {
-
- private final PveClient _client;
-
- protected PVEBackup(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemId get(Object id) {
- return new PVEItemId(_client, id);
- }
-
- public class PVEItemId {
-
- private final PveClient _client;
- private final Object _id;
-
- protected PVEItemId(PveClient client, Object id) {
- _client = client;
- _id = id;
- }
-
- /**
- * Delete vzdump backup job definition.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/backup/" + _id + "", null);
- }
-
- /**
- * Delete vzdump backup job definition.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteJob() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Read vzdump backup job definition.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/backup/" + _id + "", null);
- }
-
- /**
- * Read vzdump backup job definition.
- *
- * @return Result
- * @throws JSONException
- */
- public Result readJob() throws JSONException {
- return getRest();
- }
-
- /**
- * Update vzdump backup job definition.
- *
- * @param starttime Job Start time.
- * @param all Backup all known guest systems on this host.
- * @param bwlimit Limit I/O bandwidth (KBytes per second).
- * @param compress Compress dump file. Enum: 0,1,gzip,lzo
- * @param delete A list of settings you want to delete.
- * @param dow Day of week selection.
- * @param dumpdir Store resulting files to specified directory.
- * @param enabled Enable or disable the job.
- * @param exclude Exclude specified guest systems (assumes
- * --all)
- * @param exclude_path Exclude certain files/directories (shell
- * globs).
- * @param ionice Set CFQ ionice priority.
- * @param lockwait Maximal time to wait for the global lock
- * (minutes).
- * @param mailnotification Specify when to send an email Enum:
- * always,failure
- * @param mailto Comma-separated list of email addresses that
- * should receive email notifications.
- * @param maxfiles Maximal number of backup files per guest
- * system.
- * @param mode Backup mode. Enum: snapshot,suspend,stop
- * @param node Only run if executed on this node.
- * @param pigz Use pigz instead of gzip when N>0. N=1
- * uses half of cores, N>1 uses N as thread count.
- * @param pool Backup all known guest systems included in the
- * specified pool.
- * @param quiet Be quiet.
- * @param remove Remove old backup files if there are more than
- * 'maxfiles' backup files.
- * @param script Use specified hook script.
- * @param size Unused, will be removed in a future release.
- * @param stdexcludes Exclude temporary files and logs.
- * @param stop Stop running backup jobs on this host.
- * @param stopwait Maximal time to wait until a guest system is
- * stopped (minutes).
- * @param storage Store resulting file to this storage.
- * @param tmpdir Store temporary files to specified directory.
- * @param vmid The ID of the guest system you want to backup.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String starttime, Boolean all, Integer bwlimit, String compress, String delete, String dow, String dumpdir, Boolean enabled, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, String node, Integer pigz, String pool, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("starttime", starttime);
- parameters.put("all", all);
- parameters.put("bwlimit", bwlimit);
- parameters.put("compress", compress);
- parameters.put("delete", delete);
- parameters.put("dow", dow);
- parameters.put("dumpdir", dumpdir);
- parameters.put("enabled", enabled);
- parameters.put("exclude", exclude);
- parameters.put("exclude-path", exclude_path);
- parameters.put("ionice", ionice);
- parameters.put("lockwait", lockwait);
- parameters.put("mailnotification", mailnotification);
- parameters.put("mailto", mailto);
- parameters.put("maxfiles", maxfiles);
- parameters.put("mode", mode);
- parameters.put("node", node);
- parameters.put("pigz", pigz);
- parameters.put("pool", pool);
- parameters.put("quiet", quiet);
- parameters.put("remove", remove);
- parameters.put("script", script);
- parameters.put("size", size);
- parameters.put("stdexcludes", stdexcludes);
- parameters.put("stop", stop);
- parameters.put("stopwait", stopwait);
- parameters.put("storage", storage);
- parameters.put("tmpdir", tmpdir);
- parameters.put("vmid", vmid);
- return _client.set("/cluster/backup/" + _id + "", parameters);
- }
-
- /**
- * Update vzdump backup job definition.
- *
- * @param starttime Job Start time.
- * @param all Backup all known guest systems on this host.
- * @param bwlimit Limit I/O bandwidth (KBytes per second).
- * @param compress Compress dump file. Enum: 0,1,gzip,lzo
- * @param delete A list of settings you want to delete.
- * @param dow Day of week selection.
- * @param dumpdir Store resulting files to specified directory.
- * @param enabled Enable or disable the job.
- * @param exclude Exclude specified guest systems (assumes
- * --all)
- * @param exclude_path Exclude certain files/directories (shell
- * globs).
- * @param ionice Set CFQ ionice priority.
- * @param lockwait Maximal time to wait for the global lock
- * (minutes).
- * @param mailnotification Specify when to send an email Enum:
- * always,failure
- * @param mailto Comma-separated list of email addresses that
- * should receive email notifications.
- * @param maxfiles Maximal number of backup files per guest
- * system.
- * @param mode Backup mode. Enum: snapshot,suspend,stop
- * @param node Only run if executed on this node.
- * @param pigz Use pigz instead of gzip when N>0. N=1
- * uses half of cores, N>1 uses N as thread count.
- * @param pool Backup all known guest systems included in the
- * specified pool.
- * @param quiet Be quiet.
- * @param remove Remove old backup files if there are more than
- * 'maxfiles' backup files.
- * @param script Use specified hook script.
- * @param size Unused, will be removed in a future release.
- * @param stdexcludes Exclude temporary files and logs.
- * @param stop Stop running backup jobs on this host.
- * @param stopwait Maximal time to wait until a guest system is
- * stopped (minutes).
- * @param storage Store resulting file to this storage.
- * @param tmpdir Store temporary files to specified directory.
- * @param vmid The ID of the guest system you want to backup.
- * @return Result
- * @throws JSONException
- */
- public Result updateJob(String starttime, Boolean all, Integer bwlimit, String compress, String delete, String dow, String dumpdir, Boolean enabled, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, String node, Integer pigz, String pool, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) throws JSONException {
- return setRest(starttime, all, bwlimit, compress, delete, dow, dumpdir, enabled, exclude, exclude_path, ionice, lockwait, mailnotification, mailto, maxfiles, mode, node, pigz, pool, quiet, remove, script, size, stdexcludes, stop, stopwait, storage, tmpdir, vmid);
- }
-
- /**
- * Update vzdump backup job definition.
- *
- * @param starttime Job Start time.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String starttime) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("starttime", starttime);
- return _client.set("/cluster/backup/" + _id + "", parameters);
- }
-
- /**
- * Update vzdump backup job definition.
- *
- * @param starttime Job Start time.
- * @return Result
- * @throws JSONException
- */
- public Result updateJob(String starttime) throws JSONException {
- return setRest(starttime);
- }
-
- }
-
- /**
- * List vzdump backup schedule.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/backup", null);
- }
-
- /**
- * List vzdump backup schedule.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- /**
- * Create new vzdump backup job.
- *
- * @param starttime Job Start time.
- * @param all Backup all known guest systems on this host.
- * @param bwlimit Limit I/O bandwidth (KBytes per second).
- * @param compress Compress dump file. Enum: 0,1,gzip,lzo
- * @param dow Day of week selection.
- * @param dumpdir Store resulting files to specified directory.
- * @param enabled Enable or disable the job.
- * @param exclude Exclude specified guest systems (assumes --all)
- * @param exclude_path Exclude certain files/directories (shell
- * globs).
- * @param ionice Set CFQ ionice priority.
- * @param lockwait Maximal time to wait for the global lock
- * (minutes).
- * @param mailnotification Specify when to send an email Enum:
- * always,failure
- * @param mailto Comma-separated list of email addresses that should
- * receive email notifications.
- * @param maxfiles Maximal number of backup files per guest system.
- * @param mode Backup mode. Enum: snapshot,suspend,stop
- * @param node Only run if executed on this node.
- * @param pigz Use pigz instead of gzip when N>0. N=1 uses
- * half of cores, N>1 uses N as thread count.
- * @param pool Backup all known guest systems included in the
- * specified pool.
- * @param quiet Be quiet.
- * @param remove Remove old backup files if there are more than
- * 'maxfiles' backup files.
- * @param script Use specified hook script.
- * @param size Unused, will be removed in a future release.
- * @param stdexcludes Exclude temporary files and logs.
- * @param stop Stop running backup jobs on this host.
- * @param stopwait Maximal time to wait until a guest system is
- * stopped (minutes).
- * @param storage Store resulting file to this storage.
- * @param tmpdir Store temporary files to specified directory.
- * @param vmid The ID of the guest system you want to backup.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String starttime, Boolean all, Integer bwlimit, String compress, String dow, String dumpdir, Boolean enabled, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, String node, Integer pigz, String pool, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("starttime", starttime);
- parameters.put("all", all);
- parameters.put("bwlimit", bwlimit);
- parameters.put("compress", compress);
- parameters.put("dow", dow);
- parameters.put("dumpdir", dumpdir);
- parameters.put("enabled", enabled);
- parameters.put("exclude", exclude);
- parameters.put("exclude-path", exclude_path);
- parameters.put("ionice", ionice);
- parameters.put("lockwait", lockwait);
- parameters.put("mailnotification", mailnotification);
- parameters.put("mailto", mailto);
- parameters.put("maxfiles", maxfiles);
- parameters.put("mode", mode);
- parameters.put("node", node);
- parameters.put("pigz", pigz);
- parameters.put("pool", pool);
- parameters.put("quiet", quiet);
- parameters.put("remove", remove);
- parameters.put("script", script);
- parameters.put("size", size);
- parameters.put("stdexcludes", stdexcludes);
- parameters.put("stop", stop);
- parameters.put("stopwait", stopwait);
- parameters.put("storage", storage);
- parameters.put("tmpdir", tmpdir);
- parameters.put("vmid", vmid);
- return _client.create("/cluster/backup", parameters);
- }
-
- /**
- * Create new vzdump backup job.
- *
- * @param starttime Job Start time.
- * @param all Backup all known guest systems on this host.
- * @param bwlimit Limit I/O bandwidth (KBytes per second).
- * @param compress Compress dump file. Enum: 0,1,gzip,lzo
- * @param dow Day of week selection.
- * @param dumpdir Store resulting files to specified directory.
- * @param enabled Enable or disable the job.
- * @param exclude Exclude specified guest systems (assumes --all)
- * @param exclude_path Exclude certain files/directories (shell
- * globs).
- * @param ionice Set CFQ ionice priority.
- * @param lockwait Maximal time to wait for the global lock
- * (minutes).
- * @param mailnotification Specify when to send an email Enum:
- * always,failure
- * @param mailto Comma-separated list of email addresses that should
- * receive email notifications.
- * @param maxfiles Maximal number of backup files per guest system.
- * @param mode Backup mode. Enum: snapshot,suspend,stop
- * @param node Only run if executed on this node.
- * @param pigz Use pigz instead of gzip when N>0. N=1 uses
- * half of cores, N>1 uses N as thread count.
- * @param pool Backup all known guest systems included in the
- * specified pool.
- * @param quiet Be quiet.
- * @param remove Remove old backup files if there are more than
- * 'maxfiles' backup files.
- * @param script Use specified hook script.
- * @param size Unused, will be removed in a future release.
- * @param stdexcludes Exclude temporary files and logs.
- * @param stop Stop running backup jobs on this host.
- * @param stopwait Maximal time to wait until a guest system is
- * stopped (minutes).
- * @param storage Store resulting file to this storage.
- * @param tmpdir Store temporary files to specified directory.
- * @param vmid The ID of the guest system you want to backup.
- * @return Result
- * @throws JSONException
- */
- public Result createJob(String starttime, Boolean all, Integer bwlimit, String compress, String dow, String dumpdir, Boolean enabled, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, String node, Integer pigz, String pool, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) throws JSONException {
- return createRest(starttime, all, bwlimit, compress, dow, dumpdir, enabled, exclude, exclude_path, ionice, lockwait, mailnotification, mailto, maxfiles, mode, node, pigz, pool, quiet, remove, script, size, stdexcludes, stop, stopwait, storage, tmpdir, vmid);
- }
-
- /**
- * Create new vzdump backup job.
- *
- * @param starttime Job Start time.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String starttime) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("starttime", starttime);
- return _client.create("/cluster/backup", parameters);
- }
-
- /**
- * Create new vzdump backup job.
- *
- * @param starttime Job Start time.
- * @return Result
- * @throws JSONException
- */
- public Result createJob(String starttime) throws JSONException {
- return createRest(starttime);
- }
-
- }
-
- public class PVEHa {
-
- private final PveClient _client;
-
- protected PVEHa(PveClient client) {
- _client = client;
-
- }
-
- private PVEResources _resources;
-
- public PVEResources getResources() {
- if (_resources == null) {
- _resources = new PVEResources(_client);
- }
-
- return _resources;
- }
- private PVEGroups _groups;
-
- public PVEGroups getGroups() {
- if (_groups == null) {
- _groups = new PVEGroups(_client);
- }
-
- return _groups;
- }
- private PVEStatus _status;
-
- public PVEStatus getStatus() {
- if (_status == null) {
- _status = new PVEStatus(_client);
- }
-
- return _status;
- }
-
- public class PVEResources {
-
- private final PveClient _client;
-
- protected PVEResources(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemSid get(Object sid) {
- return new PVEItemSid(_client, sid);
- }
-
- public class PVEItemSid {
-
- private final PveClient _client;
- private final Object _sid;
-
- protected PVEItemSid(PveClient client, Object sid) {
- _client = client;
- _sid = sid;
- }
-
- private PVEMigrate _migrate;
-
- public PVEMigrate getMigrate() {
- if (_migrate == null) {
- _migrate = new PVEMigrate(_client, _sid);
- }
-
- return _migrate;
- }
- private PVERelocate _relocate;
-
- public PVERelocate getRelocate() {
- if (_relocate == null) {
- _relocate = new PVERelocate(_client, _sid);
- }
-
- return _relocate;
- }
-
- public class PVEMigrate {
-
- private final PveClient _client;
- private final Object _sid;
-
- protected PVEMigrate(PveClient client, Object sid) {
- _client = client;
- _sid = sid;
- }
-
- /**
- * Request resource migration (online) to another node.
- *
- * @param node Target node.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String node) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("node", node);
- return _client.create("/cluster/ha/resources/" + _sid + "/migrate", parameters);
- }
-
- /**
- * Request resource migration (online) to another node.
- *
- * @param node Target node.
- * @return Result
- * @throws JSONException
- */
- public Result migrate(String node) throws JSONException {
- return createRest(node);
- }
-
- }
-
- public class PVERelocate {
-
- private final PveClient _client;
- private final Object _sid;
-
- protected PVERelocate(PveClient client, Object sid) {
- _client = client;
- _sid = sid;
- }
-
- /**
- * Request resource relocatzion to another node. This
- * stops the service on the old node, and restarts it on
- * the target node.
- *
- * @param node Target node.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String node) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("node", node);
- return _client.create("/cluster/ha/resources/" + _sid + "/relocate", parameters);
- }
-
- /**
- * Request resource relocatzion to another node. This
- * stops the service on the old node, and restarts it on
- * the target node.
- *
- * @param node Target node.
- * @return Result
- * @throws JSONException
- */
- public Result relocate(String node) throws JSONException {
- return createRest(node);
- }
-
- }
-
- /**
- * Delete resource configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/ha/resources/" + _sid + "", null);
- }
-
- /**
- * Delete resource configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result delete() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Read resource configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ha/resources/" + _sid + "", null);
- }
-
- /**
- * Read resource configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result read() throws JSONException {
- return getRest();
- }
-
- /**
- * Update resource configuration.
- *
- * @param comment Description.
- * @param delete A list of settings you want to delete.
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @param group The HA group identifier.
- * @param max_relocate Maximal number of service relocate
- * tries when a service failes to start.
- * @param max_restart Maximal number of tries to restart the
- * service on a node after its start failed.
- * @param state Requested resource state. Enum:
- * started,stopped,enabled,disabled,ignored
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String comment, String delete, String digest, String group, Integer max_relocate, Integer max_restart, String state) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("comment", comment);
- parameters.put("delete", delete);
- parameters.put("digest", digest);
- parameters.put("group", group);
- parameters.put("max_relocate", max_relocate);
- parameters.put("max_restart", max_restart);
- parameters.put("state", state);
- return _client.set("/cluster/ha/resources/" + _sid + "", parameters);
- }
-
- /**
- * Update resource configuration.
- *
- * @param comment Description.
- * @param delete A list of settings you want to delete.
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @param group The HA group identifier.
- * @param max_relocate Maximal number of service relocate
- * tries when a service failes to start.
- * @param max_restart Maximal number of tries to restart the
- * service on a node after its start failed.
- * @param state Requested resource state. Enum:
- * started,stopped,enabled,disabled,ignored
- * @return Result
- * @throws JSONException
- */
- public Result update(String comment, String delete, String digest, String group, Integer max_relocate, Integer max_restart, String state) throws JSONException {
- return setRest(comment, delete, digest, group, max_relocate, max_restart, state);
- }
-
- /**
- * Update resource configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/cluster/ha/resources/" + _sid + "", null);
- }
-
- /**
- * Update resource configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result update() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * List HA resources.
- *
- * @param type Only list resources of specific type Enum: ct,vm
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("type", type);
- return _client.get("/cluster/ha/resources", parameters);
- }
-
- /**
- * List HA resources.
- *
- * @param type Only list resources of specific type Enum: ct,vm
- * @return Result
- * @throws JSONException
- */
- public Result index(String type) throws JSONException {
- return getRest(type);
- }
-
- /**
- * List HA resources.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ha/resources", null);
- }
-
- /**
- * List HA resources.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- /**
- * Create a new HA resource.
- *
- * @param sid HA resource ID. This consists of a resource type
- * followed by a resource specific name, separated with colon
- * (example: vm:100 / ct:100). For virtual machines and
- * containers, you can simply use the VM or CT id as a shortcut
- * (example: 100).
- * @param comment Description.
- * @param group The HA group identifier.
- * @param max_relocate Maximal number of service relocate tries
- * when a service failes to start.
- * @param max_restart Maximal number of tries to restart the
- * service on a node after its start failed.
- * @param state Requested resource state. Enum:
- * started,stopped,enabled,disabled,ignored
- * @param type Resource type. Enum: ct,vm
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String sid, String comment, String group, Integer max_relocate, Integer max_restart, String state, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("sid", sid);
- parameters.put("comment", comment);
- parameters.put("group", group);
- parameters.put("max_relocate", max_relocate);
- parameters.put("max_restart", max_restart);
- parameters.put("state", state);
- parameters.put("type", type);
- return _client.create("/cluster/ha/resources", parameters);
- }
-
- /**
- * Create a new HA resource.
- *
- * @param sid HA resource ID. This consists of a resource type
- * followed by a resource specific name, separated with colon
- * (example: vm:100 / ct:100). For virtual machines and
- * containers, you can simply use the VM or CT id as a shortcut
- * (example: 100).
- * @param comment Description.
- * @param group The HA group identifier.
- * @param max_relocate Maximal number of service relocate tries
- * when a service failes to start.
- * @param max_restart Maximal number of tries to restart the
- * service on a node after its start failed.
- * @param state Requested resource state. Enum:
- * started,stopped,enabled,disabled,ignored
- * @param type Resource type. Enum: ct,vm
- * @return Result
- * @throws JSONException
- */
- public Result create(String sid, String comment, String group, Integer max_relocate, Integer max_restart, String state, String type) throws JSONException {
- return createRest(sid, comment, group, max_relocate, max_restart, state, type);
- }
-
- /**
- * Create a new HA resource.
- *
- * @param sid HA resource ID. This consists of a resource type
- * followed by a resource specific name, separated with colon
- * (example: vm:100 / ct:100). For virtual machines and
- * containers, you can simply use the VM or CT id as a shortcut
- * (example: 100).
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String sid) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("sid", sid);
- return _client.create("/cluster/ha/resources", parameters);
- }
-
- /**
- * Create a new HA resource.
- *
- * @param sid HA resource ID. This consists of a resource type
- * followed by a resource specific name, separated with colon
- * (example: vm:100 / ct:100). For virtual machines and
- * containers, you can simply use the VM or CT id as a shortcut
- * (example: 100).
- * @return Result
- * @throws JSONException
- */
- public Result create(String sid) throws JSONException {
- return createRest(sid);
- }
-
- }
-
- public class PVEGroups {
-
- private final PveClient _client;
-
- protected PVEGroups(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemGroup get(Object group) {
- return new PVEItemGroup(_client, group);
- }
-
- public class PVEItemGroup {
-
- private final PveClient _client;
- private final Object _group;
-
- protected PVEItemGroup(PveClient client, Object group) {
- _client = client;
- _group = group;
- }
-
- /**
- * Delete ha group configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/ha/groups/" + _group + "", null);
- }
-
- /**
- * Delete ha group configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result delete() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Read ha group configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ha/groups/" + _group + "", null);
- }
-
- /**
- * Read ha group configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result read() throws JSONException {
- return getRest();
- }
-
- /**
- * Update ha group configuration.
- *
- * @param comment Description.
- * @param delete A list of settings you want to delete.
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @param nodes List of cluster node names with optional
- * priority.
- * @param nofailback The CRM tries to run services on the
- * node with the highest priority. If a node with higher
- * priority comes online, the CRM migrates the service to
- * that node. Enabling nofailback prevents that behavior.
- * @param restricted Resources bound to restricted groups
- * may only run on nodes defined by the group.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String comment, String delete, String digest, String nodes, Boolean nofailback, Boolean restricted) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("comment", comment);
- parameters.put("delete", delete);
- parameters.put("digest", digest);
- parameters.put("nodes", nodes);
- parameters.put("nofailback", nofailback);
- parameters.put("restricted", restricted);
- return _client.set("/cluster/ha/groups/" + _group + "", parameters);
- }
-
- /**
- * Update ha group configuration.
- *
- * @param comment Description.
- * @param delete A list of settings you want to delete.
- * @param digest Prevent changes if current configuration
- * file has different SHA1 digest. This can be used to
- * prevent concurrent modifications.
- * @param nodes List of cluster node names with optional
- * priority.
- * @param nofailback The CRM tries to run services on the
- * node with the highest priority. If a node with higher
- * priority comes online, the CRM migrates the service to
- * that node. Enabling nofailback prevents that behavior.
- * @param restricted Resources bound to restricted groups
- * may only run on nodes defined by the group.
- * @return Result
- * @throws JSONException
- */
- public Result update(String comment, String delete, String digest, String nodes, Boolean nofailback, Boolean restricted) throws JSONException {
- return setRest(comment, delete, digest, nodes, nofailback, restricted);
- }
-
- /**
- * Update ha group configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/cluster/ha/groups/" + _group + "", null);
- }
-
- /**
- * Update ha group configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result update() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * Get HA groups.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ha/groups", null);
- }
-
- /**
- * Get HA groups.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- /**
- * Create a new HA group.
- *
- * @param group The HA group identifier.
- * @param nodes List of cluster node names with optional
- * priority.
- * @param comment Description.
- * @param nofailback The CRM tries to run services on the node
- * with the highest priority. If a node with higher priority
- * comes online, the CRM migrates the service to that node.
- * Enabling nofailback prevents that behavior.
- * @param restricted Resources bound to restricted groups may
- * only run on nodes defined by the group.
- * @param type Group type. Enum: group
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String group, String nodes, String comment, Boolean nofailback, Boolean restricted, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("group", group);
- parameters.put("nodes", nodes);
- parameters.put("comment", comment);
- parameters.put("nofailback", nofailback);
- parameters.put("restricted", restricted);
- parameters.put("type", type);
- return _client.create("/cluster/ha/groups", parameters);
- }
-
- /**
- * Create a new HA group.
- *
- * @param group The HA group identifier.
- * @param nodes List of cluster node names with optional
- * priority.
- * @param comment Description.
- * @param nofailback The CRM tries to run services on the node
- * with the highest priority. If a node with higher priority
- * comes online, the CRM migrates the service to that node.
- * Enabling nofailback prevents that behavior.
- * @param restricted Resources bound to restricted groups may
- * only run on nodes defined by the group.
- * @param type Group type. Enum: group
- * @return Result
- * @throws JSONException
- */
- public Result create(String group, String nodes, String comment, Boolean nofailback, Boolean restricted, String type) throws JSONException {
- return createRest(group, nodes, comment, nofailback, restricted, type);
- }
-
- /**
- * Create a new HA group.
- *
- * @param group The HA group identifier.
- * @param nodes List of cluster node names with optional
- * priority.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String group, String nodes) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("group", group);
- parameters.put("nodes", nodes);
- return _client.create("/cluster/ha/groups", parameters);
- }
-
- /**
- * Create a new HA group.
- *
- * @param group The HA group identifier.
- * @param nodes List of cluster node names with optional
- * priority.
- * @return Result
- * @throws JSONException
- */
- public Result create(String group, String nodes) throws JSONException {
- return createRest(group, nodes);
- }
-
- }
-
- public class PVEStatus {
-
- private final PveClient _client;
-
- protected PVEStatus(PveClient client) {
- _client = client;
-
- }
-
- private PVECurrent _current;
-
- public PVECurrent getCurrent() {
- if (_current == null) {
- _current = new PVECurrent(_client);
- }
-
- return _current;
- }
- private PVEManagerStatus _managerStatus;
-
- public PVEManagerStatus getManagerStatus() {
- if (_managerStatus == null) {
- _managerStatus = new PVEManagerStatus(_client);
- }
-
- return _managerStatus;
- }
-
- public class PVECurrent {
-
- private final PveClient _client;
-
- protected PVECurrent(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get HA manger status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ha/status/current", null);
- }
-
- /**
- * Get HA manger status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result status() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEManagerStatus {
-
- private final PveClient _client;
-
- protected PVEManagerStatus(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get full HA manger status, including LRM status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ha/status/manager_status", null);
- }
-
- /**
- * Get full HA manger status, including LRM status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result managerStatus() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ha/status", null);
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ha", null);
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEAcme {
-
- private final PveClient _client;
-
- protected PVEAcme(PveClient client) {
- _client = client;
-
- }
-
- private PVEAccount _account;
-
- public PVEAccount getAccount() {
- if (_account == null) {
- _account = new PVEAccount(_client);
- }
-
- return _account;
- }
- private PVETos _tos;
-
- public PVETos getTos() {
- if (_tos == null) {
- _tos = new PVETos(_client);
- }
-
- return _tos;
- }
- private PVEDirectories _directories;
-
- public PVEDirectories getDirectories() {
- if (_directories == null) {
- _directories = new PVEDirectories(_client);
- }
-
- return _directories;
- }
-
- public class PVEAccount {
-
- private final PveClient _client;
-
- protected PVEAccount(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemName get(Object name) {
- return new PVEItemName(_client, name);
- }
-
- public class PVEItemName {
-
- private final PveClient _client;
- private final Object _name;
-
- protected PVEItemName(PveClient client, Object name) {
- _client = client;
- _name = name;
- }
-
- /**
- * Deactivate existing ACME account at CA.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/cluster/acme/account/" + _name + "", null);
- }
-
- /**
- * Deactivate existing ACME account at CA.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deactivateAccount() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Return existing ACME account information.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/acme/account/" + _name + "", null);
- }
-
- /**
- * Return existing ACME account information.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getAccount() throws JSONException {
- return getRest();
- }
-
- /**
- * Update existing ACME account information with CA. Note:
- * not specifying any new account information triggers a
- * refresh.
- *
- * @param contact Contact email addresses.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String contact) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("contact", contact);
- return _client.set("/cluster/acme/account/" + _name + "", parameters);
- }
-
- /**
- * Update existing ACME account information with CA. Note:
- * not specifying any new account information triggers a
- * refresh.
- *
- * @param contact Contact email addresses.
- * @return Result
- * @throws JSONException
- */
- public Result updateAccount(String contact) throws JSONException {
- return setRest(contact);
- }
-
- /**
- * Update existing ACME account information with CA. Note:
- * not specifying any new account information triggers a
- * refresh.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/cluster/acme/account/" + _name + "", null);
- }
-
- /**
- * Update existing ACME account information with CA. Note:
- * not specifying any new account information triggers a
- * refresh.
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateAccount() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * ACMEAccount index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/acme/account", null);
- }
-
- /**
- * ACMEAccount index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result accountIndex() throws JSONException {
- return getRest();
- }
-
- /**
- * Register a new ACME account with CA.
- *
- * @param contact Contact email addresses.
- * @param directory URL of ACME CA directory endpoint.
- * @param name ACME account config file name.
- * @param tos_url URL of CA TermsOfService - setting this
- * indicates agreement.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String contact, String directory, String name, String tos_url) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("contact", contact);
- parameters.put("directory", directory);
- parameters.put("name", name);
- parameters.put("tos_url", tos_url);
- return _client.create("/cluster/acme/account", parameters);
- }
-
- /**
- * Register a new ACME account with CA.
- *
- * @param contact Contact email addresses.
- * @param directory URL of ACME CA directory endpoint.
- * @param name ACME account config file name.
- * @param tos_url URL of CA TermsOfService - setting this
- * indicates agreement.
- * @return Result
- * @throws JSONException
- */
- public Result registerAccount(String contact, String directory, String name, String tos_url) throws JSONException {
- return createRest(contact, directory, name, tos_url);
- }
-
- /**
- * Register a new ACME account with CA.
- *
- * @param contact Contact email addresses.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String contact) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("contact", contact);
- return _client.create("/cluster/acme/account", parameters);
- }
-
- /**
- * Register a new ACME account with CA.
- *
- * @param contact Contact email addresses.
- * @return Result
- * @throws JSONException
- */
- public Result registerAccount(String contact) throws JSONException {
- return createRest(contact);
- }
-
- }
-
- public class PVETos {
-
- private final PveClient _client;
-
- protected PVETos(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Retrieve ACME TermsOfService URL from CA.
- *
- * @param directory URL of ACME CA directory endpoint.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String directory) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("directory", directory);
- return _client.get("/cluster/acme/tos", parameters);
- }
-
- /**
- * Retrieve ACME TermsOfService URL from CA.
- *
- * @param directory URL of ACME CA directory endpoint.
- * @return Result
- * @throws JSONException
- */
- public Result getTos(String directory) throws JSONException {
- return getRest(directory);
- }
-
- /**
- * Retrieve ACME TermsOfService URL from CA.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/acme/tos", null);
- }
-
- /**
- * Retrieve ACME TermsOfService URL from CA.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getTos() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEDirectories {
-
- private final PveClient _client;
-
- protected PVEDirectories(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get named known ACME directory endpoints.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/acme/directories", null);
- }
-
- /**
- * Get named known ACME directory endpoints.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getDirectories() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * ACMEAccount index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/acme", null);
- }
-
- /**
- * ACMEAccount index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVELog {
-
- private final PveClient _client;
-
- protected PVELog(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Read cluster log
- *
- * @param max Maximum number of entries.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(Integer max) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("max", max);
- return _client.get("/cluster/log", parameters);
- }
-
- /**
- * Read cluster log
- *
- * @param max Maximum number of entries.
- * @return Result
- * @throws JSONException
- */
- public Result log(Integer max) throws JSONException {
- return getRest(max);
- }
-
- /**
- * Read cluster log
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/log", null);
- }
-
- /**
- * Read cluster log
- *
- * @return Result
- * @throws JSONException
- */
- public Result log() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEResources {
-
- private final PveClient _client;
-
- protected PVEResources(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Resources index (cluster wide).
- *
- * @param type Enum: vm,storage,node
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("type", type);
- return _client.get("/cluster/resources", parameters);
- }
-
- /**
- * Resources index (cluster wide).
- *
- * @param type Enum: vm,storage,node
- * @return Result
- * @throws JSONException
- */
- public Result resources(String type) throws JSONException {
- return getRest(type);
- }
-
- /**
- * Resources index (cluster wide).
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/resources", null);
- }
-
- /**
- * Resources index (cluster wide).
- *
- * @return Result
- * @throws JSONException
- */
- public Result resources() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVETasks {
-
- private final PveClient _client;
-
- protected PVETasks(PveClient client) {
- _client = client;
-
- }
-
- /**
- * List recent tasks (cluster wide).
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/tasks", null);
- }
-
- /**
- * List recent tasks (cluster wide).
- *
- * @return Result
- * @throws JSONException
- */
- public Result tasks() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEOptions {
-
- private final PveClient _client;
-
- protected PVEOptions(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get datacenter options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/options", null);
- }
-
- /**
- * Get datacenter options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getOptions() throws JSONException {
- return getRest();
- }
-
- /**
- * Set datacenter options.
- *
- * @param bwlimit Set bandwidth/io limits various operations.
- * @param console Select the default Console viewer. You can either
- * use the builtin java applet (VNC; deprecated and maps to html5),
- * an external virt-viewer comtatible application (SPICE), an HTML5
- * based vnc viewer (noVNC), or an HTML5 based console client
- * (xtermjs). If the selected viewer is not available (e.g. SPICE
- * not activated for the VM), the fallback is noVNC. Enum:
- * applet,vv,html5,xtermjs
- * @param delete A list of settings you want to delete.
- * @param email_from Specify email address to send notification from
- * (default is root@$hostname)
- * @param fencing Set the fencing mode of the HA cluster. Hardware
- * mode needs a valid configuration of fence devices in
- * /etc/pve/ha/fence.cfg. With both all two modes are used. WARNING:
- * 'hardware' and 'both' are EXPERIMENTAL & WIP Enum:
- * watchdog,hardware,both
- * @param ha Cluster wide HA settings.
- * @param http_proxy Specify external http proxy which is used for
- * downloads (example: 'http://username:password@host:port/')
- * @param keyboard Default keybord layout for vnc server. Enum:
- * de,de-ch,da,en-gb,en-us,es,fi,fr,fr-be,fr-ca,fr-ch,hu,is,it,ja,lt,mk,nl,no,pl,pt,pt-br,sv,sl,tr
- * @param language Default GUI language. Enum:
- * zh_CN,zh_TW,ca,en,eu,fr,de,it,es,ja,nb,nn,fa,pl,pt_BR,ru,sl,sv,tr
- * @param mac_prefix Prefix for autogenerated MAC addresses.
- * @param max_workers Defines how many workers (per node) are
- * maximal started on actions like 'stopall VMs' or task from the
- * ha-manager.
- * @param migration For cluster wide migration settings.
- * @param migration_unsecure Migration is secure using SSH tunnel by
- * default. For secure private networks you can disable it to speed
- * up migration. Deprecated, use the 'migration' property instead!
- * @param u2f u2f
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String bwlimit, String console, String delete, String email_from, String fencing, String ha, String http_proxy, String keyboard, String language, String mac_prefix, Integer max_workers, String migration, Boolean migration_unsecure, String u2f) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("bwlimit", bwlimit);
- parameters.put("console", console);
- parameters.put("delete", delete);
- parameters.put("email_from", email_from);
- parameters.put("fencing", fencing);
- parameters.put("ha", ha);
- parameters.put("http_proxy", http_proxy);
- parameters.put("keyboard", keyboard);
- parameters.put("language", language);
- parameters.put("mac_prefix", mac_prefix);
- parameters.put("max_workers", max_workers);
- parameters.put("migration", migration);
- parameters.put("migration_unsecure", migration_unsecure);
- parameters.put("u2f", u2f);
- return _client.set("/cluster/options", parameters);
- }
-
- /**
- * Set datacenter options.
- *
- * @param bwlimit Set bandwidth/io limits various operations.
- * @param console Select the default Console viewer. You can either
- * use the builtin java applet (VNC; deprecated and maps to html5),
- * an external virt-viewer comtatible application (SPICE), an HTML5
- * based vnc viewer (noVNC), or an HTML5 based console client
- * (xtermjs). If the selected viewer is not available (e.g. SPICE
- * not activated for the VM), the fallback is noVNC. Enum:
- * applet,vv,html5,xtermjs
- * @param delete A list of settings you want to delete.
- * @param email_from Specify email address to send notification from
- * (default is root@$hostname)
- * @param fencing Set the fencing mode of the HA cluster. Hardware
- * mode needs a valid configuration of fence devices in
- * /etc/pve/ha/fence.cfg. With both all two modes are used. WARNING:
- * 'hardware' and 'both' are EXPERIMENTAL & WIP Enum:
- * watchdog,hardware,both
- * @param ha Cluster wide HA settings.
- * @param http_proxy Specify external http proxy which is used for
- * downloads (example: 'http://username:password@host:port/')
- * @param keyboard Default keybord layout for vnc server. Enum:
- * de,de-ch,da,en-gb,en-us,es,fi,fr,fr-be,fr-ca,fr-ch,hu,is,it,ja,lt,mk,nl,no,pl,pt,pt-br,sv,sl,tr
- * @param language Default GUI language. Enum:
- * zh_CN,zh_TW,ca,en,eu,fr,de,it,es,ja,nb,nn,fa,pl,pt_BR,ru,sl,sv,tr
- * @param mac_prefix Prefix for autogenerated MAC addresses.
- * @param max_workers Defines how many workers (per node) are
- * maximal started on actions like 'stopall VMs' or task from the
- * ha-manager.
- * @param migration For cluster wide migration settings.
- * @param migration_unsecure Migration is secure using SSH tunnel by
- * default. For secure private networks you can disable it to speed
- * up migration. Deprecated, use the 'migration' property instead!
- * @param u2f u2f
- * @return Result
- * @throws JSONException
- */
- public Result setOptions(String bwlimit, String console, String delete, String email_from, String fencing, String ha, String http_proxy, String keyboard, String language, String mac_prefix, Integer max_workers, String migration, Boolean migration_unsecure, String u2f) throws JSONException {
- return setRest(bwlimit, console, delete, email_from, fencing, ha, http_proxy, keyboard, language, mac_prefix, max_workers, migration, migration_unsecure, u2f);
- }
-
- /**
- * Set datacenter options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/cluster/options", null);
- }
-
- /**
- * Set datacenter options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setOptions() throws JSONException {
- return setRest();
- }
-
- }
-
- public class PVEStatus {
-
- private final PveClient _client;
-
- protected PVEStatus(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get cluster status information.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/status", null);
- }
-
- /**
- * Get cluster status information.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getStatus() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVENextid {
-
- private final PveClient _client;
-
- protected PVENextid(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get next free VMID. If you pass an VMID it will raise an error if
- * the ID is already used.
- *
- * @param vmid The (unique) ID of the VM.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(Integer vmid) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("vmid", vmid);
- return _client.get("/cluster/nextid", parameters);
- }
-
- /**
- * Get next free VMID. If you pass an VMID it will raise an error if
- * the ID is already used.
- *
- * @param vmid The (unique) ID of the VM.
- * @return Result
- * @throws JSONException
- */
- public Result nextid(Integer vmid) throws JSONException {
- return getRest(vmid);
- }
-
- /**
- * Get next free VMID. If you pass an VMID it will raise an error if
- * the ID is already used.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/nextid", null);
- }
-
- /**
- * Get next free VMID. If you pass an VMID it will raise an error if
- * the ID is already used.
- *
- * @return Result
- * @throws JSONException
- */
- public Result nextid() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVECeph {
-
- private final PveClient _client;
-
- protected PVECeph(PveClient client) {
- _client = client;
-
- }
-
- private PVEMetadata _metadata;
-
- public PVEMetadata getMetadata() {
- if (_metadata == null) {
- _metadata = new PVEMetadata(_client);
- }
-
- return _metadata;
- }
- private PVEStatus _status;
-
- public PVEStatus getStatus() {
- if (_status == null) {
- _status = new PVEStatus(_client);
- }
-
- return _status;
- }
-
- public class PVEMetadata {
-
- private final PveClient _client;
-
- protected PVEMetadata(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get ceph metadata.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ceph/metadata", null);
- }
-
- /**
- * Get ceph metadata.
- *
- * @return Result
- * @throws JSONException
- */
- public Result cephMetadata() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEStatus {
-
- private final PveClient _client;
-
- protected PVEStatus(PveClient client) {
- _client = client;
-
- }
-
- /**
- * Get ceph status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ceph/status", null);
- }
-
- /**
- * Get ceph status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result cephstatus() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * Cluster ceph index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster/ceph", null);
- }
-
- /**
- * Cluster ceph index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result cephindex() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * Cluster index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/cluster", null);
- }
-
- /**
- * Cluster index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVENodes {
-
- private final PveClient _client;
-
- protected PVENodes(PveClient client) {
- _client = client;
-
- }
-
- public PVEItemNode get(Object node) {
- return new PVEItemNode(_client, node);
- }
-
- public class PVEItemNode {
-
- private final PveClient _client;
- private final Object _node;
-
- protected PVEItemNode(PveClient client, Object node) {
- _client = client;
- _node = node;
- }
-
- private PVEQemu _qemu;
-
- public PVEQemu getQemu() {
- if (_qemu == null) {
- _qemu = new PVEQemu(_client, _node);
- }
-
- return _qemu;
- }
- private PVELxc _lxc;
-
- public PVELxc getLxc() {
- if (_lxc == null) {
- _lxc = new PVELxc(_client, _node);
- }
-
- return _lxc;
- }
- private PVECeph _ceph;
-
- public PVECeph getCeph() {
- if (_ceph == null) {
- _ceph = new PVECeph(_client, _node);
- }
-
- return _ceph;
- }
- private PVEVzdump _vzdump;
-
- public PVEVzdump getVzdump() {
- if (_vzdump == null) {
- _vzdump = new PVEVzdump(_client, _node);
- }
-
- return _vzdump;
- }
- private PVEServices _services;
-
- public PVEServices getServices() {
- if (_services == null) {
- _services = new PVEServices(_client, _node);
- }
-
- return _services;
- }
- private PVESubscription _subscription;
-
- public PVESubscription getSubscription() {
- if (_subscription == null) {
- _subscription = new PVESubscription(_client, _node);
- }
-
- return _subscription;
- }
- private PVENetwork _network;
-
- public PVENetwork getNetwork() {
- if (_network == null) {
- _network = new PVENetwork(_client, _node);
- }
-
- return _network;
- }
- private PVETasks _tasks;
-
- public PVETasks getTasks() {
- if (_tasks == null) {
- _tasks = new PVETasks(_client, _node);
- }
-
- return _tasks;
- }
- private PVEScan _scan;
-
- public PVEScan getScan() {
- if (_scan == null) {
- _scan = new PVEScan(_client, _node);
- }
-
- return _scan;
- }
- private PVEHardware _hardware;
-
- public PVEHardware getHardware() {
- if (_hardware == null) {
- _hardware = new PVEHardware(_client, _node);
- }
-
- return _hardware;
- }
- private PVEStorage _storage;
-
- public PVEStorage getStorage() {
- if (_storage == null) {
- _storage = new PVEStorage(_client, _node);
- }
-
- return _storage;
- }
- private PVEDisks _disks;
-
- public PVEDisks getDisks() {
- if (_disks == null) {
- _disks = new PVEDisks(_client, _node);
- }
-
- return _disks;
- }
- private PVEApt _apt;
-
- public PVEApt getApt() {
- if (_apt == null) {
- _apt = new PVEApt(_client, _node);
- }
-
- return _apt;
- }
- private PVEFirewall _firewall;
-
- public PVEFirewall getFirewall() {
- if (_firewall == null) {
- _firewall = new PVEFirewall(_client, _node);
- }
-
- return _firewall;
- }
- private PVEReplication _replication;
-
- public PVEReplication getReplication() {
- if (_replication == null) {
- _replication = new PVEReplication(_client, _node);
- }
-
- return _replication;
- }
- private PVECertificates _certificates;
-
- public PVECertificates getCertificates() {
- if (_certificates == null) {
- _certificates = new PVECertificates(_client, _node);
- }
-
- return _certificates;
- }
- private PVEConfig _config;
-
- public PVEConfig getConfig() {
- if (_config == null) {
- _config = new PVEConfig(_client, _node);
- }
-
- return _config;
- }
- private PVEVersion _version;
-
- public PVEVersion getVersion() {
- if (_version == null) {
- _version = new PVEVersion(_client, _node);
- }
-
- return _version;
- }
- private PVEStatus _status;
-
- public PVEStatus getStatus() {
- if (_status == null) {
- _status = new PVEStatus(_client, _node);
- }
-
- return _status;
- }
- private PVENetstat _netstat;
-
- public PVENetstat getNetstat() {
- if (_netstat == null) {
- _netstat = new PVENetstat(_client, _node);
- }
-
- return _netstat;
- }
- private PVEExecute _execute;
-
- public PVEExecute getExecute() {
- if (_execute == null) {
- _execute = new PVEExecute(_client, _node);
- }
-
- return _execute;
- }
- private PVEWakeonlan _wakeonlan;
-
- public PVEWakeonlan getWakeonlan() {
- if (_wakeonlan == null) {
- _wakeonlan = new PVEWakeonlan(_client, _node);
- }
-
- return _wakeonlan;
- }
- private PVERrd _rrd;
-
- public PVERrd getRrd() {
- if (_rrd == null) {
- _rrd = new PVERrd(_client, _node);
- }
-
- return _rrd;
- }
- private PVERrddata _rrddata;
-
- public PVERrddata getRrddata() {
- if (_rrddata == null) {
- _rrddata = new PVERrddata(_client, _node);
- }
-
- return _rrddata;
- }
- private PVESyslog _syslog;
-
- public PVESyslog getSyslog() {
- if (_syslog == null) {
- _syslog = new PVESyslog(_client, _node);
- }
-
- return _syslog;
- }
- private PVEJournal _journal;
-
- public PVEJournal getJournal() {
- if (_journal == null) {
- _journal = new PVEJournal(_client, _node);
- }
-
- return _journal;
- }
- private PVEVncshell _vncshell;
-
- public PVEVncshell getVncshell() {
- if (_vncshell == null) {
- _vncshell = new PVEVncshell(_client, _node);
- }
-
- return _vncshell;
- }
- private PVETermproxy _termproxy;
-
- public PVETermproxy getTermproxy() {
- if (_termproxy == null) {
- _termproxy = new PVETermproxy(_client, _node);
- }
-
- return _termproxy;
- }
- private PVEVncwebsocket _vncwebsocket;
-
- public PVEVncwebsocket getVncwebsocket() {
- if (_vncwebsocket == null) {
- _vncwebsocket = new PVEVncwebsocket(_client, _node);
- }
-
- return _vncwebsocket;
- }
- private PVESpiceshell _spiceshell;
-
- public PVESpiceshell getSpiceshell() {
- if (_spiceshell == null) {
- _spiceshell = new PVESpiceshell(_client, _node);
- }
-
- return _spiceshell;
- }
- private PVEDns _dns;
-
- public PVEDns getDns() {
- if (_dns == null) {
- _dns = new PVEDns(_client, _node);
- }
-
- return _dns;
- }
- private PVETime _time;
-
- public PVETime getTime() {
- if (_time == null) {
- _time = new PVETime(_client, _node);
- }
-
- return _time;
- }
- private PVEAplinfo _aplinfo;
-
- public PVEAplinfo getAplinfo() {
- if (_aplinfo == null) {
- _aplinfo = new PVEAplinfo(_client, _node);
- }
-
- return _aplinfo;
- }
- private PVEReport _report;
-
- public PVEReport getReport() {
- if (_report == null) {
- _report = new PVEReport(_client, _node);
- }
-
- return _report;
- }
- private PVEStartall _startall;
-
- public PVEStartall getStartall() {
- if (_startall == null) {
- _startall = new PVEStartall(_client, _node);
- }
-
- return _startall;
- }
- private PVEStopall _stopall;
-
- public PVEStopall getStopall() {
- if (_stopall == null) {
- _stopall = new PVEStopall(_client, _node);
- }
-
- return _stopall;
- }
- private PVEMigrateall _migrateall;
-
- public PVEMigrateall getMigrateall() {
- if (_migrateall == null) {
- _migrateall = new PVEMigrateall(_client, _node);
- }
-
- return _migrateall;
- }
- private PVEHosts _hosts;
-
- public PVEHosts getHosts() {
- if (_hosts == null) {
- _hosts = new PVEHosts(_client, _node);
- }
-
- return _hosts;
- }
-
- public class PVEQemu {
-
- private final PveClient _client;
- private final Object _node;
-
- protected PVEQemu(PveClient client, Object node) {
- _client = client;
- _node = node;
- }
-
- public PVEItemVmid get(Object vmid) {
- return new PVEItemVmid(_client, _node, vmid);
- }
-
- public class PVEItemVmid {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEItemVmid(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- private PVEFirewall _firewall;
-
- public PVEFirewall getFirewall() {
- if (_firewall == null) {
- _firewall = new PVEFirewall(_client, _node, _vmid);
- }
-
- return _firewall;
- }
- private PVEAgent _agent;
-
- public PVEAgent getAgent() {
- if (_agent == null) {
- _agent = new PVEAgent(_client, _node, _vmid);
- }
-
- return _agent;
- }
- private PVERrd _rrd;
-
- public PVERrd getRrd() {
- if (_rrd == null) {
- _rrd = new PVERrd(_client, _node, _vmid);
- }
-
- return _rrd;
- }
- private PVERrddata _rrddata;
-
- public PVERrddata getRrddata() {
- if (_rrddata == null) {
- _rrddata = new PVERrddata(_client, _node, _vmid);
- }
-
- return _rrddata;
- }
- private PVEConfig _config;
-
- public PVEConfig getConfig() {
- if (_config == null) {
- _config = new PVEConfig(_client, _node, _vmid);
- }
-
- return _config;
- }
- private PVEPending _pending;
-
- public PVEPending getPending() {
- if (_pending == null) {
- _pending = new PVEPending(_client, _node, _vmid);
- }
-
- return _pending;
- }
- private PVEUnlink _unlink;
-
- public PVEUnlink getUnlink() {
- if (_unlink == null) {
- _unlink = new PVEUnlink(_client, _node, _vmid);
- }
-
- return _unlink;
- }
- private PVEVncproxy _vncproxy;
-
- public PVEVncproxy getVncproxy() {
- if (_vncproxy == null) {
- _vncproxy = new PVEVncproxy(_client, _node, _vmid);
- }
-
- return _vncproxy;
- }
- private PVETermproxy _termproxy;
-
- public PVETermproxy getTermproxy() {
- if (_termproxy == null) {
- _termproxy = new PVETermproxy(_client, _node, _vmid);
- }
-
- return _termproxy;
- }
- private PVEVncwebsocket _vncwebsocket;
-
- public PVEVncwebsocket getVncwebsocket() {
- if (_vncwebsocket == null) {
- _vncwebsocket = new PVEVncwebsocket(_client, _node, _vmid);
- }
-
- return _vncwebsocket;
- }
- private PVESpiceproxy _spiceproxy;
-
- public PVESpiceproxy getSpiceproxy() {
- if (_spiceproxy == null) {
- _spiceproxy = new PVESpiceproxy(_client, _node, _vmid);
- }
-
- return _spiceproxy;
- }
- private PVEStatus _status;
-
- public PVEStatus getStatus() {
- if (_status == null) {
- _status = new PVEStatus(_client, _node, _vmid);
- }
-
- return _status;
- }
- private PVESendkey _sendkey;
-
- public PVESendkey getSendkey() {
- if (_sendkey == null) {
- _sendkey = new PVESendkey(_client, _node, _vmid);
- }
-
- return _sendkey;
- }
- private PVEFeature _feature;
-
- public PVEFeature getFeature() {
- if (_feature == null) {
- _feature = new PVEFeature(_client, _node, _vmid);
- }
-
- return _feature;
- }
- private PVEClone _clone;
-
- public PVEClone getClone() {
- if (_clone == null) {
- _clone = new PVEClone(_client, _node, _vmid);
- }
-
- return _clone;
- }
- private PVEMoveDisk _moveDisk;
-
- public PVEMoveDisk getMoveDisk() {
- if (_moveDisk == null) {
- _moveDisk = new PVEMoveDisk(_client, _node, _vmid);
- }
-
- return _moveDisk;
- }
- private PVEMigrate _migrate;
-
- public PVEMigrate getMigrate() {
- if (_migrate == null) {
- _migrate = new PVEMigrate(_client, _node, _vmid);
- }
-
- return _migrate;
- }
- private PVEMonitor _monitor;
-
- public PVEMonitor getMonitor() {
- if (_monitor == null) {
- _monitor = new PVEMonitor(_client, _node, _vmid);
- }
-
- return _monitor;
- }
- private PVEResize _resize;
-
- public PVEResize getResize() {
- if (_resize == null) {
- _resize = new PVEResize(_client, _node, _vmid);
- }
-
- return _resize;
- }
- private PVESnapshot _snapshot;
-
- public PVESnapshot getSnapshot() {
- if (_snapshot == null) {
- _snapshot = new PVESnapshot(_client, _node, _vmid);
- }
-
- return _snapshot;
- }
- private PVETemplate _template;
-
- public PVETemplate getTemplate() {
- if (_template == null) {
- _template = new PVETemplate(_client, _node, _vmid);
- }
-
- return _template;
- }
- private PVECloudinit _cloudinit;
-
- public PVECloudinit getCloudinit() {
- if (_cloudinit == null) {
- _cloudinit = new PVECloudinit(_client, _node, _vmid);
- }
-
- return _cloudinit;
- }
-
- public class PVEFirewall {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEFirewall(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- private PVERules _rules;
-
- public PVERules getRules() {
- if (_rules == null) {
- _rules = new PVERules(_client, _node, _vmid);
- }
-
- return _rules;
- }
- private PVEAliases _aliases;
-
- public PVEAliases getAliases() {
- if (_aliases == null) {
- _aliases = new PVEAliases(_client, _node, _vmid);
- }
-
- return _aliases;
- }
- private PVEIpset _ipset;
-
- public PVEIpset getIpset() {
- if (_ipset == null) {
- _ipset = new PVEIpset(_client, _node, _vmid);
- }
-
- return _ipset;
- }
- private PVEOptions _options;
-
- public PVEOptions getOptions() {
- if (_options == null) {
- _options = new PVEOptions(_client, _node, _vmid);
- }
-
- return _options;
- }
- private PVELog _log;
-
- public PVELog getLog() {
- if (_log == null) {
- _log = new PVELog(_client, _node, _vmid);
- }
-
- return _log;
- }
- private PVERefs _refs;
-
- public PVERefs getRefs() {
- if (_refs == null) {
- _refs = new PVERefs(_client, _node, _vmid);
- }
-
- return _refs;
- }
-
- public class PVERules {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVERules(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- public PVEItemPos get(Object pos) {
- return new PVEItemPos(_client, _node, _vmid, pos);
- }
-
- public class PVEItemPos {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _pos;
-
- protected PVEItemPos(PveClient client, Object node, Object vmid, Object pos) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _pos = pos;
- }
-
- /**
- * Delete rule.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("digest", digest);
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", parameters);
- }
-
- /**
- * Delete rule.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRule(String digest) throws JSONException {
- return deleteRest(digest);
- }
-
- /**
- * Delete rule.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", null);
- }
-
- /**
- * Delete rule.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRule() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Get single rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", null);
- }
-
- /**
- * Get single rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRule() throws JSONException {
- return getRest();
- }
-
- /**
- * Modify rule data.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param comment Descriptive comment.
- * @param delete A list of settings you want to
- * delete.
- * @param dest Restrict packet destination
- * address. This can refer to a single IP
- * address, an IP set ('+ipsetname') or an IP
- * alias definition. You can also specify an
- * address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated
- * by comma). Please do not mix IPv4 and IPv6
- * addresses inside such lists.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param dport Restrict TCP/UDP destination
- * port. You can use service names or simple
- * numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified
- * with '\d+:\d+', for example '80:85', and you
- * can use comma separated list to match several
- * ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have
- * to use network configuration key names for
- * VMs and containers ('net\d+'). Host related
- * rules can use arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param moveto Move rule to new position
- * <moveto>. Other arguments are
- * ignored.
- * @param proto IP protocol. You can use
- * protocol names ('tcp'/'udp') or simple
- * numbers, as defined in '/etc/protocols'.
- * @param source Restrict packet source address.
- * This can refer to a single IP address, an IP
- * set ('+ipsetname') or an IP alias definition.
- * You can also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated
- * by comma). Please do not mix IPv4 and IPv6
- * addresses inside such lists.
- * @param sport Restrict TCP/UDP source port.
- * You can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'.
- * Port ranges can be specified with '\d+:\d+',
- * for example '80:85', and you can use comma
- * separated list to match several ports or
- * ranges.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("comment", comment);
- parameters.put("delete", delete);
- parameters.put("dest", dest);
- parameters.put("digest", digest);
- parameters.put("dport", dport);
- parameters.put("enable", enable);
- parameters.put("iface", iface);
- parameters.put("log", log);
- parameters.put("macro", macro);
- parameters.put("moveto", moveto);
- parameters.put("proto", proto);
- parameters.put("source", source);
- parameters.put("sport", sport);
- parameters.put("type", type);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", parameters);
- }
-
- /**
- * Modify rule data.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param comment Descriptive comment.
- * @param delete A list of settings you want to
- * delete.
- * @param dest Restrict packet destination
- * address. This can refer to a single IP
- * address, an IP set ('+ipsetname') or an IP
- * alias definition. You can also specify an
- * address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated
- * by comma). Please do not mix IPv4 and IPv6
- * addresses inside such lists.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param dport Restrict TCP/UDP destination
- * port. You can use service names or simple
- * numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified
- * with '\d+:\d+', for example '80:85', and you
- * can use comma separated list to match several
- * ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have
- * to use network configuration key names for
- * VMs and containers ('net\d+'). Host related
- * rules can use arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param moveto Move rule to new position
- * <moveto>. Other arguments are
- * ignored.
- * @param proto IP protocol. You can use
- * protocol names ('tcp'/'udp') or simple
- * numbers, as defined in '/etc/protocols'.
- * @param source Restrict packet source address.
- * This can refer to a single IP address, an IP
- * set ('+ipsetname') or an IP alias definition.
- * You can also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated
- * by comma). Please do not mix IPv4 and IPv6
- * addresses inside such lists.
- * @param sport Restrict TCP/UDP source port.
- * You can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'.
- * Port ranges can be specified with '\d+:\d+',
- * for example '80:85', and you can use comma
- * separated list to match several ports or
- * ranges.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result updateRule(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
- return setRest(action, comment, delete, dest, digest, dport, enable, iface, log, macro, moveto, proto, source, sport, type);
- }
-
- /**
- * Modify rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", null);
- }
-
- /**
- * Modify rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateRule() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * List rules.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules", null);
- }
-
- /**
- * List rules.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRules() throws JSONException {
- return getRest();
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param type Rule type. Enum: in,out,group
- * @param comment Descriptive comment.
- * @param dest Restrict packet destination address.
- * This can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by
- * comma). Please do not mix IPv4 and IPv6 addresses
- * inside such lists.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param dport Restrict TCP/UDP destination port.
- * You can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'. Port
- * ranges can be specified with '\d+:\d+', for
- * example '80:85', and you can use comma separated
- * list to match several ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to
- * use network configuration key names for VMs and
- * containers ('net\d+'). Host related rules can use
- * arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param pos Update rule at position
- * <pos>.
- * @param proto IP protocol. You can use protocol
- * names ('tcp'/'udp') or simple numbers, as defined
- * in '/etc/protocols'.
- * @param source Restrict packet source address.
- * This can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by
- * comma). Please do not mix IPv4 and IPv6 addresses
- * inside such lists.
- * @param sport Restrict TCP/UDP source port. You
- * can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'. Port
- * ranges can be specified with '\d+:\d+', for
- * example '80:85', and you can use comma separated
- * list to match several ports or ranges.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("type", type);
- parameters.put("comment", comment);
- parameters.put("dest", dest);
- parameters.put("digest", digest);
- parameters.put("dport", dport);
- parameters.put("enable", enable);
- parameters.put("iface", iface);
- parameters.put("log", log);
- parameters.put("macro", macro);
- parameters.put("pos", pos);
- parameters.put("proto", proto);
- parameters.put("source", source);
- parameters.put("sport", sport);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules", parameters);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param type Rule type. Enum: in,out,group
- * @param comment Descriptive comment.
- * @param dest Restrict packet destination address.
- * This can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by
- * comma). Please do not mix IPv4 and IPv6 addresses
- * inside such lists.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param dport Restrict TCP/UDP destination port.
- * You can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'. Port
- * ranges can be specified with '\d+:\d+', for
- * example '80:85', and you can use comma separated
- * list to match several ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to
- * use network configuration key names for VMs and
- * containers ('net\d+'). Host related rules can use
- * arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param pos Update rule at position
- * <pos>.
- * @param proto IP protocol. You can use protocol
- * names ('tcp'/'udp') or simple numbers, as defined
- * in '/etc/protocols'.
- * @param source Restrict packet source address.
- * This can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by
- * comma). Please do not mix IPv4 and IPv6 addresses
- * inside such lists.
- * @param sport Restrict TCP/UDP source port. You
- * can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'. Port
- * ranges can be specified with '\d+:\d+', for
- * example '80:85', and you can use comma separated
- * list to match several ports or ranges.
- * @return Result
- * @throws JSONException
- */
- public Result createRule(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
- return createRest(action, type, comment, dest, digest, dport, enable, iface, log, macro, pos, proto, source, sport);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String action, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("type", type);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules", parameters);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result createRule(String action, String type) throws JSONException {
- return createRest(action, type);
- }
-
- }
-
- public class PVEAliases {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEAliases(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- public PVEItemName get(Object name) {
- return new PVEItemName(_client, _node, _vmid, name);
- }
-
- public class PVEItemName {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _name;
-
- protected PVEItemName(PveClient client, Object node, Object vmid, Object name) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _name = name;
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("digest", digest);
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", parameters);
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @return Result
- * @throws JSONException
- */
- public Result removeAlias(String digest) throws JSONException {
- return deleteRest(digest);
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", null);
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result removeAlias() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Read alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", null);
- }
-
- /**
- * Read alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result readAlias() throws JSONException {
- return getRest();
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param rename Rename an existing alias.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String cidr, String comment, String digest, String rename) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("comment", comment);
- parameters.put("digest", digest);
- parameters.put("rename", rename);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", parameters);
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param rename Rename an existing alias.
- * @return Result
- * @throws JSONException
- */
- public Result updateAlias(String cidr, String comment, String digest, String rename) throws JSONException {
- return setRest(cidr, comment, digest, rename);
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String cidr) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", parameters);
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @return Result
- * @throws JSONException
- */
- public Result updateAlias(String cidr) throws JSONException {
- return setRest(cidr);
- }
-
- }
-
- /**
- * List aliases
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases", null);
- }
-
- /**
- * List aliases
- *
- * @return Result
- * @throws JSONException
- */
- public Result getAliases() throws JSONException {
- return getRest();
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param name Alias name.
- * @param comment
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr, String name, String comment) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("name", name);
- parameters.put("comment", comment);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases", parameters);
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param name Alias name.
- * @param comment
- * @return Result
- * @throws JSONException
- */
- public Result createAlias(String cidr, String name, String comment) throws JSONException {
- return createRest(cidr, name, comment);
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param name Alias name.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr, String name) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("name", name);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases", parameters);
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param name Alias name.
- * @return Result
- * @throws JSONException
- */
- public Result createAlias(String cidr, String name) throws JSONException {
- return createRest(cidr, name);
- }
-
- }
-
- public class PVEIpset {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEIpset(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- public PVEItemName get(Object name) {
- return new PVEItemName(_client, _node, _vmid, name);
- }
-
- public class PVEItemName {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _name;
-
- protected PVEItemName(PveClient client, Object node, Object vmid, Object name) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _name = name;
- }
-
- public PVEItemCidr get(Object cidr) {
- return new PVEItemCidr(_client, _node, _vmid, _name, cidr);
- }
-
- public class PVEItemCidr {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _name;
- private final Object _cidr;
-
- protected PVEItemCidr(PveClient client, Object node, Object vmid, Object name, Object cidr) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _name = name;
- _cidr = cidr;
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1
- * digest. This can be used to prevent
- * concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("digest", digest);
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", parameters);
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1
- * digest. This can be used to prevent
- * concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result removeIp(String digest) throws JSONException {
- return deleteRest(digest);
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", null);
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result removeIp() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Read IP or Network settings from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", null);
- }
-
- /**
- * Read IP or Network settings from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result readIp() throws JSONException {
- return getRest();
- }
-
- /**
- * Update IP or Network settings
- *
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1
- * digest. This can be used to prevent
- * concurrent modifications.
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String comment, String digest, Boolean nomatch) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("comment", comment);
- parameters.put("digest", digest);
- parameters.put("nomatch", nomatch);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", parameters);
- }
-
- /**
- * Update IP or Network settings
- *
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1
- * digest. This can be used to prevent
- * concurrent modifications.
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result updateIp(String comment, String digest, Boolean nomatch) throws JSONException {
- return setRest(comment, digest, nomatch);
- }
-
- /**
- * Update IP or Network settings
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", null);
- }
-
- /**
- * Update IP or Network settings
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateIp() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * Delete IPSet
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", null);
- }
-
- /**
- * Delete IPSet
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteIpset() throws JSONException {
- return deleteRest();
- }
-
- /**
- * List IPSet content
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", null);
- }
-
- /**
- * List IPSet content
- *
- * @return Result
- * @throws JSONException
- */
- public Result getIpset() throws JSONException {
- return getRest();
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param comment
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr, String comment, Boolean nomatch) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("comment", comment);
- parameters.put("nomatch", nomatch);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", parameters);
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param comment
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result createIp(String cidr, String comment, Boolean nomatch) throws JSONException {
- return createRest(cidr, comment, nomatch);
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", parameters);
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @return Result
- * @throws JSONException
- */
- public Result createIp(String cidr) throws JSONException {
- return createRest(cidr);
- }
-
- }
-
- /**
- * List IPSets
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset", null);
- }
-
- /**
- * List IPSets
- *
- * @return Result
- * @throws JSONException
- */
- public Result ipsetIndex() throws JSONException {
- return getRest();
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param rename Rename an existing IPSet. You can
- * set 'rename' to the same value as 'name' to
- * update the 'comment' of an existing IPSet.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String name, String comment, String digest, String rename) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("name", name);
- parameters.put("comment", comment);
- parameters.put("digest", digest);
- parameters.put("rename", rename);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset", parameters);
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param rename Rename an existing IPSet. You can
- * set 'rename' to the same value as 'name' to
- * update the 'comment' of an existing IPSet.
- * @return Result
- * @throws JSONException
- */
- public Result createIpset(String name, String comment, String digest, String rename) throws JSONException {
- return createRest(name, comment, digest, rename);
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String name) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("name", name);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset", parameters);
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @return Result
- * @throws JSONException
- */
- public Result createIpset(String name) throws JSONException {
- return createRest(name);
- }
-
- }
-
- public class PVEOptions {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEOptions(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Get VM firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/options", null);
- }
-
- /**
- * Get VM firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getOptions() throws JSONException {
- return getRest();
- }
-
- /**
- * Set Firewall options.
- *
- * @param delete A list of settings you want to
- * delete.
- * @param dhcp Enable DHCP.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param enable Enable/disable firewall rules.
- * @param ipfilter Enable default IP filters. This
- * is equivalent to adding an empty
- * ipfilter-net<id> ipset for every
- * interface. Such ipsets implicitly contain sane
- * default restrictions such as restricting IPv6
- * link local addresses to the one derived from the
- * interface's MAC address. For containers the
- * configured IP addresses will be implicitly added.
- * @param log_level_in Log level for incoming
- * traffic. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param log_level_out Log level for outgoing
- * traffic. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macfilter Enable/disable MAC address
- * filter.
- * @param ndp Enable NDP.
- * @param policy_in Input policy. Enum:
- * ACCEPT,REJECT,DROP
- * @param policy_out Output policy. Enum:
- * ACCEPT,REJECT,DROP
- * @param radv Allow sending Router Advertisement.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String delete, Boolean dhcp, String digest, Boolean enable, Boolean ipfilter, String log_level_in, String log_level_out, Boolean macfilter, Boolean ndp, String policy_in, String policy_out, Boolean radv) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("delete", delete);
- parameters.put("dhcp", dhcp);
- parameters.put("digest", digest);
- parameters.put("enable", enable);
- parameters.put("ipfilter", ipfilter);
- parameters.put("log_level_in", log_level_in);
- parameters.put("log_level_out", log_level_out);
- parameters.put("macfilter", macfilter);
- parameters.put("ndp", ndp);
- parameters.put("policy_in", policy_in);
- parameters.put("policy_out", policy_out);
- parameters.put("radv", radv);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/options", parameters);
- }
-
- /**
- * Set Firewall options.
- *
- * @param delete A list of settings you want to
- * delete.
- * @param dhcp Enable DHCP.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param enable Enable/disable firewall rules.
- * @param ipfilter Enable default IP filters. This
- * is equivalent to adding an empty
- * ipfilter-net<id> ipset for every
- * interface. Such ipsets implicitly contain sane
- * default restrictions such as restricting IPv6
- * link local addresses to the one derived from the
- * interface's MAC address. For containers the
- * configured IP addresses will be implicitly added.
- * @param log_level_in Log level for incoming
- * traffic. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param log_level_out Log level for outgoing
- * traffic. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macfilter Enable/disable MAC address
- * filter.
- * @param ndp Enable NDP.
- * @param policy_in Input policy. Enum:
- * ACCEPT,REJECT,DROP
- * @param policy_out Output policy. Enum:
- * ACCEPT,REJECT,DROP
- * @param radv Allow sending Router Advertisement.
- * @return Result
- * @throws JSONException
- */
- public Result setOptions(String delete, Boolean dhcp, String digest, Boolean enable, Boolean ipfilter, String log_level_in, String log_level_out, Boolean macfilter, Boolean ndp, String policy_in, String policy_out, Boolean radv) throws JSONException {
- return setRest(delete, dhcp, digest, enable, ipfilter, log_level_in, log_level_out, macfilter, ndp, policy_in, policy_out, radv);
- }
-
- /**
- * Set Firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/options", null);
- }
-
- /**
- * Set Firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setOptions() throws JSONException {
- return setRest();
- }
-
- }
-
- public class PVELog {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVELog(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Read firewall log
- *
- * @param limit
- * @param start
- * @return Result
- * @throws JSONException
- */
- public Result getRest(Integer limit, Integer start) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("limit", limit);
- parameters.put("start", start);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/log", parameters);
- }
-
- /**
- * Read firewall log
- *
- * @param limit
- * @param start
- * @return Result
- * @throws JSONException
- */
- public Result log(Integer limit, Integer start) throws JSONException {
- return getRest(limit, start);
- }
-
- /**
- * Read firewall log
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/log", null);
- }
-
- /**
- * Read firewall log
- *
- * @return Result
- * @throws JSONException
- */
- public Result log() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVERefs {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVERefs(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Lists possible IPSet/Alias reference which are
- * allowed in source/dest properties.
- *
- * @param type Only list references of specified
- * type. Enum: alias,ipset
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("type", type);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/refs", parameters);
- }
-
- /**
- * Lists possible IPSet/Alias reference which are
- * allowed in source/dest properties.
- *
- * @param type Only list references of specified
- * type. Enum: alias,ipset
- * @return Result
- * @throws JSONException
- */
- public Result refs(String type) throws JSONException {
- return getRest(type);
- }
-
- /**
- * Lists possible IPSet/Alias reference which are
- * allowed in source/dest properties.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/refs", null);
- }
-
- /**
- * Lists possible IPSet/Alias reference which are
- * allowed in source/dest properties.
- *
- * @return Result
- * @throws JSONException
- */
- public Result refs() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall", null);
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEAgent {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEAgent(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- private PVEFsfreeze_Freeze _fsfreeze_Freeze;
-
- public PVEFsfreeze_Freeze getFsfreeze_Freeze() {
- if (_fsfreeze_Freeze == null) {
- _fsfreeze_Freeze = new PVEFsfreeze_Freeze(_client, _node, _vmid);
- }
-
- return _fsfreeze_Freeze;
- }
- private PVEFsfreeze_Status _fsfreeze_Status;
-
- public PVEFsfreeze_Status getFsfreeze_Status() {
- if (_fsfreeze_Status == null) {
- _fsfreeze_Status = new PVEFsfreeze_Status(_client, _node, _vmid);
- }
-
- return _fsfreeze_Status;
- }
- private PVEFsfreeze_Thaw _fsfreeze_Thaw;
-
- public PVEFsfreeze_Thaw getFsfreeze_Thaw() {
- if (_fsfreeze_Thaw == null) {
- _fsfreeze_Thaw = new PVEFsfreeze_Thaw(_client, _node, _vmid);
- }
-
- return _fsfreeze_Thaw;
- }
- private PVEFstrim _fstrim;
-
- public PVEFstrim getFstrim() {
- if (_fstrim == null) {
- _fstrim = new PVEFstrim(_client, _node, _vmid);
- }
-
- return _fstrim;
- }
- private PVEGet_Fsinfo _get_Fsinfo;
-
- public PVEGet_Fsinfo getGet_Fsinfo() {
- if (_get_Fsinfo == null) {
- _get_Fsinfo = new PVEGet_Fsinfo(_client, _node, _vmid);
- }
-
- return _get_Fsinfo;
- }
- private PVEGet_Host_Name _get_Host_Name;
-
- public PVEGet_Host_Name getGet_Host_Name() {
- if (_get_Host_Name == null) {
- _get_Host_Name = new PVEGet_Host_Name(_client, _node, _vmid);
- }
-
- return _get_Host_Name;
- }
- private PVEGet_Memory_Block_Info _get_Memory_Block_Info;
-
- public PVEGet_Memory_Block_Info getGet_Memory_Block_Info() {
- if (_get_Memory_Block_Info == null) {
- _get_Memory_Block_Info = new PVEGet_Memory_Block_Info(_client, _node, _vmid);
- }
-
- return _get_Memory_Block_Info;
- }
- private PVEGet_Memory_Blocks _get_Memory_Blocks;
-
- public PVEGet_Memory_Blocks getGet_Memory_Blocks() {
- if (_get_Memory_Blocks == null) {
- _get_Memory_Blocks = new PVEGet_Memory_Blocks(_client, _node, _vmid);
- }
-
- return _get_Memory_Blocks;
- }
- private PVEGet_Osinfo _get_Osinfo;
-
- public PVEGet_Osinfo getGet_Osinfo() {
- if (_get_Osinfo == null) {
- _get_Osinfo = new PVEGet_Osinfo(_client, _node, _vmid);
- }
-
- return _get_Osinfo;
- }
- private PVEGet_Time _get_Time;
-
- public PVEGet_Time getGet_Time() {
- if (_get_Time == null) {
- _get_Time = new PVEGet_Time(_client, _node, _vmid);
- }
-
- return _get_Time;
- }
- private PVEGet_Timezone _get_Timezone;
-
- public PVEGet_Timezone getGet_Timezone() {
- if (_get_Timezone == null) {
- _get_Timezone = new PVEGet_Timezone(_client, _node, _vmid);
- }
-
- return _get_Timezone;
- }
- private PVEGet_Users _get_Users;
-
- public PVEGet_Users getGet_Users() {
- if (_get_Users == null) {
- _get_Users = new PVEGet_Users(_client, _node, _vmid);
- }
-
- return _get_Users;
- }
- private PVEGet_Vcpus _get_Vcpus;
-
- public PVEGet_Vcpus getGet_Vcpus() {
- if (_get_Vcpus == null) {
- _get_Vcpus = new PVEGet_Vcpus(_client, _node, _vmid);
- }
-
- return _get_Vcpus;
- }
- private PVEInfo _info;
-
- public PVEInfo getInfo() {
- if (_info == null) {
- _info = new PVEInfo(_client, _node, _vmid);
- }
-
- return _info;
- }
- private PVENetwork_Get_Interfaces _network_Get_Interfaces;
-
- public PVENetwork_Get_Interfaces getNetwork_Get_Interfaces() {
- if (_network_Get_Interfaces == null) {
- _network_Get_Interfaces = new PVENetwork_Get_Interfaces(_client, _node, _vmid);
- }
-
- return _network_Get_Interfaces;
- }
- private PVEPing _ping;
-
- public PVEPing getPing() {
- if (_ping == null) {
- _ping = new PVEPing(_client, _node, _vmid);
- }
-
- return _ping;
- }
- private PVEShutdown _shutdown;
-
- public PVEShutdown getShutdown() {
- if (_shutdown == null) {
- _shutdown = new PVEShutdown(_client, _node, _vmid);
- }
-
- return _shutdown;
- }
- private PVESuspend_Disk _suspend_Disk;
-
- public PVESuspend_Disk getSuspend_Disk() {
- if (_suspend_Disk == null) {
- _suspend_Disk = new PVESuspend_Disk(_client, _node, _vmid);
- }
-
- return _suspend_Disk;
- }
- private PVESuspend_Hybrid _suspend_Hybrid;
-
- public PVESuspend_Hybrid getSuspend_Hybrid() {
- if (_suspend_Hybrid == null) {
- _suspend_Hybrid = new PVESuspend_Hybrid(_client, _node, _vmid);
- }
-
- return _suspend_Hybrid;
- }
- private PVESuspend_Ram _suspend_Ram;
-
- public PVESuspend_Ram getSuspend_Ram() {
- if (_suspend_Ram == null) {
- _suspend_Ram = new PVESuspend_Ram(_client, _node, _vmid);
- }
-
- return _suspend_Ram;
- }
- private PVESet_User_Password _set_User_Password;
-
- public PVESet_User_Password getSet_User_Password() {
- if (_set_User_Password == null) {
- _set_User_Password = new PVESet_User_Password(_client, _node, _vmid);
- }
-
- return _set_User_Password;
- }
- private PVEExec _exec;
-
- public PVEExec getExec() {
- if (_exec == null) {
- _exec = new PVEExec(_client, _node, _vmid);
- }
-
- return _exec;
- }
- private PVEExec_Status _exec_Status;
-
- public PVEExec_Status getExec_Status() {
- if (_exec_Status == null) {
- _exec_Status = new PVEExec_Status(_client, _node, _vmid);
- }
-
- return _exec_Status;
- }
- private PVEFile_Read _file_Read;
-
- public PVEFile_Read getFile_Read() {
- if (_file_Read == null) {
- _file_Read = new PVEFile_Read(_client, _node, _vmid);
- }
-
- return _file_Read;
- }
- private PVEFile_Write _file_Write;
-
- public PVEFile_Write getFile_Write() {
- if (_file_Write == null) {
- _file_Write = new PVEFile_Write(_client, _node, _vmid);
- }
-
- return _file_Write;
- }
-
- public class PVEFsfreeze_Freeze {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEFsfreeze_Freeze(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute fsfreeze-freeze.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/fsfreeze-freeze", null);
- }
-
- /**
- * Execute fsfreeze-freeze.
- *
- * @return Result
- * @throws JSONException
- */
- public Result fsfreeze_Freeze() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEFsfreeze_Status {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEFsfreeze_Status(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute fsfreeze-status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/fsfreeze-status", null);
- }
-
- /**
- * Execute fsfreeze-status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result fsfreeze_Status() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEFsfreeze_Thaw {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEFsfreeze_Thaw(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute fsfreeze-thaw.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/fsfreeze-thaw", null);
- }
-
- /**
- * Execute fsfreeze-thaw.
- *
- * @return Result
- * @throws JSONException
- */
- public Result fsfreeze_Thaw() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEFstrim {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEFstrim(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute fstrim.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/fstrim", null);
- }
-
- /**
- * Execute fstrim.
- *
- * @return Result
- * @throws JSONException
- */
- public Result fstrim() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEGet_Fsinfo {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEGet_Fsinfo(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute get-fsinfo.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/get-fsinfo", null);
- }
-
- /**
- * Execute get-fsinfo.
- *
- * @return Result
- * @throws JSONException
- */
- public Result get_Fsinfo() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEGet_Host_Name {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEGet_Host_Name(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute get-host-name.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/get-host-name", null);
- }
-
- /**
- * Execute get-host-name.
- *
- * @return Result
- * @throws JSONException
- */
- public Result get_Host_Name() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEGet_Memory_Block_Info {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEGet_Memory_Block_Info(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute get-memory-block-info.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/get-memory-block-info", null);
- }
-
- /**
- * Execute get-memory-block-info.
- *
- * @return Result
- * @throws JSONException
- */
- public Result get_Memory_Block_Info() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEGet_Memory_Blocks {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEGet_Memory_Blocks(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute get-memory-blocks.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/get-memory-blocks", null);
- }
-
- /**
- * Execute get-memory-blocks.
- *
- * @return Result
- * @throws JSONException
- */
- public Result get_Memory_Blocks() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEGet_Osinfo {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEGet_Osinfo(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute get-osinfo.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/get-osinfo", null);
- }
-
- /**
- * Execute get-osinfo.
- *
- * @return Result
- * @throws JSONException
- */
- public Result get_Osinfo() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEGet_Time {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEGet_Time(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute get-time.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/get-time", null);
- }
-
- /**
- * Execute get-time.
- *
- * @return Result
- * @throws JSONException
- */
- public Result get_Time() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEGet_Timezone {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEGet_Timezone(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute get-timezone.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/get-timezone", null);
- }
-
- /**
- * Execute get-timezone.
- *
- * @return Result
- * @throws JSONException
- */
- public Result get_Timezone() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEGet_Users {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEGet_Users(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute get-users.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/get-users", null);
- }
-
- /**
- * Execute get-users.
- *
- * @return Result
- * @throws JSONException
- */
- public Result get_Users() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEGet_Vcpus {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEGet_Vcpus(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute get-vcpus.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/get-vcpus", null);
- }
-
- /**
- * Execute get-vcpus.
- *
- * @return Result
- * @throws JSONException
- */
- public Result get_Vcpus() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEInfo {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEInfo(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute info.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/info", null);
- }
-
- /**
- * Execute info.
- *
- * @return Result
- * @throws JSONException
- */
- public Result info() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVENetwork_Get_Interfaces {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVENetwork_Get_Interfaces(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute network-get-interfaces.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/network-get-interfaces", null);
- }
-
- /**
- * Execute network-get-interfaces.
- *
- * @return Result
- * @throws JSONException
- */
- public Result network_Get_Interfaces() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEPing {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEPing(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute ping.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/ping", null);
- }
-
- /**
- * Execute ping.
- *
- * @return Result
- * @throws JSONException
- */
- public Result ping() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEShutdown {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEShutdown(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute shutdown.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/shutdown", null);
- }
-
- /**
- * Execute shutdown.
- *
- * @return Result
- * @throws JSONException
- */
- public Result shutdown() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVESuspend_Disk {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESuspend_Disk(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute suspend-disk.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/suspend-disk", null);
- }
-
- /**
- * Execute suspend-disk.
- *
- * @return Result
- * @throws JSONException
- */
- public Result suspend_Disk() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVESuspend_Hybrid {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESuspend_Hybrid(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute suspend-hybrid.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/suspend-hybrid", null);
- }
-
- /**
- * Execute suspend-hybrid.
- *
- * @return Result
- * @throws JSONException
- */
- public Result suspend_Hybrid() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVESuspend_Ram {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESuspend_Ram(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute suspend-ram.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/suspend-ram", null);
- }
-
- /**
- * Execute suspend-ram.
- *
- * @return Result
- * @throws JSONException
- */
- public Result suspend_Ram() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVESet_User_Password {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESet_User_Password(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Sets the password for the given user to the given
- * password
- *
- * @param password The new password.
- * @param username The user to set the password for.
- * @param crypted set to 1 if the password has
- * already been passed through crypt()
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String password, String username, Boolean crypted) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("password", password);
- parameters.put("username", username);
- parameters.put("crypted", crypted);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/set-user-password", parameters);
- }
-
- /**
- * Sets the password for the given user to the given
- * password
- *
- * @param password The new password.
- * @param username The user to set the password for.
- * @param crypted set to 1 if the password has
- * already been passed through crypt()
- * @return Result
- * @throws JSONException
- */
- public Result set_User_Password(String password, String username, Boolean crypted) throws JSONException {
- return createRest(password, username, crypted);
- }
-
- /**
- * Sets the password for the given user to the given
- * password
- *
- * @param password The new password.
- * @param username The user to set the password for.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String password, String username) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("password", password);
- parameters.put("username", username);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/set-user-password", parameters);
- }
-
- /**
- * Sets the password for the given user to the given
- * password
- *
- * @param password The new password.
- * @param username The user to set the password for.
- * @return Result
- * @throws JSONException
- */
- public Result set_User_Password(String password, String username) throws JSONException {
- return createRest(password, username);
- }
-
- }
-
- public class PVEExec {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEExec(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Executes the given command in the vm via the
- * guest-agent and returns an object with the pid.
- *
- * @param command The command as a list of program +
- * arguments
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String command) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("command", command);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/exec", parameters);
- }
-
- /**
- * Executes the given command in the vm via the
- * guest-agent and returns an object with the pid.
- *
- * @param command The command as a list of program +
- * arguments
- * @return Result
- * @throws JSONException
- */
- public Result exec(String command) throws JSONException {
- return createRest(command);
- }
-
- }
-
- public class PVEExec_Status {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEExec_Status(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Gets the status of the given pid started by the
- * guest-agent
- *
- * @param pid The PID to query
- * @return Result
- * @throws JSONException
- */
- public Result getRest(int pid) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("pid", pid);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/exec-status", parameters);
- }
-
- /**
- * Gets the status of the given pid started by the
- * guest-agent
- *
- * @param pid The PID to query
- * @return Result
- * @throws JSONException
- */
- public Result exec_Status(int pid) throws JSONException {
- return getRest(pid);
- }
-
- }
-
- public class PVEFile_Read {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEFile_Read(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Reads the given file via guest agent. Is limited
- * to 16777216 bytes.
- *
- * @param file The path to the file
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String file) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("file", file);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent/file-read", parameters);
- }
-
- /**
- * Reads the given file via guest agent. Is limited
- * to 16777216 bytes.
- *
- * @param file The path to the file
- * @return Result
- * @throws JSONException
- */
- public Result file_Read(String file) throws JSONException {
- return getRest(file);
- }
-
- }
-
- public class PVEFile_Write {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEFile_Write(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Writes the given file via guest agent.
- *
- * @param content The content to write into the
- * file.
- * @param file The path to the file.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String content, String file) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("content", content);
- parameters.put("file", file);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent/file-write", parameters);
- }
-
- /**
- * Writes the given file via guest agent.
- *
- * @param content The content to write into the
- * file.
- * @param file The path to the file.
- * @return Result
- * @throws JSONException
- */
- public Result file_Write(String content, String file) throws JSONException {
- return createRest(content, file);
- }
-
- }
-
- /**
- * Qemu Agent command index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/agent", null);
- }
-
- /**
- * Qemu Agent command index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- /**
- * Execute Qemu Guest Agent commands.
- *
- * @param command The QGA command. Enum:
- * fsfreeze-freeze,fsfreeze-status,fsfreeze-thaw,fstrim,get-fsinfo,get-host-name,get-memory-block-info,get-memory-blocks,get-osinfo,get-time,get-timezone,get-users,get-vcpus,info,network-get-interfaces,ping,shutdown,suspend-disk,suspend-hybrid,suspend-ram
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String command) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("command", command);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/agent", parameters);
- }
-
- /**
- * Execute Qemu Guest Agent commands.
- *
- * @param command The QGA command. Enum:
- * fsfreeze-freeze,fsfreeze-status,fsfreeze-thaw,fstrim,get-fsinfo,get-host-name,get-memory-block-info,get-memory-blocks,get-osinfo,get-time,get-timezone,get-users,get-vcpus,info,network-get-interfaces,ping,shutdown,suspend-disk,suspend-hybrid,suspend-ram
- * @return Result
- * @throws JSONException
- */
- public Result agent(String command) throws JSONException {
- return createRest(command);
- }
-
- }
-
- public class PVERrd {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVERrd(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Read VM RRD statistics (returns PNG)
- *
- * @param ds The list of datasources you want to
- * display.
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @param cf The RRD consolidation function Enum:
- * AVERAGE,MAX
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String ds, String timeframe, String cf) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("ds", ds);
- parameters.put("timeframe", timeframe);
- parameters.put("cf", cf);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/rrd", parameters);
- }
-
- /**
- * Read VM RRD statistics (returns PNG)
- *
- * @param ds The list of datasources you want to
- * display.
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @param cf The RRD consolidation function Enum:
- * AVERAGE,MAX
- * @return Result
- * @throws JSONException
- */
- public Result rrd(String ds, String timeframe, String cf) throws JSONException {
- return getRest(ds, timeframe, cf);
- }
-
- /**
- * Read VM RRD statistics (returns PNG)
- *
- * @param ds The list of datasources you want to
- * display.
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String ds, String timeframe) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("ds", ds);
- parameters.put("timeframe", timeframe);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/rrd", parameters);
- }
-
- /**
- * Read VM RRD statistics (returns PNG)
- *
- * @param ds The list of datasources you want to
- * display.
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @return Result
- * @throws JSONException
- */
- public Result rrd(String ds, String timeframe) throws JSONException {
- return getRest(ds, timeframe);
- }
-
- }
-
- public class PVERrddata {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVERrddata(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Read VM RRD statistics
- *
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @param cf The RRD consolidation function Enum:
- * AVERAGE,MAX
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String timeframe, String cf) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("timeframe", timeframe);
- parameters.put("cf", cf);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/rrddata", parameters);
- }
-
- /**
- * Read VM RRD statistics
- *
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @param cf The RRD consolidation function Enum:
- * AVERAGE,MAX
- * @return Result
- * @throws JSONException
- */
- public Result rrddata(String timeframe, String cf) throws JSONException {
- return getRest(timeframe, cf);
- }
-
- /**
- * Read VM RRD statistics
- *
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String timeframe) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("timeframe", timeframe);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/rrddata", parameters);
- }
-
- /**
- * Read VM RRD statistics
- *
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @return Result
- * @throws JSONException
- */
- public Result rrddata(String timeframe) throws JSONException {
- return getRest(timeframe);
- }
-
- }
-
- public class PVEConfig {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEConfig(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Get current virtual machine configuration. This does
- * not include pending configuration changes (see
- * 'pending' API).
- *
- * @param current Get current values (instead of pending
- * values).
- * @param snapshot Fetch config values from given
- * snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(Boolean current, String snapshot) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("current", current);
- parameters.put("snapshot", snapshot);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/config", parameters);
- }
-
- /**
- * Get current virtual machine configuration. This does
- * not include pending configuration changes (see
- * 'pending' API).
- *
- * @param current Get current values (instead of pending
- * values).
- * @param snapshot Fetch config values from given
- * snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result vmConfig(Boolean current, String snapshot) throws JSONException {
- return getRest(current, snapshot);
- }
-
- /**
- * Get current virtual machine configuration. This does
- * not include pending configuration changes (see
- * 'pending' API).
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/config", null);
- }
-
- /**
- * Get current virtual machine configuration. This does
- * not include pending configuration changes (see
- * 'pending' API).
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmConfig() throws JSONException {
- return getRest();
- }
-
- /**
- * Set virtual machine options (asynchrounous API).
- *
- * @param acpi Enable/disable ACPI.
- * @param agent Enable/disable Qemu GuestAgent and its
- * properties.
- * @param arch Virtual processor architecture. Defaults
- * to the host. Enum: x86_64,aarch64
- * @param args Arbitrary arguments passed to kvm.
- * @param autostart Automatic restart after crash
- * (currently ignored).
- * @param background_delay Time to wait for the task to
- * finish. We return 'null' if the task finish within
- * that time.
- * @param balloon Amount of target RAM for the VM in MB.
- * Using zero disables the ballon driver.
- * @param bios Select BIOS implementation. Enum:
- * seabios,ovmf
- * @param boot Boot on floppy (a), hard disk (c), CD-ROM
- * (d), or network (n).
- * @param bootdisk Enable booting from specified disk.
- * @param cdrom This is an alias for option -ide2
- * @param cicustom cloud-init: Specify custom files to
- * replace the automatically generated ones at start.
- * @param cipassword cloud-init: Password to assign the
- * user. Using this is generally not recommended. Use
- * ssh keys instead. Also note that older cloud-init
- * versions do not support hashed passwords.
- * @param citype Specifies the cloud-init configuration
- * format. The default depends on the configured
- * operating system type (`ostype`. We use the `nocloud`
- * format for Linux, and `configdrive2` for windows.
- * Enum: configdrive2,nocloud
- * @param ciuser cloud-init: User name to change ssh
- * keys and password for instead of the image's
- * configured default user.
- * @param cores The number of cores per socket.
- * @param cpu Emulated CPU type.
- * @param cpulimit Limit of CPU usage.
- * @param cpuunits CPU weight for a VM.
- * @param delete A list of settings you want to delete.
- * @param description Description for the VM. Only used
- * on the configuration web interface. This is saved as
- * comment inside the configuration file.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param efidisk0 Configure a Disk for storing EFI vars
- * @param force Force physical removal. Without this, we
- * simple remove the disk from the config file and
- * create an additional configuration entry called
- * 'unused[n]', which contains the volume ID. Unlink of
- * unused[n] always cause physical removal.
- * @param freeze Freeze CPU at startup (use 'c' monitor
- * command to start execution).
- * @param hookscript Script that will be executed during
- * various steps in the vms lifetime.
- * @param hostpciN Map host PCI devices into guest.
- * @param hotplug Selectively enable hotplug features.
- * This is a comma separated list of hotplug features:
- * 'network', 'disk', 'cpu', 'memory' and 'usb'. Use '0'
- * to disable hotplug completely. Value '1' is an alias
- * for the default 'network,disk,usb'.
- * @param hugepages Enable/disable hugepages memory.
- * Enum: any,2,1024
- * @param ideN Use volume as IDE hard disk or CD-ROM (n
- * is 0 to 3).
- * @param ipconfigN cloud-init: Specify IP addresses and
- * gateways for the corresponding interface. IP
- * addresses use CIDR notation, gateways are optional
- * but need an IP of the same type specified. The
- * special string 'dhcp' can be used for IP addresses to
- * use DHCP, in which case no explicit gateway should be
- * provided. For IPv6 the special string 'auto' can be
- * used to use stateless autoconfiguration. If
- * cloud-init is enabled and neither an IPv4 nor an IPv6
- * address is specified, it defaults to using dhcp on
- * IPv4.
- * @param ivshmem Inter-VM shared memory. Useful for
- * direct communication between VMs, or to the host.
- * @param keyboard Keybord layout for vnc server.
- * Default is read from the '/etc/pve/datacenter.cfg'
- * configuration file.It should not be necessary to set
- * it. Enum:
- * de,de-ch,da,en-gb,en-us,es,fi,fr,fr-be,fr-ca,fr-ch,hu,is,it,ja,lt,mk,nl,no,pl,pt,pt-br,sv,sl,tr
- * @param kvm Enable/disable KVM hardware
- * virtualization.
- * @param localtime Set the real time clock to local
- * time. This is enabled by default if ostype indicates
- * a Microsoft OS.
- * @param lock_ Lock/unlock the VM. Enum:
- * backup,clone,create,migrate,rollback,snapshot,snapshot-delete,suspending,suspended
- * @param machine Specifies the Qemu machine type.
- * @param memory Amount of RAM for the VM in MB. This is
- * the maximum available memory when you use the balloon
- * device.
- * @param migrate_downtime Set maximum tolerated
- * downtime (in seconds) for migrations.
- * @param migrate_speed Set maximum speed (in MB/s) for
- * migrations. Value 0 is no limit.
- * @param name Set a name for the VM. Only used on the
- * configuration web interface.
- * @param nameserver cloud-init: Sets DNS server IP
- * address for a container. Create will automatically
- * use the setting from the host if neither searchdomain
- * nor nameserver are set.
- * @param netN Specify network devices.
- * @param numa Enable/disable NUMA.
- * @param numaN NUMA topology.
- * @param onboot Specifies whether a VM will be started
- * during system bootup.
- * @param ostype Specify guest operating system. Enum:
- * other,wxp,w2k,w2k3,w2k8,wvista,win7,win8,win10,l24,l26,solaris
- * @param parallelN Map host parallel devices (n is 0 to
- * 2).
- * @param protection Sets the protection flag of the VM.
- * This will disable the remove VM and remove disk
- * operations.
- * @param reboot Allow reboot. If set to '0' the VM exit
- * on reboot.
- * @param revert Revert a pending change.
- * @param sataN Use volume as SATA hard disk or CD-ROM
- * (n is 0 to 5).
- * @param scsiN Use volume as SCSI hard disk or CD-ROM
- * (n is 0 to 13).
- * @param scsihw SCSI controller model Enum:
- * lsi,lsi53c810,virtio-scsi-pci,virtio-scsi-single,megasas,pvscsi
- * @param searchdomain cloud-init: Sets DNS search
- * domains for a container. Create will automatically
- * use the setting from the host if neither searchdomain
- * nor nameserver are set.
- * @param serialN Create a serial device inside the VM
- * (n is 0 to 3)
- * @param shares Amount of memory shares for
- * auto-ballooning. The larger the number is, the more
- * memory this VM gets. Number is relative to weights of
- * all other running VMs. Using zero disables
- * auto-ballooning. Auto-ballooning is done by pvestatd.
- * @param skiplock Ignore locks - only root is allowed
- * to use this option.
- * @param smbios1 Specify SMBIOS type 1 fields.
- * @param smp The number of CPUs. Please use option
- * -sockets instead.
- * @param sockets The number of CPU sockets.
- * @param sshkeys cloud-init: Setup public SSH keys (one
- * key per line, OpenSSH format).
- * @param startdate Set the initial date of the real
- * time clock. Valid format for date are: 'now' or
- * '2006-06-17T16:01:21' or '2006-06-17'.
- * @param startup Startup and shutdown behavior. Order
- * is a non-negative number defining the general startup
- * order. Shutdown in done with reverse ordering.
- * Additionally you can set the 'up' or 'down' delay in
- * seconds, which specifies a delay to wait before the
- * next VM is started or stopped.
- * @param tablet Enable/disable the USB tablet device.
- * @param tdf Enable/disable time drift fix.
- * @param template Enable/disable Template.
- * @param unusedN Reference to unused volumes. This is
- * used internally, and should not be modified manually.
- * @param usbN Configure an USB device (n is 0 to 4).
- * @param vcpus Number of hotplugged vcpus.
- * @param vga Configure the VGA hardware.
- * @param virtioN Use volume as VIRTIO hard disk (n is 0
- * to 15).
- * @param vmgenid Set VM Generation ID. Use '1' to
- * autogenerate on create or update, pass '0' to disable
- * explicitly.
- * @param vmstatestorage Default storage for VM state
- * volumes/files.
- * @param watchdog Create a virtual hardware watchdog
- * device.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean acpi, String agent, String arch, String args, Boolean autostart, Integer background_delay, Integer balloon, String bios, String boot, String bootdisk, String cdrom, String cicustom, String cipassword, String citype, String ciuser, Integer cores, String cpu, Integer cpulimit, Integer cpuunits, String delete, String description, String digest, String efidisk0, Boolean force, Boolean freeze, String hookscript, Map hostpciN, String hotplug, String hugepages, Map ideN, Map ipconfigN, String ivshmem, String keyboard, Boolean kvm, Boolean localtime, String lock_, String machine, Integer memory, Integer migrate_downtime, Integer migrate_speed, String name, String nameserver, Map netN, Boolean numa, Map numaN, Boolean onboot, String ostype, Map parallelN, Boolean protection, Boolean reboot, String revert, Map sataN, Map scsiN, String scsihw, String searchdomain, Map serialN, Integer shares, Boolean skiplock, String smbios1, Integer smp, Integer sockets, String sshkeys, String startdate, String startup, Boolean tablet, Boolean tdf, Boolean template, Map unusedN, Map usbN, Integer vcpus, String vga, Map virtioN, String vmgenid, String vmstatestorage, String watchdog) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("acpi", acpi);
- parameters.put("agent", agent);
- parameters.put("arch", arch);
- parameters.put("args", args);
- parameters.put("autostart", autostart);
- parameters.put("background_delay", background_delay);
- parameters.put("balloon", balloon);
- parameters.put("bios", bios);
- parameters.put("boot", boot);
- parameters.put("bootdisk", bootdisk);
- parameters.put("cdrom", cdrom);
- parameters.put("cicustom", cicustom);
- parameters.put("cipassword", cipassword);
- parameters.put("citype", citype);
- parameters.put("ciuser", ciuser);
- parameters.put("cores", cores);
- parameters.put("cpu", cpu);
- parameters.put("cpulimit", cpulimit);
- parameters.put("cpuunits", cpuunits);
- parameters.put("delete", delete);
- parameters.put("description", description);
- parameters.put("digest", digest);
- parameters.put("efidisk0", efidisk0);
- parameters.put("force", force);
- parameters.put("freeze", freeze);
- parameters.put("hookscript", hookscript);
- parameters.put("hotplug", hotplug);
- parameters.put("hugepages", hugepages);
- parameters.put("ivshmem", ivshmem);
- parameters.put("keyboard", keyboard);
- parameters.put("kvm", kvm);
- parameters.put("localtime", localtime);
- parameters.put("lock", lock_);
- parameters.put("machine", machine);
- parameters.put("memory", memory);
- parameters.put("migrate_downtime", migrate_downtime);
- parameters.put("migrate_speed", migrate_speed);
- parameters.put("name", name);
- parameters.put("nameserver", nameserver);
- parameters.put("numa", numa);
- parameters.put("onboot", onboot);
- parameters.put("ostype", ostype);
- parameters.put("protection", protection);
- parameters.put("reboot", reboot);
- parameters.put("revert", revert);
- parameters.put("scsihw", scsihw);
- parameters.put("searchdomain", searchdomain);
- parameters.put("shares", shares);
- parameters.put("skiplock", skiplock);
- parameters.put("smbios1", smbios1);
- parameters.put("smp", smp);
- parameters.put("sockets", sockets);
- parameters.put("sshkeys", sshkeys);
- parameters.put("startdate", startdate);
- parameters.put("startup", startup);
- parameters.put("tablet", tablet);
- parameters.put("tdf", tdf);
- parameters.put("template", template);
- parameters.put("vcpus", vcpus);
- parameters.put("vga", vga);
- parameters.put("vmgenid", vmgenid);
- parameters.put("vmstatestorage", vmstatestorage);
- parameters.put("watchdog", watchdog);
- addIndexedParameter(parameters, "hostpci", hostpciN);
- addIndexedParameter(parameters, "ide", ideN);
- addIndexedParameter(parameters, "ipconfig", ipconfigN);
- addIndexedParameter(parameters, "net", netN);
- addIndexedParameter(parameters, "numa", numaN);
- addIndexedParameter(parameters, "parallel", parallelN);
- addIndexedParameter(parameters, "sata", sataN);
- addIndexedParameter(parameters, "scsi", scsiN);
- addIndexedParameter(parameters, "serial", serialN);
- addIndexedParameter(parameters, "unused", unusedN);
- addIndexedParameter(parameters, "usb", usbN);
- addIndexedParameter(parameters, "virtio", virtioN);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/config", parameters);
- }
-
- /**
- * Set virtual machine options (asynchrounous API).
- *
- * @param acpi Enable/disable ACPI.
- * @param agent Enable/disable Qemu GuestAgent and its
- * properties.
- * @param arch Virtual processor architecture. Defaults
- * to the host. Enum: x86_64,aarch64
- * @param args Arbitrary arguments passed to kvm.
- * @param autostart Automatic restart after crash
- * (currently ignored).
- * @param background_delay Time to wait for the task to
- * finish. We return 'null' if the task finish within
- * that time.
- * @param balloon Amount of target RAM for the VM in MB.
- * Using zero disables the ballon driver.
- * @param bios Select BIOS implementation. Enum:
- * seabios,ovmf
- * @param boot Boot on floppy (a), hard disk (c), CD-ROM
- * (d), or network (n).
- * @param bootdisk Enable booting from specified disk.
- * @param cdrom This is an alias for option -ide2
- * @param cicustom cloud-init: Specify custom files to
- * replace the automatically generated ones at start.
- * @param cipassword cloud-init: Password to assign the
- * user. Using this is generally not recommended. Use
- * ssh keys instead. Also note that older cloud-init
- * versions do not support hashed passwords.
- * @param citype Specifies the cloud-init configuration
- * format. The default depends on the configured
- * operating system type (`ostype`. We use the `nocloud`
- * format for Linux, and `configdrive2` for windows.
- * Enum: configdrive2,nocloud
- * @param ciuser cloud-init: User name to change ssh
- * keys and password for instead of the image's
- * configured default user.
- * @param cores The number of cores per socket.
- * @param cpu Emulated CPU type.
- * @param cpulimit Limit of CPU usage.
- * @param cpuunits CPU weight for a VM.
- * @param delete A list of settings you want to delete.
- * @param description Description for the VM. Only used
- * on the configuration web interface. This is saved as
- * comment inside the configuration file.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param efidisk0 Configure a Disk for storing EFI vars
- * @param force Force physical removal. Without this, we
- * simple remove the disk from the config file and
- * create an additional configuration entry called
- * 'unused[n]', which contains the volume ID. Unlink of
- * unused[n] always cause physical removal.
- * @param freeze Freeze CPU at startup (use 'c' monitor
- * command to start execution).
- * @param hookscript Script that will be executed during
- * various steps in the vms lifetime.
- * @param hostpciN Map host PCI devices into guest.
- * @param hotplug Selectively enable hotplug features.
- * This is a comma separated list of hotplug features:
- * 'network', 'disk', 'cpu', 'memory' and 'usb'. Use '0'
- * to disable hotplug completely. Value '1' is an alias
- * for the default 'network,disk,usb'.
- * @param hugepages Enable/disable hugepages memory.
- * Enum: any,2,1024
- * @param ideN Use volume as IDE hard disk or CD-ROM (n
- * is 0 to 3).
- * @param ipconfigN cloud-init: Specify IP addresses and
- * gateways for the corresponding interface. IP
- * addresses use CIDR notation, gateways are optional
- * but need an IP of the same type specified. The
- * special string 'dhcp' can be used for IP addresses to
- * use DHCP, in which case no explicit gateway should be
- * provided. For IPv6 the special string 'auto' can be
- * used to use stateless autoconfiguration. If
- * cloud-init is enabled and neither an IPv4 nor an IPv6
- * address is specified, it defaults to using dhcp on
- * IPv4.
- * @param ivshmem Inter-VM shared memory. Useful for
- * direct communication between VMs, or to the host.
- * @param keyboard Keybord layout for vnc server.
- * Default is read from the '/etc/pve/datacenter.cfg'
- * configuration file.It should not be necessary to set
- * it. Enum:
- * de,de-ch,da,en-gb,en-us,es,fi,fr,fr-be,fr-ca,fr-ch,hu,is,it,ja,lt,mk,nl,no,pl,pt,pt-br,sv,sl,tr
- * @param kvm Enable/disable KVM hardware
- * virtualization.
- * @param localtime Set the real time clock to local
- * time. This is enabled by default if ostype indicates
- * a Microsoft OS.
- * @param lock_ Lock/unlock the VM. Enum:
- * backup,clone,create,migrate,rollback,snapshot,snapshot-delete,suspending,suspended
- * @param machine Specifies the Qemu machine type.
- * @param memory Amount of RAM for the VM in MB. This is
- * the maximum available memory when you use the balloon
- * device.
- * @param migrate_downtime Set maximum tolerated
- * downtime (in seconds) for migrations.
- * @param migrate_speed Set maximum speed (in MB/s) for
- * migrations. Value 0 is no limit.
- * @param name Set a name for the VM. Only used on the
- * configuration web interface.
- * @param nameserver cloud-init: Sets DNS server IP
- * address for a container. Create will automatically
- * use the setting from the host if neither searchdomain
- * nor nameserver are set.
- * @param netN Specify network devices.
- * @param numa Enable/disable NUMA.
- * @param numaN NUMA topology.
- * @param onboot Specifies whether a VM will be started
- * during system bootup.
- * @param ostype Specify guest operating system. Enum:
- * other,wxp,w2k,w2k3,w2k8,wvista,win7,win8,win10,l24,l26,solaris
- * @param parallelN Map host parallel devices (n is 0 to
- * 2).
- * @param protection Sets the protection flag of the VM.
- * This will disable the remove VM and remove disk
- * operations.
- * @param reboot Allow reboot. If set to '0' the VM exit
- * on reboot.
- * @param revert Revert a pending change.
- * @param sataN Use volume as SATA hard disk or CD-ROM
- * (n is 0 to 5).
- * @param scsiN Use volume as SCSI hard disk or CD-ROM
- * (n is 0 to 13).
- * @param scsihw SCSI controller model Enum:
- * lsi,lsi53c810,virtio-scsi-pci,virtio-scsi-single,megasas,pvscsi
- * @param searchdomain cloud-init: Sets DNS search
- * domains for a container. Create will automatically
- * use the setting from the host if neither searchdomain
- * nor nameserver are set.
- * @param serialN Create a serial device inside the VM
- * (n is 0 to 3)
- * @param shares Amount of memory shares for
- * auto-ballooning. The larger the number is, the more
- * memory this VM gets. Number is relative to weights of
- * all other running VMs. Using zero disables
- * auto-ballooning. Auto-ballooning is done by pvestatd.
- * @param skiplock Ignore locks - only root is allowed
- * to use this option.
- * @param smbios1 Specify SMBIOS type 1 fields.
- * @param smp The number of CPUs. Please use option
- * -sockets instead.
- * @param sockets The number of CPU sockets.
- * @param sshkeys cloud-init: Setup public SSH keys (one
- * key per line, OpenSSH format).
- * @param startdate Set the initial date of the real
- * time clock. Valid format for date are: 'now' or
- * '2006-06-17T16:01:21' or '2006-06-17'.
- * @param startup Startup and shutdown behavior. Order
- * is a non-negative number defining the general startup
- * order. Shutdown in done with reverse ordering.
- * Additionally you can set the 'up' or 'down' delay in
- * seconds, which specifies a delay to wait before the
- * next VM is started or stopped.
- * @param tablet Enable/disable the USB tablet device.
- * @param tdf Enable/disable time drift fix.
- * @param template Enable/disable Template.
- * @param unusedN Reference to unused volumes. This is
- * used internally, and should not be modified manually.
- * @param usbN Configure an USB device (n is 0 to 4).
- * @param vcpus Number of hotplugged vcpus.
- * @param vga Configure the VGA hardware.
- * @param virtioN Use volume as VIRTIO hard disk (n is 0
- * to 15).
- * @param vmgenid Set VM Generation ID. Use '1' to
- * autogenerate on create or update, pass '0' to disable
- * explicitly.
- * @param vmstatestorage Default storage for VM state
- * volumes/files.
- * @param watchdog Create a virtual hardware watchdog
- * device.
- * @return Result
- * @throws JSONException
- */
- public Result updateVmAsync(Boolean acpi, String agent, String arch, String args, Boolean autostart, Integer background_delay, Integer balloon, String bios, String boot, String bootdisk, String cdrom, String cicustom, String cipassword, String citype, String ciuser, Integer cores, String cpu, Integer cpulimit, Integer cpuunits, String delete, String description, String digest, String efidisk0, Boolean force, Boolean freeze, String hookscript, Map hostpciN, String hotplug, String hugepages, Map ideN, Map ipconfigN, String ivshmem, String keyboard, Boolean kvm, Boolean localtime, String lock_, String machine, Integer memory, Integer migrate_downtime, Integer migrate_speed, String name, String nameserver, Map netN, Boolean numa, Map numaN, Boolean onboot, String ostype, Map parallelN, Boolean protection, Boolean reboot, String revert, Map sataN, Map scsiN, String scsihw, String searchdomain, Map serialN, Integer shares, Boolean skiplock, String smbios1, Integer smp, Integer sockets, String sshkeys, String startdate, String startup, Boolean tablet, Boolean tdf, Boolean template, Map unusedN, Map usbN, Integer vcpus, String vga, Map virtioN, String vmgenid, String vmstatestorage, String watchdog) throws JSONException {
- return createRest(acpi, agent, arch, args, autostart, background_delay, balloon, bios, boot, bootdisk, cdrom, cicustom, cipassword, citype, ciuser, cores, cpu, cpulimit, cpuunits, delete, description, digest, efidisk0, force, freeze, hookscript, hostpciN, hotplug, hugepages, ideN, ipconfigN, ivshmem, keyboard, kvm, localtime, lock_, machine, memory, migrate_downtime, migrate_speed, name, nameserver, netN, numa, numaN, onboot, ostype, parallelN, protection, reboot, revert, sataN, scsiN, scsihw, searchdomain, serialN, shares, skiplock, smbios1, smp, sockets, sshkeys, startdate, startup, tablet, tdf, template, unusedN, usbN, vcpus, vga, virtioN, vmgenid, vmstatestorage, watchdog);
- }
-
- /**
- * Set virtual machine options (asynchrounous API).
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/config", null);
- }
-
- /**
- * Set virtual machine options (asynchrounous API).
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateVmAsync() throws JSONException {
- return createRest();
- }
-
- /**
- * Set virtual machine options (synchrounous API) - You
- * should consider using the POST method instead for any
- * actions involving hotplug or storage allocation.
- *
- * @param acpi Enable/disable ACPI.
- * @param agent Enable/disable Qemu GuestAgent and its
- * properties.
- * @param arch Virtual processor architecture. Defaults
- * to the host. Enum: x86_64,aarch64
- * @param args Arbitrary arguments passed to kvm.
- * @param autostart Automatic restart after crash
- * (currently ignored).
- * @param balloon Amount of target RAM for the VM in MB.
- * Using zero disables the ballon driver.
- * @param bios Select BIOS implementation. Enum:
- * seabios,ovmf
- * @param boot Boot on floppy (a), hard disk (c), CD-ROM
- * (d), or network (n).
- * @param bootdisk Enable booting from specified disk.
- * @param cdrom This is an alias for option -ide2
- * @param cicustom cloud-init: Specify custom files to
- * replace the automatically generated ones at start.
- * @param cipassword cloud-init: Password to assign the
- * user. Using this is generally not recommended. Use
- * ssh keys instead. Also note that older cloud-init
- * versions do not support hashed passwords.
- * @param citype Specifies the cloud-init configuration
- * format. The default depends on the configured
- * operating system type (`ostype`. We use the `nocloud`
- * format for Linux, and `configdrive2` for windows.
- * Enum: configdrive2,nocloud
- * @param ciuser cloud-init: User name to change ssh
- * keys and password for instead of the image's
- * configured default user.
- * @param cores The number of cores per socket.
- * @param cpu Emulated CPU type.
- * @param cpulimit Limit of CPU usage.
- * @param cpuunits CPU weight for a VM.
- * @param delete A list of settings you want to delete.
- * @param description Description for the VM. Only used
- * on the configuration web interface. This is saved as
- * comment inside the configuration file.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param efidisk0 Configure a Disk for storing EFI vars
- * @param force Force physical removal. Without this, we
- * simple remove the disk from the config file and
- * create an additional configuration entry called
- * 'unused[n]', which contains the volume ID. Unlink of
- * unused[n] always cause physical removal.
- * @param freeze Freeze CPU at startup (use 'c' monitor
- * command to start execution).
- * @param hookscript Script that will be executed during
- * various steps in the vms lifetime.
- * @param hostpciN Map host PCI devices into guest.
- * @param hotplug Selectively enable hotplug features.
- * This is a comma separated list of hotplug features:
- * 'network', 'disk', 'cpu', 'memory' and 'usb'. Use '0'
- * to disable hotplug completely. Value '1' is an alias
- * for the default 'network,disk,usb'.
- * @param hugepages Enable/disable hugepages memory.
- * Enum: any,2,1024
- * @param ideN Use volume as IDE hard disk or CD-ROM (n
- * is 0 to 3).
- * @param ipconfigN cloud-init: Specify IP addresses and
- * gateways for the corresponding interface. IP
- * addresses use CIDR notation, gateways are optional
- * but need an IP of the same type specified. The
- * special string 'dhcp' can be used for IP addresses to
- * use DHCP, in which case no explicit gateway should be
- * provided. For IPv6 the special string 'auto' can be
- * used to use stateless autoconfiguration. If
- * cloud-init is enabled and neither an IPv4 nor an IPv6
- * address is specified, it defaults to using dhcp on
- * IPv4.
- * @param ivshmem Inter-VM shared memory. Useful for
- * direct communication between VMs, or to the host.
- * @param keyboard Keybord layout for vnc server.
- * Default is read from the '/etc/pve/datacenter.cfg'
- * configuration file.It should not be necessary to set
- * it. Enum:
- * de,de-ch,da,en-gb,en-us,es,fi,fr,fr-be,fr-ca,fr-ch,hu,is,it,ja,lt,mk,nl,no,pl,pt,pt-br,sv,sl,tr
- * @param kvm Enable/disable KVM hardware
- * virtualization.
- * @param localtime Set the real time clock to local
- * time. This is enabled by default if ostype indicates
- * a Microsoft OS.
- * @param lock_ Lock/unlock the VM. Enum:
- * backup,clone,create,migrate,rollback,snapshot,snapshot-delete,suspending,suspended
- * @param machine Specifies the Qemu machine type.
- * @param memory Amount of RAM for the VM in MB. This is
- * the maximum available memory when you use the balloon
- * device.
- * @param migrate_downtime Set maximum tolerated
- * downtime (in seconds) for migrations.
- * @param migrate_speed Set maximum speed (in MB/s) for
- * migrations. Value 0 is no limit.
- * @param name Set a name for the VM. Only used on the
- * configuration web interface.
- * @param nameserver cloud-init: Sets DNS server IP
- * address for a container. Create will automatically
- * use the setting from the host if neither searchdomain
- * nor nameserver are set.
- * @param netN Specify network devices.
- * @param numa Enable/disable NUMA.
- * @param numaN NUMA topology.
- * @param onboot Specifies whether a VM will be started
- * during system bootup.
- * @param ostype Specify guest operating system. Enum:
- * other,wxp,w2k,w2k3,w2k8,wvista,win7,win8,win10,l24,l26,solaris
- * @param parallelN Map host parallel devices (n is 0 to
- * 2).
- * @param protection Sets the protection flag of the VM.
- * This will disable the remove VM and remove disk
- * operations.
- * @param reboot Allow reboot. If set to '0' the VM exit
- * on reboot.
- * @param revert Revert a pending change.
- * @param sataN Use volume as SATA hard disk or CD-ROM
- * (n is 0 to 5).
- * @param scsiN Use volume as SCSI hard disk or CD-ROM
- * (n is 0 to 13).
- * @param scsihw SCSI controller model Enum:
- * lsi,lsi53c810,virtio-scsi-pci,virtio-scsi-single,megasas,pvscsi
- * @param searchdomain cloud-init: Sets DNS search
- * domains for a container. Create will automatically
- * use the setting from the host if neither searchdomain
- * nor nameserver are set.
- * @param serialN Create a serial device inside the VM
- * (n is 0 to 3)
- * @param shares Amount of memory shares for
- * auto-ballooning. The larger the number is, the more
- * memory this VM gets. Number is relative to weights of
- * all other running VMs. Using zero disables
- * auto-ballooning. Auto-ballooning is done by pvestatd.
- * @param skiplock Ignore locks - only root is allowed
- * to use this option.
- * @param smbios1 Specify SMBIOS type 1 fields.
- * @param smp The number of CPUs. Please use option
- * -sockets instead.
- * @param sockets The number of CPU sockets.
- * @param sshkeys cloud-init: Setup public SSH keys (one
- * key per line, OpenSSH format).
- * @param startdate Set the initial date of the real
- * time clock. Valid format for date are: 'now' or
- * '2006-06-17T16:01:21' or '2006-06-17'.
- * @param startup Startup and shutdown behavior. Order
- * is a non-negative number defining the general startup
- * order. Shutdown in done with reverse ordering.
- * Additionally you can set the 'up' or 'down' delay in
- * seconds, which specifies a delay to wait before the
- * next VM is started or stopped.
- * @param tablet Enable/disable the USB tablet device.
- * @param tdf Enable/disable time drift fix.
- * @param template Enable/disable Template.
- * @param unusedN Reference to unused volumes. This is
- * used internally, and should not be modified manually.
- * @param usbN Configure an USB device (n is 0 to 4).
- * @param vcpus Number of hotplugged vcpus.
- * @param vga Configure the VGA hardware.
- * @param virtioN Use volume as VIRTIO hard disk (n is 0
- * to 15).
- * @param vmgenid Set VM Generation ID. Use '1' to
- * autogenerate on create or update, pass '0' to disable
- * explicitly.
- * @param vmstatestorage Default storage for VM state
- * volumes/files.
- * @param watchdog Create a virtual hardware watchdog
- * device.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(Boolean acpi, String agent, String arch, String args, Boolean autostart, Integer balloon, String bios, String boot, String bootdisk, String cdrom, String cicustom, String cipassword, String citype, String ciuser, Integer cores, String cpu, Integer cpulimit, Integer cpuunits, String delete, String description, String digest, String efidisk0, Boolean force, Boolean freeze, String hookscript, Map hostpciN, String hotplug, String hugepages, Map ideN, Map ipconfigN, String ivshmem, String keyboard, Boolean kvm, Boolean localtime, String lock_, String machine, Integer memory, Integer migrate_downtime, Integer migrate_speed, String name, String nameserver, Map netN, Boolean numa, Map numaN, Boolean onboot, String ostype, Map parallelN, Boolean protection, Boolean reboot, String revert, Map sataN, Map scsiN, String scsihw, String searchdomain, Map serialN, Integer shares, Boolean skiplock, String smbios1, Integer smp, Integer sockets, String sshkeys, String startdate, String startup, Boolean tablet, Boolean tdf, Boolean template, Map unusedN, Map usbN, Integer vcpus, String vga, Map virtioN, String vmgenid, String vmstatestorage, String watchdog) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("acpi", acpi);
- parameters.put("agent", agent);
- parameters.put("arch", arch);
- parameters.put("args", args);
- parameters.put("autostart", autostart);
- parameters.put("balloon", balloon);
- parameters.put("bios", bios);
- parameters.put("boot", boot);
- parameters.put("bootdisk", bootdisk);
- parameters.put("cdrom", cdrom);
- parameters.put("cicustom", cicustom);
- parameters.put("cipassword", cipassword);
- parameters.put("citype", citype);
- parameters.put("ciuser", ciuser);
- parameters.put("cores", cores);
- parameters.put("cpu", cpu);
- parameters.put("cpulimit", cpulimit);
- parameters.put("cpuunits", cpuunits);
- parameters.put("delete", delete);
- parameters.put("description", description);
- parameters.put("digest", digest);
- parameters.put("efidisk0", efidisk0);
- parameters.put("force", force);
- parameters.put("freeze", freeze);
- parameters.put("hookscript", hookscript);
- parameters.put("hotplug", hotplug);
- parameters.put("hugepages", hugepages);
- parameters.put("ivshmem", ivshmem);
- parameters.put("keyboard", keyboard);
- parameters.put("kvm", kvm);
- parameters.put("localtime", localtime);
- parameters.put("lock", lock_);
- parameters.put("machine", machine);
- parameters.put("memory", memory);
- parameters.put("migrate_downtime", migrate_downtime);
- parameters.put("migrate_speed", migrate_speed);
- parameters.put("name", name);
- parameters.put("nameserver", nameserver);
- parameters.put("numa", numa);
- parameters.put("onboot", onboot);
- parameters.put("ostype", ostype);
- parameters.put("protection", protection);
- parameters.put("reboot", reboot);
- parameters.put("revert", revert);
- parameters.put("scsihw", scsihw);
- parameters.put("searchdomain", searchdomain);
- parameters.put("shares", shares);
- parameters.put("skiplock", skiplock);
- parameters.put("smbios1", smbios1);
- parameters.put("smp", smp);
- parameters.put("sockets", sockets);
- parameters.put("sshkeys", sshkeys);
- parameters.put("startdate", startdate);
- parameters.put("startup", startup);
- parameters.put("tablet", tablet);
- parameters.put("tdf", tdf);
- parameters.put("template", template);
- parameters.put("vcpus", vcpus);
- parameters.put("vga", vga);
- parameters.put("vmgenid", vmgenid);
- parameters.put("vmstatestorage", vmstatestorage);
- parameters.put("watchdog", watchdog);
- addIndexedParameter(parameters, "hostpci", hostpciN);
- addIndexedParameter(parameters, "ide", ideN);
- addIndexedParameter(parameters, "ipconfig", ipconfigN);
- addIndexedParameter(parameters, "net", netN);
- addIndexedParameter(parameters, "numa", numaN);
- addIndexedParameter(parameters, "parallel", parallelN);
- addIndexedParameter(parameters, "sata", sataN);
- addIndexedParameter(parameters, "scsi", scsiN);
- addIndexedParameter(parameters, "serial", serialN);
- addIndexedParameter(parameters, "unused", unusedN);
- addIndexedParameter(parameters, "usb", usbN);
- addIndexedParameter(parameters, "virtio", virtioN);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/config", parameters);
- }
-
- /**
- * Set virtual machine options (synchrounous API) - You
- * should consider using the POST method instead for any
- * actions involving hotplug or storage allocation.
- *
- * @param acpi Enable/disable ACPI.
- * @param agent Enable/disable Qemu GuestAgent and its
- * properties.
- * @param arch Virtual processor architecture. Defaults
- * to the host. Enum: x86_64,aarch64
- * @param args Arbitrary arguments passed to kvm.
- * @param autostart Automatic restart after crash
- * (currently ignored).
- * @param balloon Amount of target RAM for the VM in MB.
- * Using zero disables the ballon driver.
- * @param bios Select BIOS implementation. Enum:
- * seabios,ovmf
- * @param boot Boot on floppy (a), hard disk (c), CD-ROM
- * (d), or network (n).
- * @param bootdisk Enable booting from specified disk.
- * @param cdrom This is an alias for option -ide2
- * @param cicustom cloud-init: Specify custom files to
- * replace the automatically generated ones at start.
- * @param cipassword cloud-init: Password to assign the
- * user. Using this is generally not recommended. Use
- * ssh keys instead. Also note that older cloud-init
- * versions do not support hashed passwords.
- * @param citype Specifies the cloud-init configuration
- * format. The default depends on the configured
- * operating system type (`ostype`. We use the `nocloud`
- * format for Linux, and `configdrive2` for windows.
- * Enum: configdrive2,nocloud
- * @param ciuser cloud-init: User name to change ssh
- * keys and password for instead of the image's
- * configured default user.
- * @param cores The number of cores per socket.
- * @param cpu Emulated CPU type.
- * @param cpulimit Limit of CPU usage.
- * @param cpuunits CPU weight for a VM.
- * @param delete A list of settings you want to delete.
- * @param description Description for the VM. Only used
- * on the configuration web interface. This is saved as
- * comment inside the configuration file.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param efidisk0 Configure a Disk for storing EFI vars
- * @param force Force physical removal. Without this, we
- * simple remove the disk from the config file and
- * create an additional configuration entry called
- * 'unused[n]', which contains the volume ID. Unlink of
- * unused[n] always cause physical removal.
- * @param freeze Freeze CPU at startup (use 'c' monitor
- * command to start execution).
- * @param hookscript Script that will be executed during
- * various steps in the vms lifetime.
- * @param hostpciN Map host PCI devices into guest.
- * @param hotplug Selectively enable hotplug features.
- * This is a comma separated list of hotplug features:
- * 'network', 'disk', 'cpu', 'memory' and 'usb'. Use '0'
- * to disable hotplug completely. Value '1' is an alias
- * for the default 'network,disk,usb'.
- * @param hugepages Enable/disable hugepages memory.
- * Enum: any,2,1024
- * @param ideN Use volume as IDE hard disk or CD-ROM (n
- * is 0 to 3).
- * @param ipconfigN cloud-init: Specify IP addresses and
- * gateways for the corresponding interface. IP
- * addresses use CIDR notation, gateways are optional
- * but need an IP of the same type specified. The
- * special string 'dhcp' can be used for IP addresses to
- * use DHCP, in which case no explicit gateway should be
- * provided. For IPv6 the special string 'auto' can be
- * used to use stateless autoconfiguration. If
- * cloud-init is enabled and neither an IPv4 nor an IPv6
- * address is specified, it defaults to using dhcp on
- * IPv4.
- * @param ivshmem Inter-VM shared memory. Useful for
- * direct communication between VMs, or to the host.
- * @param keyboard Keybord layout for vnc server.
- * Default is read from the '/etc/pve/datacenter.cfg'
- * configuration file.It should not be necessary to set
- * it. Enum:
- * de,de-ch,da,en-gb,en-us,es,fi,fr,fr-be,fr-ca,fr-ch,hu,is,it,ja,lt,mk,nl,no,pl,pt,pt-br,sv,sl,tr
- * @param kvm Enable/disable KVM hardware
- * virtualization.
- * @param localtime Set the real time clock to local
- * time. This is enabled by default if ostype indicates
- * a Microsoft OS.
- * @param lock_ Lock/unlock the VM. Enum:
- * backup,clone,create,migrate,rollback,snapshot,snapshot-delete,suspending,suspended
- * @param machine Specifies the Qemu machine type.
- * @param memory Amount of RAM for the VM in MB. This is
- * the maximum available memory when you use the balloon
- * device.
- * @param migrate_downtime Set maximum tolerated
- * downtime (in seconds) for migrations.
- * @param migrate_speed Set maximum speed (in MB/s) for
- * migrations. Value 0 is no limit.
- * @param name Set a name for the VM. Only used on the
- * configuration web interface.
- * @param nameserver cloud-init: Sets DNS server IP
- * address for a container. Create will automatically
- * use the setting from the host if neither searchdomain
- * nor nameserver are set.
- * @param netN Specify network devices.
- * @param numa Enable/disable NUMA.
- * @param numaN NUMA topology.
- * @param onboot Specifies whether a VM will be started
- * during system bootup.
- * @param ostype Specify guest operating system. Enum:
- * other,wxp,w2k,w2k3,w2k8,wvista,win7,win8,win10,l24,l26,solaris
- * @param parallelN Map host parallel devices (n is 0 to
- * 2).
- * @param protection Sets the protection flag of the VM.
- * This will disable the remove VM and remove disk
- * operations.
- * @param reboot Allow reboot. If set to '0' the VM exit
- * on reboot.
- * @param revert Revert a pending change.
- * @param sataN Use volume as SATA hard disk or CD-ROM
- * (n is 0 to 5).
- * @param scsiN Use volume as SCSI hard disk or CD-ROM
- * (n is 0 to 13).
- * @param scsihw SCSI controller model Enum:
- * lsi,lsi53c810,virtio-scsi-pci,virtio-scsi-single,megasas,pvscsi
- * @param searchdomain cloud-init: Sets DNS search
- * domains for a container. Create will automatically
- * use the setting from the host if neither searchdomain
- * nor nameserver are set.
- * @param serialN Create a serial device inside the VM
- * (n is 0 to 3)
- * @param shares Amount of memory shares for
- * auto-ballooning. The larger the number is, the more
- * memory this VM gets. Number is relative to weights of
- * all other running VMs. Using zero disables
- * auto-ballooning. Auto-ballooning is done by pvestatd.
- * @param skiplock Ignore locks - only root is allowed
- * to use this option.
- * @param smbios1 Specify SMBIOS type 1 fields.
- * @param smp The number of CPUs. Please use option
- * -sockets instead.
- * @param sockets The number of CPU sockets.
- * @param sshkeys cloud-init: Setup public SSH keys (one
- * key per line, OpenSSH format).
- * @param startdate Set the initial date of the real
- * time clock. Valid format for date are: 'now' or
- * '2006-06-17T16:01:21' or '2006-06-17'.
- * @param startup Startup and shutdown behavior. Order
- * is a non-negative number defining the general startup
- * order. Shutdown in done with reverse ordering.
- * Additionally you can set the 'up' or 'down' delay in
- * seconds, which specifies a delay to wait before the
- * next VM is started or stopped.
- * @param tablet Enable/disable the USB tablet device.
- * @param tdf Enable/disable time drift fix.
- * @param template Enable/disable Template.
- * @param unusedN Reference to unused volumes. This is
- * used internally, and should not be modified manually.
- * @param usbN Configure an USB device (n is 0 to 4).
- * @param vcpus Number of hotplugged vcpus.
- * @param vga Configure the VGA hardware.
- * @param virtioN Use volume as VIRTIO hard disk (n is 0
- * to 15).
- * @param vmgenid Set VM Generation ID. Use '1' to
- * autogenerate on create or update, pass '0' to disable
- * explicitly.
- * @param vmstatestorage Default storage for VM state
- * volumes/files.
- * @param watchdog Create a virtual hardware watchdog
- * device.
- * @return Result
- * @throws JSONException
- */
- public Result updateVm(Boolean acpi, String agent, String arch, String args, Boolean autostart, Integer balloon, String bios, String boot, String bootdisk, String cdrom, String cicustom, String cipassword, String citype, String ciuser, Integer cores, String cpu, Integer cpulimit, Integer cpuunits, String delete, String description, String digest, String efidisk0, Boolean force, Boolean freeze, String hookscript, Map hostpciN, String hotplug, String hugepages, Map ideN, Map ipconfigN, String ivshmem, String keyboard, Boolean kvm, Boolean localtime, String lock_, String machine, Integer memory, Integer migrate_downtime, Integer migrate_speed, String name, String nameserver, Map netN, Boolean numa, Map numaN, Boolean onboot, String ostype, Map parallelN, Boolean protection, Boolean reboot, String revert, Map sataN, Map scsiN, String scsihw, String searchdomain, Map serialN, Integer shares, Boolean skiplock, String smbios1, Integer smp, Integer sockets, String sshkeys, String startdate, String startup, Boolean tablet, Boolean tdf, Boolean template, Map unusedN, Map usbN, Integer vcpus, String vga, Map virtioN, String vmgenid, String vmstatestorage, String watchdog) throws JSONException {
- return setRest(acpi, agent, arch, args, autostart, balloon, bios, boot, bootdisk, cdrom, cicustom, cipassword, citype, ciuser, cores, cpu, cpulimit, cpuunits, delete, description, digest, efidisk0, force, freeze, hookscript, hostpciN, hotplug, hugepages, ideN, ipconfigN, ivshmem, keyboard, kvm, localtime, lock_, machine, memory, migrate_downtime, migrate_speed, name, nameserver, netN, numa, numaN, onboot, ostype, parallelN, protection, reboot, revert, sataN, scsiN, scsihw, searchdomain, serialN, shares, skiplock, smbios1, smp, sockets, sshkeys, startdate, startup, tablet, tdf, template, unusedN, usbN, vcpus, vga, virtioN, vmgenid, vmstatestorage, watchdog);
- }
-
- /**
- * Set virtual machine options (synchrounous API) - You
- * should consider using the POST method instead for any
- * actions involving hotplug or storage allocation.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/config", null);
- }
-
- /**
- * Set virtual machine options (synchrounous API) - You
- * should consider using the POST method instead for any
- * actions involving hotplug or storage allocation.
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateVm() throws JSONException {
- return setRest();
- }
-
- }
-
- public class PVEPending {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEPending(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Get virtual machine configuration, including pending
- * changes.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/pending", null);
- }
-
- /**
- * Get virtual machine configuration, including pending
- * changes.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmPending() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEUnlink {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEUnlink(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Unlink/delete disk images.
- *
- * @param idlist A list of disk IDs you want to delete.
- * @param force Force physical removal. Without this, we
- * simple remove the disk from the config file and
- * create an additional configuration entry called
- * 'unused[n]', which contains the volume ID. Unlink of
- * unused[n] always cause physical removal.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String idlist, Boolean force) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("idlist", idlist);
- parameters.put("force", force);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/unlink", parameters);
- }
-
- /**
- * Unlink/delete disk images.
- *
- * @param idlist A list of disk IDs you want to delete.
- * @param force Force physical removal. Without this, we
- * simple remove the disk from the config file and
- * create an additional configuration entry called
- * 'unused[n]', which contains the volume ID. Unlink of
- * unused[n] always cause physical removal.
- * @return Result
- * @throws JSONException
- */
- public Result unlink(String idlist, Boolean force) throws JSONException {
- return setRest(idlist, force);
- }
-
- /**
- * Unlink/delete disk images.
- *
- * @param idlist A list of disk IDs you want to delete.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String idlist) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("idlist", idlist);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/unlink", parameters);
- }
-
- /**
- * Unlink/delete disk images.
- *
- * @param idlist A list of disk IDs you want to delete.
- * @return Result
- * @throws JSONException
- */
- public Result unlink(String idlist) throws JSONException {
- return setRest(idlist);
- }
-
- }
-
- public class PVEVncproxy {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEVncproxy(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Creates a TCP VNC proxy connections.
- *
- * @param websocket starts websockify instead of
- * vncproxy
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean websocket) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("websocket", websocket);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/vncproxy", parameters);
- }
-
- /**
- * Creates a TCP VNC proxy connections.
- *
- * @param websocket starts websockify instead of
- * vncproxy
- * @return Result
- * @throws JSONException
- */
- public Result vncproxy(Boolean websocket) throws JSONException {
- return createRest(websocket);
- }
-
- /**
- * Creates a TCP VNC proxy connections.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/vncproxy", null);
- }
-
- /**
- * Creates a TCP VNC proxy connections.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vncproxy() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVETermproxy {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVETermproxy(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Creates a TCP proxy connections.
- *
- * @param serial opens a serial terminal (defaults to
- * display) Enum: serial0,serial1,serial2,serial3
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String serial) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("serial", serial);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/termproxy", parameters);
- }
-
- /**
- * Creates a TCP proxy connections.
- *
- * @param serial opens a serial terminal (defaults to
- * display) Enum: serial0,serial1,serial2,serial3
- * @return Result
- * @throws JSONException
- */
- public Result termproxy(String serial) throws JSONException {
- return createRest(serial);
- }
-
- /**
- * Creates a TCP proxy connections.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/termproxy", null);
- }
-
- /**
- * Creates a TCP proxy connections.
- *
- * @return Result
- * @throws JSONException
- */
- public Result termproxy() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEVncwebsocket {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEVncwebsocket(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Opens a weksocket for VNC traffic.
- *
- * @param port Port number returned by previous vncproxy
- * call.
- * @param vncticket Ticket from previous call to
- * vncproxy.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(int port, String vncticket) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("port", port);
- parameters.put("vncticket", vncticket);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/vncwebsocket", parameters);
- }
-
- /**
- * Opens a weksocket for VNC traffic.
- *
- * @param port Port number returned by previous vncproxy
- * call.
- * @param vncticket Ticket from previous call to
- * vncproxy.
- * @return Result
- * @throws JSONException
- */
- public Result vncwebsocket(int port, String vncticket) throws JSONException {
- return getRest(port, vncticket);
- }
-
- }
-
- public class PVESpiceproxy {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESpiceproxy(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Returns a SPICE configuration to connect to the VM.
- *
- * @param proxy SPICE proxy server. This can be used by
- * the client to specify the proxy server. All nodes in
- * a cluster runs 'spiceproxy', so it is up to the
- * client to choose one. By default, we return the node
- * where the VM is currently running. As reasonable
- * setting is to use same node you use to connect to the
- * API (This is window.location.hostname for the JS
- * GUI).
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String proxy) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("proxy", proxy);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/spiceproxy", parameters);
- }
-
- /**
- * Returns a SPICE configuration to connect to the VM.
- *
- * @param proxy SPICE proxy server. This can be used by
- * the client to specify the proxy server. All nodes in
- * a cluster runs 'spiceproxy', so it is up to the
- * client to choose one. By default, we return the node
- * where the VM is currently running. As reasonable
- * setting is to use same node you use to connect to the
- * API (This is window.location.hostname for the JS
- * GUI).
- * @return Result
- * @throws JSONException
- */
- public Result spiceproxy(String proxy) throws JSONException {
- return createRest(proxy);
- }
-
- /**
- * Returns a SPICE configuration to connect to the VM.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/spiceproxy", null);
- }
-
- /**
- * Returns a SPICE configuration to connect to the VM.
- *
- * @return Result
- * @throws JSONException
- */
- public Result spiceproxy() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEStatus {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEStatus(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- private PVECurrent _current;
-
- public PVECurrent getCurrent() {
- if (_current == null) {
- _current = new PVECurrent(_client, _node, _vmid);
- }
-
- return _current;
- }
- private PVEStart _start;
-
- public PVEStart getStart() {
- if (_start == null) {
- _start = new PVEStart(_client, _node, _vmid);
- }
-
- return _start;
- }
- private PVEStop _stop;
-
- public PVEStop getStop() {
- if (_stop == null) {
- _stop = new PVEStop(_client, _node, _vmid);
- }
-
- return _stop;
- }
- private PVEReset _reset;
-
- public PVEReset getReset() {
- if (_reset == null) {
- _reset = new PVEReset(_client, _node, _vmid);
- }
-
- return _reset;
- }
- private PVEShutdown _shutdown;
-
- public PVEShutdown getShutdown() {
- if (_shutdown == null) {
- _shutdown = new PVEShutdown(_client, _node, _vmid);
- }
-
- return _shutdown;
- }
- private PVESuspend _suspend;
-
- public PVESuspend getSuspend() {
- if (_suspend == null) {
- _suspend = new PVESuspend(_client, _node, _vmid);
- }
-
- return _suspend;
- }
- private PVEResume _resume;
-
- public PVEResume getResume() {
- if (_resume == null) {
- _resume = new PVEResume(_client, _node, _vmid);
- }
-
- return _resume;
- }
-
- public class PVECurrent {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVECurrent(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Get virtual machine status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/status/current", null);
- }
-
- /**
- * Get virtual machine status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmStatus() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEStart {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEStart(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Start virtual machine.
- *
- * @param machine Specifies the Qemu machine type.
- * @param migratedfrom The cluster node name.
- * @param migration_network CIDR of the (sub)
- * network that is used for migration.
- * @param migration_type Migration traffic is
- * encrypted using an SSH tunnel by default. On
- * secure, completely private networks this can be
- * disabled to increase performance. Enum:
- * secure,insecure
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @param stateuri Some command save/restore state
- * from this location.
- * @param targetstorage Target storage for the
- * migration. (Can be '1' to use the same storage id
- * as on the source node.)
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String machine, String migratedfrom, String migration_network, String migration_type, Boolean skiplock, String stateuri, String targetstorage) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("machine", machine);
- parameters.put("migratedfrom", migratedfrom);
- parameters.put("migration_network", migration_network);
- parameters.put("migration_type", migration_type);
- parameters.put("skiplock", skiplock);
- parameters.put("stateuri", stateuri);
- parameters.put("targetstorage", targetstorage);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/start", parameters);
- }
-
- /**
- * Start virtual machine.
- *
- * @param machine Specifies the Qemu machine type.
- * @param migratedfrom The cluster node name.
- * @param migration_network CIDR of the (sub)
- * network that is used for migration.
- * @param migration_type Migration traffic is
- * encrypted using an SSH tunnel by default. On
- * secure, completely private networks this can be
- * disabled to increase performance. Enum:
- * secure,insecure
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @param stateuri Some command save/restore state
- * from this location.
- * @param targetstorage Target storage for the
- * migration. (Can be '1' to use the same storage id
- * as on the source node.)
- * @return Result
- * @throws JSONException
- */
- public Result vmStart(String machine, String migratedfrom, String migration_network, String migration_type, Boolean skiplock, String stateuri, String targetstorage) throws JSONException {
- return createRest(machine, migratedfrom, migration_network, migration_type, skiplock, stateuri, targetstorage);
- }
-
- /**
- * Start virtual machine.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/start", null);
- }
-
- /**
- * Start virtual machine.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmStart() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEStop {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEStop(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Stop virtual machine. The qemu process will exit
- * immediately. Thisis akin to pulling the power
- * plug of a running computer and may damage the VM
- * data
- *
- * @param keepActive Do not deactivate storage
- * volumes.
- * @param migratedfrom The cluster node name.
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @param timeout Wait maximal timeout seconds.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean keepActive, String migratedfrom, Boolean skiplock, Integer timeout) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("keepActive", keepActive);
- parameters.put("migratedfrom", migratedfrom);
- parameters.put("skiplock", skiplock);
- parameters.put("timeout", timeout);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/stop", parameters);
- }
-
- /**
- * Stop virtual machine. The qemu process will exit
- * immediately. Thisis akin to pulling the power
- * plug of a running computer and may damage the VM
- * data
- *
- * @param keepActive Do not deactivate storage
- * volumes.
- * @param migratedfrom The cluster node name.
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @param timeout Wait maximal timeout seconds.
- * @return Result
- * @throws JSONException
- */
- public Result vmStop(Boolean keepActive, String migratedfrom, Boolean skiplock, Integer timeout) throws JSONException {
- return createRest(keepActive, migratedfrom, skiplock, timeout);
- }
-
- /**
- * Stop virtual machine. The qemu process will exit
- * immediately. Thisis akin to pulling the power
- * plug of a running computer and may damage the VM
- * data
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/stop", null);
- }
-
- /**
- * Stop virtual machine. The qemu process will exit
- * immediately. Thisis akin to pulling the power
- * plug of a running computer and may damage the VM
- * data
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmStop() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEReset {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEReset(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Reset virtual machine.
- *
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean skiplock) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("skiplock", skiplock);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/reset", parameters);
- }
-
- /**
- * Reset virtual machine.
- *
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result vmReset(Boolean skiplock) throws JSONException {
- return createRest(skiplock);
- }
-
- /**
- * Reset virtual machine.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/reset", null);
- }
-
- /**
- * Reset virtual machine.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmReset() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEShutdown {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEShutdown(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Shutdown virtual machine. This is similar to
- * pressing the power button on a physical
- * machine.This will send an ACPI event for the
- * guest OS, which should then proceed to a clean
- * shutdown.
- *
- * @param forceStop Make sure the VM stops.
- * @param keepActive Do not deactivate storage
- * volumes.
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @param timeout Wait maximal timeout seconds.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean forceStop, Boolean keepActive, Boolean skiplock, Integer timeout) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("forceStop", forceStop);
- parameters.put("keepActive", keepActive);
- parameters.put("skiplock", skiplock);
- parameters.put("timeout", timeout);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/shutdown", parameters);
- }
-
- /**
- * Shutdown virtual machine. This is similar to
- * pressing the power button on a physical
- * machine.This will send an ACPI event for the
- * guest OS, which should then proceed to a clean
- * shutdown.
- *
- * @param forceStop Make sure the VM stops.
- * @param keepActive Do not deactivate storage
- * volumes.
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @param timeout Wait maximal timeout seconds.
- * @return Result
- * @throws JSONException
- */
- public Result vmShutdown(Boolean forceStop, Boolean keepActive, Boolean skiplock, Integer timeout) throws JSONException {
- return createRest(forceStop, keepActive, skiplock, timeout);
- }
-
- /**
- * Shutdown virtual machine. This is similar to
- * pressing the power button on a physical
- * machine.This will send an ACPI event for the
- * guest OS, which should then proceed to a clean
- * shutdown.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/shutdown", null);
- }
-
- /**
- * Shutdown virtual machine. This is similar to
- * pressing the power button on a physical
- * machine.This will send an ACPI event for the
- * guest OS, which should then proceed to a clean
- * shutdown.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmShutdown() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVESuspend {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESuspend(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Suspend virtual machine.
- *
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @param statestorage The storage for the VM state
- * @param todisk If set, suspends the VM to disk.
- * Will be resumed on next VM start.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean skiplock, String statestorage, Boolean todisk) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("skiplock", skiplock);
- parameters.put("statestorage", statestorage);
- parameters.put("todisk", todisk);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/suspend", parameters);
- }
-
- /**
- * Suspend virtual machine.
- *
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @param statestorage The storage for the VM state
- * @param todisk If set, suspends the VM to disk.
- * Will be resumed on next VM start.
- * @return Result
- * @throws JSONException
- */
- public Result vmSuspend(Boolean skiplock, String statestorage, Boolean todisk) throws JSONException {
- return createRest(skiplock, statestorage, todisk);
- }
-
- /**
- * Suspend virtual machine.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/suspend", null);
- }
-
- /**
- * Suspend virtual machine.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmSuspend() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEResume {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEResume(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Resume virtual machine.
- *
- * @param nocheck
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean nocheck, Boolean skiplock) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("nocheck", nocheck);
- parameters.put("skiplock", skiplock);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/resume", parameters);
- }
-
- /**
- * Resume virtual machine.
- *
- * @param nocheck
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result vmResume(Boolean nocheck, Boolean skiplock) throws JSONException {
- return createRest(nocheck, skiplock);
- }
-
- /**
- * Resume virtual machine.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/resume", null);
- }
-
- /**
- * Resume virtual machine.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmResume() throws JSONException {
- return createRest();
- }
-
- }
-
- /**
- * Directory index
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/status", null);
- }
-
- /**
- * Directory index
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmcmdidx() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVESendkey {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESendkey(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Send key event to virtual machine.
- *
- * @param key The key (qemu monitor encoding).
- * @param skiplock Ignore locks - only root is allowed
- * to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String key, Boolean skiplock) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("key", key);
- parameters.put("skiplock", skiplock);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/sendkey", parameters);
- }
-
- /**
- * Send key event to virtual machine.
- *
- * @param key The key (qemu monitor encoding).
- * @param skiplock Ignore locks - only root is allowed
- * to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result vmSendkey(String key, Boolean skiplock) throws JSONException {
- return setRest(key, skiplock);
- }
-
- /**
- * Send key event to virtual machine.
- *
- * @param key The key (qemu monitor encoding).
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String key) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("key", key);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/sendkey", parameters);
- }
-
- /**
- * Send key event to virtual machine.
- *
- * @param key The key (qemu monitor encoding).
- * @return Result
- * @throws JSONException
- */
- public Result vmSendkey(String key) throws JSONException {
- return setRest(key);
- }
-
- }
-
- public class PVEFeature {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEFeature(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Check if feature for virtual machine is available.
- *
- * @param feature Feature to check. Enum:
- * snapshot,clone,copy
- * @param snapname The name of the snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String feature, String snapname) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("feature", feature);
- parameters.put("snapname", snapname);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/feature", parameters);
- }
-
- /**
- * Check if feature for virtual machine is available.
- *
- * @param feature Feature to check. Enum:
- * snapshot,clone,copy
- * @param snapname The name of the snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result vmFeature(String feature, String snapname) throws JSONException {
- return getRest(feature, snapname);
- }
-
- /**
- * Check if feature for virtual machine is available.
- *
- * @param feature Feature to check. Enum:
- * snapshot,clone,copy
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String feature) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("feature", feature);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/feature", parameters);
- }
-
- /**
- * Check if feature for virtual machine is available.
- *
- * @param feature Feature to check. Enum:
- * snapshot,clone,copy
- * @return Result
- * @throws JSONException
- */
- public Result vmFeature(String feature) throws JSONException {
- return getRest(feature);
- }
-
- }
-
- public class PVEClone {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEClone(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Create a copy of virtual machine/template.
- *
- * @param newid VMID for the clone.
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param description Description for the new VM.
- * @param format Target format for file storage. Only
- * valid for full clone. Enum: raw,qcow2,vmdk
- * @param full Create a full copy of all disks. This is
- * always done when you clone a normal VM. For VM
- * templates, we try to create a linked clone by
- * default.
- * @param name Set a name for the new VM.
- * @param pool Add the new VM to the specified pool.
- * @param snapname The name of the snapshot.
- * @param storage Target storage for full clone.
- * @param target Target node. Only allowed if the
- * original VM is on shared storage.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(int newid, Integer bwlimit, String description, String format, Boolean full, String name, String pool, String snapname, String storage, String target) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("newid", newid);
- parameters.put("bwlimit", bwlimit);
- parameters.put("description", description);
- parameters.put("format", format);
- parameters.put("full", full);
- parameters.put("name", name);
- parameters.put("pool", pool);
- parameters.put("snapname", snapname);
- parameters.put("storage", storage);
- parameters.put("target", target);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/clone", parameters);
- }
-
- /**
- * Create a copy of virtual machine/template.
- *
- * @param newid VMID for the clone.
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param description Description for the new VM.
- * @param format Target format for file storage. Only
- * valid for full clone. Enum: raw,qcow2,vmdk
- * @param full Create a full copy of all disks. This is
- * always done when you clone a normal VM. For VM
- * templates, we try to create a linked clone by
- * default.
- * @param name Set a name for the new VM.
- * @param pool Add the new VM to the specified pool.
- * @param snapname The name of the snapshot.
- * @param storage Target storage for full clone.
- * @param target Target node. Only allowed if the
- * original VM is on shared storage.
- * @return Result
- * @throws JSONException
- */
- public Result cloneVm(int newid, Integer bwlimit, String description, String format, Boolean full, String name, String pool, String snapname, String storage, String target) throws JSONException {
- return createRest(newid, bwlimit, description, format, full, name, pool, snapname, storage, target);
- }
-
- /**
- * Create a copy of virtual machine/template.
- *
- * @param newid VMID for the clone.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(int newid) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("newid", newid);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/clone", parameters);
- }
-
- /**
- * Create a copy of virtual machine/template.
- *
- * @param newid VMID for the clone.
- * @return Result
- * @throws JSONException
- */
- public Result cloneVm(int newid) throws JSONException {
- return createRest(newid);
- }
-
- }
-
- public class PVEMoveDisk {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEMoveDisk(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Move volume to different storage.
- *
- * @param disk The disk you want to move. Enum:
- * ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
- * @param storage Target storage.
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param delete Delete the original disk after
- * successful copy. By default the original disk is kept
- * as unused disk.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param format Target Format. Enum: raw,qcow2,vmdk
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String disk, String storage, Integer bwlimit, Boolean delete, String digest, String format) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("disk", disk);
- parameters.put("storage", storage);
- parameters.put("bwlimit", bwlimit);
- parameters.put("delete", delete);
- parameters.put("digest", digest);
- parameters.put("format", format);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/move_disk", parameters);
- }
-
- /**
- * Move volume to different storage.
- *
- * @param disk The disk you want to move. Enum:
- * ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
- * @param storage Target storage.
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param delete Delete the original disk after
- * successful copy. By default the original disk is kept
- * as unused disk.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param format Target Format. Enum: raw,qcow2,vmdk
- * @return Result
- * @throws JSONException
- */
- public Result moveVmDisk(String disk, String storage, Integer bwlimit, Boolean delete, String digest, String format) throws JSONException {
- return createRest(disk, storage, bwlimit, delete, digest, format);
- }
-
- /**
- * Move volume to different storage.
- *
- * @param disk The disk you want to move. Enum:
- * ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
- * @param storage Target storage.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String disk, String storage) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("disk", disk);
- parameters.put("storage", storage);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/move_disk", parameters);
- }
-
- /**
- * Move volume to different storage.
- *
- * @param disk The disk you want to move. Enum:
- * ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
- * @param storage Target storage.
- * @return Result
- * @throws JSONException
- */
- public Result moveVmDisk(String disk, String storage) throws JSONException {
- return createRest(disk, storage);
- }
-
- }
-
- public class PVEMigrate {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEMigrate(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Get preconditions for migration.
- *
- * @param target Target node.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String target) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("target", target);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/migrate", parameters);
- }
-
- /**
- * Get preconditions for migration.
- *
- * @param target Target node.
- * @return Result
- * @throws JSONException
- */
- public Result migrateVmPrecondition(String target) throws JSONException {
- return getRest(target);
- }
-
- /**
- * Get preconditions for migration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/migrate", null);
- }
-
- /**
- * Get preconditions for migration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result migrateVmPrecondition() throws JSONException {
- return getRest();
- }
-
- /**
- * Migrate virtual machine. Creates a new migration
- * task.
- *
- * @param target Target node.
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param force Allow to migrate VMs which use local
- * devices. Only root may use this option.
- * @param migration_network CIDR of the (sub) network
- * that is used for migration.
- * @param migration_type Migration traffic is encrypted
- * using an SSH tunnel by default. On secure, completely
- * private networks this can be disabled to increase
- * performance. Enum: secure,insecure
- * @param online Use online/live migration.
- * @param targetstorage Default target storage.
- * @param with_local_disks Enable live storage migration
- * for local disk
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String target, Integer bwlimit, Boolean force, String migration_network, String migration_type, Boolean online, String targetstorage, Boolean with_local_disks) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("target", target);
- parameters.put("bwlimit", bwlimit);
- parameters.put("force", force);
- parameters.put("migration_network", migration_network);
- parameters.put("migration_type", migration_type);
- parameters.put("online", online);
- parameters.put("targetstorage", targetstorage);
- parameters.put("with-local-disks", with_local_disks);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/migrate", parameters);
- }
-
- /**
- * Migrate virtual machine. Creates a new migration
- * task.
- *
- * @param target Target node.
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param force Allow to migrate VMs which use local
- * devices. Only root may use this option.
- * @param migration_network CIDR of the (sub) network
- * that is used for migration.
- * @param migration_type Migration traffic is encrypted
- * using an SSH tunnel by default. On secure, completely
- * private networks this can be disabled to increase
- * performance. Enum: secure,insecure
- * @param online Use online/live migration.
- * @param targetstorage Default target storage.
- * @param with_local_disks Enable live storage migration
- * for local disk
- * @return Result
- * @throws JSONException
- */
- public Result migrateVm(String target, Integer bwlimit, Boolean force, String migration_network, String migration_type, Boolean online, String targetstorage, Boolean with_local_disks) throws JSONException {
- return createRest(target, bwlimit, force, migration_network, migration_type, online, targetstorage, with_local_disks);
- }
-
- /**
- * Migrate virtual machine. Creates a new migration
- * task.
- *
- * @param target Target node.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String target) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("target", target);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/migrate", parameters);
- }
-
- /**
- * Migrate virtual machine. Creates a new migration
- * task.
- *
- * @param target Target node.
- * @return Result
- * @throws JSONException
- */
- public Result migrateVm(String target) throws JSONException {
- return createRest(target);
- }
-
- }
-
- public class PVEMonitor {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEMonitor(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Execute Qemu monitor commands.
- *
- * @param command The monitor command.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String command) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("command", command);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/monitor", parameters);
- }
-
- /**
- * Execute Qemu monitor commands.
- *
- * @param command The monitor command.
- * @return Result
- * @throws JSONException
- */
- public Result monitor(String command) throws JSONException {
- return createRest(command);
- }
-
- }
-
- public class PVEResize {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEResize(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Extend volume size.
- *
- * @param disk The disk you want to resize. Enum:
- * ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
- * @param size The new size. With the `+` sign the value
- * is added to the actual size of the volume and without
- * it, the value is taken as an absolute one. Shrinking
- * disk size is not supported.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param skiplock Ignore locks - only root is allowed
- * to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String disk, String size, String digest, Boolean skiplock) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("disk", disk);
- parameters.put("size", size);
- parameters.put("digest", digest);
- parameters.put("skiplock", skiplock);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/resize", parameters);
- }
-
- /**
- * Extend volume size.
- *
- * @param disk The disk you want to resize. Enum:
- * ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
- * @param size The new size. With the `+` sign the value
- * is added to the actual size of the volume and without
- * it, the value is taken as an absolute one. Shrinking
- * disk size is not supported.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param skiplock Ignore locks - only root is allowed
- * to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result resizeVm(String disk, String size, String digest, Boolean skiplock) throws JSONException {
- return setRest(disk, size, digest, skiplock);
- }
-
- /**
- * Extend volume size.
- *
- * @param disk The disk you want to resize. Enum:
- * ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
- * @param size The new size. With the `+` sign the value
- * is added to the actual size of the volume and without
- * it, the value is taken as an absolute one. Shrinking
- * disk size is not supported.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String disk, String size) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("disk", disk);
- parameters.put("size", size);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/resize", parameters);
- }
-
- /**
- * Extend volume size.
- *
- * @param disk The disk you want to resize. Enum:
- * ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
- * @param size The new size. With the `+` sign the value
- * is added to the actual size of the volume and without
- * it, the value is taken as an absolute one. Shrinking
- * disk size is not supported.
- * @return Result
- * @throws JSONException
- */
- public Result resizeVm(String disk, String size) throws JSONException {
- return setRest(disk, size);
- }
-
- }
-
- public class PVESnapshot {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESnapshot(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- public PVEItemSnapname get(Object snapname) {
- return new PVEItemSnapname(_client, _node, _vmid, snapname);
- }
-
- public class PVEItemSnapname {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _snapname;
-
- protected PVEItemSnapname(PveClient client, Object node, Object vmid, Object snapname) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _snapname = snapname;
- }
-
- private PVEConfig _config;
-
- public PVEConfig getConfig() {
- if (_config == null) {
- _config = new PVEConfig(_client, _node, _vmid, _snapname);
- }
-
- return _config;
- }
- private PVERollback _rollback;
-
- public PVERollback getRollback() {
- if (_rollback == null) {
- _rollback = new PVERollback(_client, _node, _vmid, _snapname);
- }
-
- return _rollback;
- }
-
- public class PVEConfig {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _snapname;
-
- protected PVEConfig(PveClient client, Object node, Object vmid, Object snapname) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _snapname = snapname;
- }
-
- /**
- * Get snapshot configuration
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/config", null);
- }
-
- /**
- * Get snapshot configuration
- *
- * @return Result
- * @throws JSONException
- */
- public Result getSnapshotConfig() throws JSONException {
- return getRest();
- }
-
- /**
- * Update snapshot metadata.
- *
- * @param description A textual description or
- * comment.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String description) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("description", description);
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/config", parameters);
- }
-
- /**
- * Update snapshot metadata.
- *
- * @param description A textual description or
- * comment.
- * @return Result
- * @throws JSONException
- */
- public Result updateSnapshotConfig(String description) throws JSONException {
- return setRest(description);
- }
-
- /**
- * Update snapshot metadata.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/config", null);
- }
-
- /**
- * Update snapshot metadata.
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateSnapshotConfig() throws JSONException {
- return setRest();
- }
-
- }
-
- public class PVERollback {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _snapname;
-
- protected PVERollback(PveClient client, Object node, Object vmid, Object snapname) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _snapname = snapname;
- }
-
- /**
- * Rollback VM state to specified snapshot.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/rollback", null);
- }
-
- /**
- * Rollback VM state to specified snapshot.
- *
- * @return Result
- * @throws JSONException
- */
- public Result rollback() throws JSONException {
- return createRest();
- }
-
- }
-
- /**
- * Delete a VM snapshot.
- *
- * @param force For removal from config file, even
- * if removing disk snapshots fails.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(Boolean force) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("force", force);
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "", parameters);
- }
-
- /**
- * Delete a VM snapshot.
- *
- * @param force For removal from config file, even
- * if removing disk snapshots fails.
- * @return Result
- * @throws JSONException
- */
- public Result delsnapshot(Boolean force) throws JSONException {
- return deleteRest(force);
- }
-
- /**
- * Delete a VM snapshot.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "", null);
- }
-
- /**
- * Delete a VM snapshot.
- *
- * @return Result
- * @throws JSONException
- */
- public Result delsnapshot() throws JSONException {
- return deleteRest();
- }
-
- /**
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "", null);
- }
-
- /**
- *
- * @return Result
- * @throws JSONException
- */
- public Result snapshotCmdIdx() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * List all snapshots.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot", null);
- }
-
- /**
- * List all snapshots.
- *
- * @return Result
- * @throws JSONException
- */
- public Result snapshotList() throws JSONException {
- return getRest();
- }
-
- /**
- * Snapshot a VM.
- *
- * @param snapname The name of the snapshot.
- * @param description A textual description or comment.
- * @param vmstate Save the vmstate
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String snapname, String description, Boolean vmstate) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("snapname", snapname);
- parameters.put("description", description);
- parameters.put("vmstate", vmstate);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot", parameters);
- }
-
- /**
- * Snapshot a VM.
- *
- * @param snapname The name of the snapshot.
- * @param description A textual description or comment.
- * @param vmstate Save the vmstate
- * @return Result
- * @throws JSONException
- */
- public Result snapshot(String snapname, String description, Boolean vmstate) throws JSONException {
- return createRest(snapname, description, vmstate);
- }
-
- /**
- * Snapshot a VM.
- *
- * @param snapname The name of the snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String snapname) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("snapname", snapname);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot", parameters);
- }
-
- /**
- * Snapshot a VM.
- *
- * @param snapname The name of the snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result snapshot(String snapname) throws JSONException {
- return createRest(snapname);
- }
-
- }
-
- public class PVETemplate {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVETemplate(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Create a Template.
- *
- * @param disk If you want to convert only 1 disk to
- * base image. Enum:
- * ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String disk) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("disk", disk);
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/template", parameters);
- }
-
- /**
- * Create a Template.
- *
- * @param disk If you want to convert only 1 disk to
- * base image. Enum:
- * ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
- * @return Result
- * @throws JSONException
- */
- public Result template(String disk) throws JSONException {
- return createRest(disk);
- }
-
- /**
- * Create a Template.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/template", null);
- }
-
- /**
- * Create a Template.
- *
- * @return Result
- * @throws JSONException
- */
- public Result template() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVECloudinit {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVECloudinit(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- private PVEDump _dump;
-
- public PVEDump getDump() {
- if (_dump == null) {
- _dump = new PVEDump(_client, _node, _vmid);
- }
-
- return _dump;
- }
-
- public class PVEDump {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEDump(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Get automatically generated cloudinit config.
- *
- * @param type Config type. Enum: user,network,meta
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("type", type);
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/cloudinit/dump", parameters);
- }
-
- /**
- * Get automatically generated cloudinit config.
- *
- * @param type Config type. Enum: user,network,meta
- * @return Result
- * @throws JSONException
- */
- public Result cloudinitGeneratedConfigDump(String type) throws JSONException {
- return getRest(type);
- }
-
- }
-
- }
-
- /**
- * Destroy the vm (also delete all used/owned volumes).
- *
- * @param skiplock Ignore locks - only root is allowed to
- * use this option.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(Boolean skiplock) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("skiplock", skiplock);
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "", parameters);
- }
-
- /**
- * Destroy the vm (also delete all used/owned volumes).
- *
- * @param skiplock Ignore locks - only root is allowed to
- * use this option.
- * @return Result
- * @throws JSONException
- */
- public Result destroyVm(Boolean skiplock) throws JSONException {
- return deleteRest(skiplock);
- }
-
- /**
- * Destroy the vm (also delete all used/owned volumes).
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "", null);
- }
-
- /**
- * Destroy the vm (also delete all used/owned volumes).
- *
- * @return Result
- * @throws JSONException
- */
- public Result destroyVm() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Directory index
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "", null);
- }
-
- /**
- * Directory index
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmdiridx() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * Virtual machine index (per node).
- *
- * @param full Determine the full status of active VMs.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(Boolean full) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("full", full);
- return _client.get("/nodes/" + _node + "/qemu", parameters);
- }
-
- /**
- * Virtual machine index (per node).
- *
- * @param full Determine the full status of active VMs.
- * @return Result
- * @throws JSONException
- */
- public Result vmlist(Boolean full) throws JSONException {
- return getRest(full);
- }
-
- /**
- * Virtual machine index (per node).
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/qemu", null);
- }
-
- /**
- * Virtual machine index (per node).
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmlist() throws JSONException {
- return getRest();
- }
-
- /**
- * Create or restore a virtual machine.
- *
- * @param vmid The (unique) ID of the VM.
- * @param acpi Enable/disable ACPI.
- * @param agent Enable/disable Qemu GuestAgent and its
- * properties.
- * @param arch Virtual processor architecture. Defaults to the
- * host. Enum: x86_64,aarch64
- * @param archive The backup file.
- * @param args Arbitrary arguments passed to kvm.
- * @param autostart Automatic restart after crash (currently
- * ignored).
- * @param balloon Amount of target RAM for the VM in MB. Using
- * zero disables the ballon driver.
- * @param bios Select BIOS implementation. Enum: seabios,ovmf
- * @param boot Boot on floppy (a), hard disk (c), CD-ROM (d), or
- * network (n).
- * @param bootdisk Enable booting from specified disk.
- * @param bwlimit Override I/O bandwidth limit (in KiB/s).
- * @param cdrom This is an alias for option -ide2
- * @param cicustom cloud-init: Specify custom files to replace
- * the automatically generated ones at start.
- * @param cipassword cloud-init: Password to assign the user.
- * Using this is generally not recommended. Use ssh keys
- * instead. Also note that older cloud-init versions do not
- * support hashed passwords.
- * @param citype Specifies the cloud-init configuration format.
- * The default depends on the configured operating system type
- * (`ostype`. We use the `nocloud` format for Linux, and
- * `configdrive2` for windows. Enum: configdrive2,nocloud
- * @param ciuser cloud-init: User name to change ssh keys and
- * password for instead of the image's configured default user.
- * @param cores The number of cores per socket.
- * @param cpu Emulated CPU type.
- * @param cpulimit Limit of CPU usage.
- * @param cpuunits CPU weight for a VM.
- * @param description Description for the VM. Only used on the
- * configuration web interface. This is saved as comment inside
- * the configuration file.
- * @param efidisk0 Configure a Disk for storing EFI vars
- * @param force Allow to overwrite existing VM.
- * @param freeze Freeze CPU at startup (use 'c' monitor command
- * to start execution).
- * @param hookscript Script that will be executed during various
- * steps in the vms lifetime.
- * @param hostpciN Map host PCI devices into guest.
- * @param hotplug Selectively enable hotplug features. This is a
- * comma separated list of hotplug features: 'network', 'disk',
- * 'cpu', 'memory' and 'usb'. Use '0' to disable hotplug
- * completely. Value '1' is an alias for the default
- * 'network,disk,usb'.
- * @param hugepages Enable/disable hugepages memory. Enum:
- * any,2,1024
- * @param ideN Use volume as IDE hard disk or CD-ROM (n is 0 to
- * 3).
- * @param ipconfigN cloud-init: Specify IP addresses and
- * gateways for the corresponding interface. IP addresses use
- * CIDR notation, gateways are optional but need an IP of the
- * same type specified. The special string 'dhcp' can be used
- * for IP addresses to use DHCP, in which case no explicit
- * gateway should be provided. For IPv6 the special string
- * 'auto' can be used to use stateless autoconfiguration. If
- * cloud-init is enabled and neither an IPv4 nor an IPv6 address
- * is specified, it defaults to using dhcp on IPv4.
- * @param ivshmem Inter-VM shared memory. Useful for direct
- * communication between VMs, or to the host.
- * @param keyboard Keybord layout for vnc server. Default is
- * read from the '/etc/pve/datacenter.cfg' configuration file.It
- * should not be necessary to set it. Enum:
- * de,de-ch,da,en-gb,en-us,es,fi,fr,fr-be,fr-ca,fr-ch,hu,is,it,ja,lt,mk,nl,no,pl,pt,pt-br,sv,sl,tr
- * @param kvm Enable/disable KVM hardware virtualization.
- * @param localtime Set the real time clock to local time. This
- * is enabled by default if ostype indicates a Microsoft OS.
- * @param lock_ Lock/unlock the VM. Enum:
- * backup,clone,create,migrate,rollback,snapshot,snapshot-delete,suspending,suspended
- * @param machine Specifies the Qemu machine type.
- * @param memory Amount of RAM for the VM in MB. This is the
- * maximum available memory when you use the balloon device.
- * @param migrate_downtime Set maximum tolerated downtime (in
- * seconds) for migrations.
- * @param migrate_speed Set maximum speed (in MB/s) for
- * migrations. Value 0 is no limit.
- * @param name Set a name for the VM. Only used on the
- * configuration web interface.
- * @param nameserver cloud-init: Sets DNS server IP address for
- * a container. Create will automatically use the setting from
- * the host if neither searchdomain nor nameserver are set.
- * @param netN Specify network devices.
- * @param numa Enable/disable NUMA.
- * @param numaN NUMA topology.
- * @param onboot Specifies whether a VM will be started during
- * system bootup.
- * @param ostype Specify guest operating system. Enum:
- * other,wxp,w2k,w2k3,w2k8,wvista,win7,win8,win10,l24,l26,solaris
- * @param parallelN Map host parallel devices (n is 0 to 2).
- * @param pool Add the VM to the specified pool.
- * @param protection Sets the protection flag of the VM. This
- * will disable the remove VM and remove disk operations.
- * @param reboot Allow reboot. If set to '0' the VM exit on
- * reboot.
- * @param sataN Use volume as SATA hard disk or CD-ROM (n is 0
- * to 5).
- * @param scsiN Use volume as SCSI hard disk or CD-ROM (n is 0
- * to 13).
- * @param scsihw SCSI controller model Enum:
- * lsi,lsi53c810,virtio-scsi-pci,virtio-scsi-single,megasas,pvscsi
- * @param searchdomain cloud-init: Sets DNS search domains for a
- * container. Create will automatically use the setting from the
- * host if neither searchdomain nor nameserver are set.
- * @param serialN Create a serial device inside the VM (n is 0
- * to 3)
- * @param shares Amount of memory shares for auto-ballooning.
- * The larger the number is, the more memory this VM gets.
- * Number is relative to weights of all other running VMs. Using
- * zero disables auto-ballooning. Auto-ballooning is done by
- * pvestatd.
- * @param smbios1 Specify SMBIOS type 1 fields.
- * @param smp The number of CPUs. Please use option -sockets
- * instead.
- * @param sockets The number of CPU sockets.
- * @param sshkeys cloud-init: Setup public SSH keys (one key per
- * line, OpenSSH format).
- * @param start Start VM after it was created successfully.
- * @param startdate Set the initial date of the real time clock.
- * Valid format for date are: 'now' or '2006-06-17T16:01:21' or
- * '2006-06-17'.
- * @param startup Startup and shutdown behavior. Order is a
- * non-negative number defining the general startup order.
- * Shutdown in done with reverse ordering. Additionally you can
- * set the 'up' or 'down' delay in seconds, which specifies a
- * delay to wait before the next VM is started or stopped.
- * @param storage Default storage.
- * @param tablet Enable/disable the USB tablet device.
- * @param tdf Enable/disable time drift fix.
- * @param template Enable/disable Template.
- * @param unique Assign a unique random ethernet address.
- * @param unusedN Reference to unused volumes. This is used
- * internally, and should not be modified manually.
- * @param usbN Configure an USB device (n is 0 to 4).
- * @param vcpus Number of hotplugged vcpus.
- * @param vga Configure the VGA hardware.
- * @param virtioN Use volume as VIRTIO hard disk (n is 0 to 15).
- * @param vmgenid Set VM Generation ID. Use '1' to autogenerate
- * on create or update, pass '0' to disable explicitly.
- * @param vmstatestorage Default storage for VM state
- * volumes/files.
- * @param watchdog Create a virtual hardware watchdog device.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(int vmid, Boolean acpi, String agent, String arch, String archive, String args, Boolean autostart, Integer balloon, String bios, String boot, String bootdisk, Integer bwlimit, String cdrom, String cicustom, String cipassword, String citype, String ciuser, Integer cores, String cpu, Integer cpulimit, Integer cpuunits, String description, String efidisk0, Boolean force, Boolean freeze, String hookscript, Map hostpciN, String hotplug, String hugepages, Map ideN, Map ipconfigN, String ivshmem, String keyboard, Boolean kvm, Boolean localtime, String lock_, String machine, Integer memory, Integer migrate_downtime, Integer migrate_speed, String name, String nameserver, Map netN, Boolean numa, Map numaN, Boolean onboot, String ostype, Map parallelN, String pool, Boolean protection, Boolean reboot, Map sataN, Map scsiN, String scsihw, String searchdomain, Map serialN, Integer shares, String smbios1, Integer smp, Integer sockets, String sshkeys, Boolean start, String startdate, String startup, String storage, Boolean tablet, Boolean tdf, Boolean template, Boolean unique, Map unusedN, Map usbN, Integer vcpus, String vga, Map virtioN, String vmgenid, String vmstatestorage, String watchdog) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("vmid", vmid);
- parameters.put("acpi", acpi);
- parameters.put("agent", agent);
- parameters.put("arch", arch);
- parameters.put("archive", archive);
- parameters.put("args", args);
- parameters.put("autostart", autostart);
- parameters.put("balloon", balloon);
- parameters.put("bios", bios);
- parameters.put("boot", boot);
- parameters.put("bootdisk", bootdisk);
- parameters.put("bwlimit", bwlimit);
- parameters.put("cdrom", cdrom);
- parameters.put("cicustom", cicustom);
- parameters.put("cipassword", cipassword);
- parameters.put("citype", citype);
- parameters.put("ciuser", ciuser);
- parameters.put("cores", cores);
- parameters.put("cpu", cpu);
- parameters.put("cpulimit", cpulimit);
- parameters.put("cpuunits", cpuunits);
- parameters.put("description", description);
- parameters.put("efidisk0", efidisk0);
- parameters.put("force", force);
- parameters.put("freeze", freeze);
- parameters.put("hookscript", hookscript);
- parameters.put("hotplug", hotplug);
- parameters.put("hugepages", hugepages);
- parameters.put("ivshmem", ivshmem);
- parameters.put("keyboard", keyboard);
- parameters.put("kvm", kvm);
- parameters.put("localtime", localtime);
- parameters.put("lock", lock_);
- parameters.put("machine", machine);
- parameters.put("memory", memory);
- parameters.put("migrate_downtime", migrate_downtime);
- parameters.put("migrate_speed", migrate_speed);
- parameters.put("name", name);
- parameters.put("nameserver", nameserver);
- parameters.put("numa", numa);
- parameters.put("onboot", onboot);
- parameters.put("ostype", ostype);
- parameters.put("pool", pool);
- parameters.put("protection", protection);
- parameters.put("reboot", reboot);
- parameters.put("scsihw", scsihw);
- parameters.put("searchdomain", searchdomain);
- parameters.put("shares", shares);
- parameters.put("smbios1", smbios1);
- parameters.put("smp", smp);
- parameters.put("sockets", sockets);
- parameters.put("sshkeys", sshkeys);
- parameters.put("start", start);
- parameters.put("startdate", startdate);
- parameters.put("startup", startup);
- parameters.put("storage", storage);
- parameters.put("tablet", tablet);
- parameters.put("tdf", tdf);
- parameters.put("template", template);
- parameters.put("unique", unique);
- parameters.put("vcpus", vcpus);
- parameters.put("vga", vga);
- parameters.put("vmgenid", vmgenid);
- parameters.put("vmstatestorage", vmstatestorage);
- parameters.put("watchdog", watchdog);
- addIndexedParameter(parameters, "hostpci", hostpciN);
- addIndexedParameter(parameters, "ide", ideN);
- addIndexedParameter(parameters, "ipconfig", ipconfigN);
- addIndexedParameter(parameters, "net", netN);
- addIndexedParameter(parameters, "numa", numaN);
- addIndexedParameter(parameters, "parallel", parallelN);
- addIndexedParameter(parameters, "sata", sataN);
- addIndexedParameter(parameters, "scsi", scsiN);
- addIndexedParameter(parameters, "serial", serialN);
- addIndexedParameter(parameters, "unused", unusedN);
- addIndexedParameter(parameters, "usb", usbN);
- addIndexedParameter(parameters, "virtio", virtioN);
- return _client.create("/nodes/" + _node + "/qemu", parameters);
- }
-
- /**
- * Create or restore a virtual machine.
- *
- * @param vmid The (unique) ID of the VM.
- * @param acpi Enable/disable ACPI.
- * @param agent Enable/disable Qemu GuestAgent and its
- * properties.
- * @param arch Virtual processor architecture. Defaults to the
- * host. Enum: x86_64,aarch64
- * @param archive The backup file.
- * @param args Arbitrary arguments passed to kvm.
- * @param autostart Automatic restart after crash (currently
- * ignored).
- * @param balloon Amount of target RAM for the VM in MB. Using
- * zero disables the ballon driver.
- * @param bios Select BIOS implementation. Enum: seabios,ovmf
- * @param boot Boot on floppy (a), hard disk (c), CD-ROM (d), or
- * network (n).
- * @param bootdisk Enable booting from specified disk.
- * @param bwlimit Override I/O bandwidth limit (in KiB/s).
- * @param cdrom This is an alias for option -ide2
- * @param cicustom cloud-init: Specify custom files to replace
- * the automatically generated ones at start.
- * @param cipassword cloud-init: Password to assign the user.
- * Using this is generally not recommended. Use ssh keys
- * instead. Also note that older cloud-init versions do not
- * support hashed passwords.
- * @param citype Specifies the cloud-init configuration format.
- * The default depends on the configured operating system type
- * (`ostype`. We use the `nocloud` format for Linux, and
- * `configdrive2` for windows. Enum: configdrive2,nocloud
- * @param ciuser cloud-init: User name to change ssh keys and
- * password for instead of the image's configured default user.
- * @param cores The number of cores per socket.
- * @param cpu Emulated CPU type.
- * @param cpulimit Limit of CPU usage.
- * @param cpuunits CPU weight for a VM.
- * @param description Description for the VM. Only used on the
- * configuration web interface. This is saved as comment inside
- * the configuration file.
- * @param efidisk0 Configure a Disk for storing EFI vars
- * @param force Allow to overwrite existing VM.
- * @param freeze Freeze CPU at startup (use 'c' monitor command
- * to start execution).
- * @param hookscript Script that will be executed during various
- * steps in the vms lifetime.
- * @param hostpciN Map host PCI devices into guest.
- * @param hotplug Selectively enable hotplug features. This is a
- * comma separated list of hotplug features: 'network', 'disk',
- * 'cpu', 'memory' and 'usb'. Use '0' to disable hotplug
- * completely. Value '1' is an alias for the default
- * 'network,disk,usb'.
- * @param hugepages Enable/disable hugepages memory. Enum:
- * any,2,1024
- * @param ideN Use volume as IDE hard disk or CD-ROM (n is 0 to
- * 3).
- * @param ipconfigN cloud-init: Specify IP addresses and
- * gateways for the corresponding interface. IP addresses use
- * CIDR notation, gateways are optional but need an IP of the
- * same type specified. The special string 'dhcp' can be used
- * for IP addresses to use DHCP, in which case no explicit
- * gateway should be provided. For IPv6 the special string
- * 'auto' can be used to use stateless autoconfiguration. If
- * cloud-init is enabled and neither an IPv4 nor an IPv6 address
- * is specified, it defaults to using dhcp on IPv4.
- * @param ivshmem Inter-VM shared memory. Useful for direct
- * communication between VMs, or to the host.
- * @param keyboard Keybord layout for vnc server. Default is
- * read from the '/etc/pve/datacenter.cfg' configuration file.It
- * should not be necessary to set it. Enum:
- * de,de-ch,da,en-gb,en-us,es,fi,fr,fr-be,fr-ca,fr-ch,hu,is,it,ja,lt,mk,nl,no,pl,pt,pt-br,sv,sl,tr
- * @param kvm Enable/disable KVM hardware virtualization.
- * @param localtime Set the real time clock to local time. This
- * is enabled by default if ostype indicates a Microsoft OS.
- * @param lock_ Lock/unlock the VM. Enum:
- * backup,clone,create,migrate,rollback,snapshot,snapshot-delete,suspending,suspended
- * @param machine Specifies the Qemu machine type.
- * @param memory Amount of RAM for the VM in MB. This is the
- * maximum available memory when you use the balloon device.
- * @param migrate_downtime Set maximum tolerated downtime (in
- * seconds) for migrations.
- * @param migrate_speed Set maximum speed (in MB/s) for
- * migrations. Value 0 is no limit.
- * @param name Set a name for the VM. Only used on the
- * configuration web interface.
- * @param nameserver cloud-init: Sets DNS server IP address for
- * a container. Create will automatically use the setting from
- * the host if neither searchdomain nor nameserver are set.
- * @param netN Specify network devices.
- * @param numa Enable/disable NUMA.
- * @param numaN NUMA topology.
- * @param onboot Specifies whether a VM will be started during
- * system bootup.
- * @param ostype Specify guest operating system. Enum:
- * other,wxp,w2k,w2k3,w2k8,wvista,win7,win8,win10,l24,l26,solaris
- * @param parallelN Map host parallel devices (n is 0 to 2).
- * @param pool Add the VM to the specified pool.
- * @param protection Sets the protection flag of the VM. This
- * will disable the remove VM and remove disk operations.
- * @param reboot Allow reboot. If set to '0' the VM exit on
- * reboot.
- * @param sataN Use volume as SATA hard disk or CD-ROM (n is 0
- * to 5).
- * @param scsiN Use volume as SCSI hard disk or CD-ROM (n is 0
- * to 13).
- * @param scsihw SCSI controller model Enum:
- * lsi,lsi53c810,virtio-scsi-pci,virtio-scsi-single,megasas,pvscsi
- * @param searchdomain cloud-init: Sets DNS search domains for a
- * container. Create will automatically use the setting from the
- * host if neither searchdomain nor nameserver are set.
- * @param serialN Create a serial device inside the VM (n is 0
- * to 3)
- * @param shares Amount of memory shares for auto-ballooning.
- * The larger the number is, the more memory this VM gets.
- * Number is relative to weights of all other running VMs. Using
- * zero disables auto-ballooning. Auto-ballooning is done by
- * pvestatd.
- * @param smbios1 Specify SMBIOS type 1 fields.
- * @param smp The number of CPUs. Please use option -sockets
- * instead.
- * @param sockets The number of CPU sockets.
- * @param sshkeys cloud-init: Setup public SSH keys (one key per
- * line, OpenSSH format).
- * @param start Start VM after it was created successfully.
- * @param startdate Set the initial date of the real time clock.
- * Valid format for date are: 'now' or '2006-06-17T16:01:21' or
- * '2006-06-17'.
- * @param startup Startup and shutdown behavior. Order is a
- * non-negative number defining the general startup order.
- * Shutdown in done with reverse ordering. Additionally you can
- * set the 'up' or 'down' delay in seconds, which specifies a
- * delay to wait before the next VM is started or stopped.
- * @param storage Default storage.
- * @param tablet Enable/disable the USB tablet device.
- * @param tdf Enable/disable time drift fix.
- * @param template Enable/disable Template.
- * @param unique Assign a unique random ethernet address.
- * @param unusedN Reference to unused volumes. This is used
- * internally, and should not be modified manually.
- * @param usbN Configure an USB device (n is 0 to 4).
- * @param vcpus Number of hotplugged vcpus.
- * @param vga Configure the VGA hardware.
- * @param virtioN Use volume as VIRTIO hard disk (n is 0 to 15).
- * @param vmgenid Set VM Generation ID. Use '1' to autogenerate
- * on create or update, pass '0' to disable explicitly.
- * @param vmstatestorage Default storage for VM state
- * volumes/files.
- * @param watchdog Create a virtual hardware watchdog device.
- * @return Result
- * @throws JSONException
- */
- public Result createVm(int vmid, Boolean acpi, String agent, String arch, String archive, String args, Boolean autostart, Integer balloon, String bios, String boot, String bootdisk, Integer bwlimit, String cdrom, String cicustom, String cipassword, String citype, String ciuser, Integer cores, String cpu, Integer cpulimit, Integer cpuunits, String description, String efidisk0, Boolean force, Boolean freeze, String hookscript, Map hostpciN, String hotplug, String hugepages, Map ideN, Map ipconfigN, String ivshmem, String keyboard, Boolean kvm, Boolean localtime, String lock_, String machine, Integer memory, Integer migrate_downtime, Integer migrate_speed, String name, String nameserver, Map netN, Boolean numa, Map numaN, Boolean onboot, String ostype, Map parallelN, String pool, Boolean protection, Boolean reboot, Map sataN, Map scsiN, String scsihw, String searchdomain, Map serialN, Integer shares, String smbios1, Integer smp, Integer sockets, String sshkeys, Boolean start, String startdate, String startup, String storage, Boolean tablet, Boolean tdf, Boolean template, Boolean unique, Map unusedN, Map usbN, Integer vcpus, String vga, Map virtioN, String vmgenid, String vmstatestorage, String watchdog) throws JSONException {
- return createRest(vmid, acpi, agent, arch, archive, args, autostart, balloon, bios, boot, bootdisk, bwlimit, cdrom, cicustom, cipassword, citype, ciuser, cores, cpu, cpulimit, cpuunits, description, efidisk0, force, freeze, hookscript, hostpciN, hotplug, hugepages, ideN, ipconfigN, ivshmem, keyboard, kvm, localtime, lock_, machine, memory, migrate_downtime, migrate_speed, name, nameserver, netN, numa, numaN, onboot, ostype, parallelN, pool, protection, reboot, sataN, scsiN, scsihw, searchdomain, serialN, shares, smbios1, smp, sockets, sshkeys, start, startdate, startup, storage, tablet, tdf, template, unique, unusedN, usbN, vcpus, vga, virtioN, vmgenid, vmstatestorage, watchdog);
- }
-
- /**
- * Create or restore a virtual machine.
- *
- * @param vmid The (unique) ID of the VM.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(int vmid) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("vmid", vmid);
- return _client.create("/nodes/" + _node + "/qemu", parameters);
- }
-
- /**
- * Create or restore a virtual machine.
- *
- * @param vmid The (unique) ID of the VM.
- * @return Result
- * @throws JSONException
- */
- public Result createVm(int vmid) throws JSONException {
- return createRest(vmid);
- }
-
- }
-
- public class PVELxc {
-
- private final PveClient _client;
- private final Object _node;
-
- protected PVELxc(PveClient client, Object node) {
- _client = client;
- _node = node;
- }
-
- public PVEItemVmid get(Object vmid) {
- return new PVEItemVmid(_client, _node, vmid);
- }
-
- public class PVEItemVmid {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEItemVmid(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- private PVEConfig _config;
-
- public PVEConfig getConfig() {
- if (_config == null) {
- _config = new PVEConfig(_client, _node, _vmid);
- }
-
- return _config;
- }
- private PVEStatus _status;
-
- public PVEStatus getStatus() {
- if (_status == null) {
- _status = new PVEStatus(_client, _node, _vmid);
- }
-
- return _status;
- }
- private PVESnapshot _snapshot;
-
- public PVESnapshot getSnapshot() {
- if (_snapshot == null) {
- _snapshot = new PVESnapshot(_client, _node, _vmid);
- }
-
- return _snapshot;
- }
- private PVEFirewall _firewall;
-
- public PVEFirewall getFirewall() {
- if (_firewall == null) {
- _firewall = new PVEFirewall(_client, _node, _vmid);
- }
-
- return _firewall;
- }
- private PVERrd _rrd;
-
- public PVERrd getRrd() {
- if (_rrd == null) {
- _rrd = new PVERrd(_client, _node, _vmid);
- }
-
- return _rrd;
- }
- private PVERrddata _rrddata;
-
- public PVERrddata getRrddata() {
- if (_rrddata == null) {
- _rrddata = new PVERrddata(_client, _node, _vmid);
- }
-
- return _rrddata;
- }
- private PVEVncproxy _vncproxy;
-
- public PVEVncproxy getVncproxy() {
- if (_vncproxy == null) {
- _vncproxy = new PVEVncproxy(_client, _node, _vmid);
- }
-
- return _vncproxy;
- }
- private PVETermproxy _termproxy;
-
- public PVETermproxy getTermproxy() {
- if (_termproxy == null) {
- _termproxy = new PVETermproxy(_client, _node, _vmid);
- }
-
- return _termproxy;
- }
- private PVEVncwebsocket _vncwebsocket;
-
- public PVEVncwebsocket getVncwebsocket() {
- if (_vncwebsocket == null) {
- _vncwebsocket = new PVEVncwebsocket(_client, _node, _vmid);
- }
-
- return _vncwebsocket;
- }
- private PVESpiceproxy _spiceproxy;
-
- public PVESpiceproxy getSpiceproxy() {
- if (_spiceproxy == null) {
- _spiceproxy = new PVESpiceproxy(_client, _node, _vmid);
- }
-
- return _spiceproxy;
- }
- private PVEMigrate _migrate;
-
- public PVEMigrate getMigrate() {
- if (_migrate == null) {
- _migrate = new PVEMigrate(_client, _node, _vmid);
- }
-
- return _migrate;
- }
- private PVEFeature _feature;
-
- public PVEFeature getFeature() {
- if (_feature == null) {
- _feature = new PVEFeature(_client, _node, _vmid);
- }
-
- return _feature;
- }
- private PVETemplate _template;
-
- public PVETemplate getTemplate() {
- if (_template == null) {
- _template = new PVETemplate(_client, _node, _vmid);
- }
-
- return _template;
- }
- private PVEClone _clone;
-
- public PVEClone getClone() {
- if (_clone == null) {
- _clone = new PVEClone(_client, _node, _vmid);
- }
-
- return _clone;
- }
- private PVEResize _resize;
-
- public PVEResize getResize() {
- if (_resize == null) {
- _resize = new PVEResize(_client, _node, _vmid);
- }
-
- return _resize;
- }
- private PVEMoveVolume _moveVolume;
-
- public PVEMoveVolume getMoveVolume() {
- if (_moveVolume == null) {
- _moveVolume = new PVEMoveVolume(_client, _node, _vmid);
- }
-
- return _moveVolume;
- }
-
- public class PVEConfig {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEConfig(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Get container configuration.
- *
- * @param snapshot Fetch config values from given
- * snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String snapshot) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("snapshot", snapshot);
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/config", parameters);
- }
-
- /**
- * Get container configuration.
- *
- * @param snapshot Fetch config values from given
- * snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result vmConfig(String snapshot) throws JSONException {
- return getRest(snapshot);
- }
-
- /**
- * Get container configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/config", null);
- }
-
- /**
- * Get container configuration.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmConfig() throws JSONException {
- return getRest();
- }
-
- /**
- * Set container options.
- *
- * @param arch OS architecture type. Enum:
- * amd64,i386,arm64,armhf
- * @param cmode Console mode. By default, the console
- * command tries to open a connection to one of the
- * available tty devices. By setting cmode to 'console'
- * it tries to attach to /dev/console instead. If you
- * set cmode to 'shell', it simply invokes a shell
- * inside the container (no login). Enum:
- * shell,console,tty
- * @param console Attach a console device (/dev/console)
- * to the container.
- * @param cores The number of cores assigned to the
- * container. A container can use all available cores by
- * default.
- * @param cpulimit Limit of CPU usage. NOTE: If the
- * computer has 2 CPUs, it has a total of '2' CPU time.
- * Value '0' indicates no CPU limit.
- * @param cpuunits CPU weight for a VM. Argument is used
- * in the kernel fair scheduler. The larger the number
- * is, the more CPU time this VM gets. Number is
- * relative to the weights of all the other running VMs.
- * NOTE: You can disable fair-scheduler configuration by
- * setting this to 0.
- * @param delete A list of settings you want to delete.
- * @param description Container description. Only used
- * on the configuration web interface.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param features Allow containers access to advanced
- * features.
- * @param hookscript Script that will be exectued during
- * various steps in the containers lifetime.
- * @param hostname Set a host name for the container.
- * @param lock_ Lock/unlock the VM. Enum:
- * backup,create,disk,fstrim,migrate,mounted,rollback,snapshot,snapshot-delete
- * @param memory Amount of RAM for the VM in MB.
- * @param mpN Use volume as container mount point.
- * @param nameserver Sets DNS server IP address for a
- * container. Create will automatically use the setting
- * from the host if you neither set searchdomain nor
- * nameserver.
- * @param netN Specifies network interfaces for the
- * container.
- * @param onboot Specifies whether a VM will be started
- * during system bootup.
- * @param ostype OS type. This is used to setup
- * configuration inside the container, and corresponds
- * to lxc setup scripts in
- * /usr/share/lxc/config/<ostype>.common.conf.
- * Value 'unmanaged' can be used to skip and OS specific
- * setup. Enum:
- * debian,ubuntu,centos,fedora,opensuse,archlinux,alpine,gentoo,unmanaged
- * @param protection Sets the protection flag of the
- * container. This will prevent the CT or CT's disk
- * remove/update operation.
- * @param rootfs Use volume as container root.
- * @param searchdomain Sets DNS search domains for a
- * container. Create will automatically use the setting
- * from the host if you neither set searchdomain nor
- * nameserver.
- * @param startup Startup and shutdown behavior. Order
- * is a non-negative number defining the general startup
- * order. Shutdown in done with reverse ordering.
- * Additionally you can set the 'up' or 'down' delay in
- * seconds, which specifies a delay to wait before the
- * next VM is started or stopped.
- * @param swap Amount of SWAP for the VM in MB.
- * @param template Enable/disable Template.
- * @param tty Specify the number of tty available to the
- * container
- * @param unprivileged Makes the container run as
- * unprivileged user. (Should not be modified manually.)
- * @param unusedN Reference to unused volumes. This is
- * used internally, and should not be modified manually.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String arch, String cmode, Boolean console, Integer cores, Integer cpulimit, Integer cpuunits, String delete, String description, String digest, String features, String hookscript, String hostname, String lock_, Integer memory, Map mpN, String nameserver, Map netN, Boolean onboot, String ostype, Boolean protection, String rootfs, String searchdomain, String startup, Integer swap, Boolean template, Integer tty, Boolean unprivileged, Map unusedN) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("arch", arch);
- parameters.put("cmode", cmode);
- parameters.put("console", console);
- parameters.put("cores", cores);
- parameters.put("cpulimit", cpulimit);
- parameters.put("cpuunits", cpuunits);
- parameters.put("delete", delete);
- parameters.put("description", description);
- parameters.put("digest", digest);
- parameters.put("features", features);
- parameters.put("hookscript", hookscript);
- parameters.put("hostname", hostname);
- parameters.put("lock", lock_);
- parameters.put("memory", memory);
- parameters.put("nameserver", nameserver);
- parameters.put("onboot", onboot);
- parameters.put("ostype", ostype);
- parameters.put("protection", protection);
- parameters.put("rootfs", rootfs);
- parameters.put("searchdomain", searchdomain);
- parameters.put("startup", startup);
- parameters.put("swap", swap);
- parameters.put("template", template);
- parameters.put("tty", tty);
- parameters.put("unprivileged", unprivileged);
- addIndexedParameter(parameters, "mp", mpN);
- addIndexedParameter(parameters, "net", netN);
- addIndexedParameter(parameters, "unused", unusedN);
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/config", parameters);
- }
-
- /**
- * Set container options.
- *
- * @param arch OS architecture type. Enum:
- * amd64,i386,arm64,armhf
- * @param cmode Console mode. By default, the console
- * command tries to open a connection to one of the
- * available tty devices. By setting cmode to 'console'
- * it tries to attach to /dev/console instead. If you
- * set cmode to 'shell', it simply invokes a shell
- * inside the container (no login). Enum:
- * shell,console,tty
- * @param console Attach a console device (/dev/console)
- * to the container.
- * @param cores The number of cores assigned to the
- * container. A container can use all available cores by
- * default.
- * @param cpulimit Limit of CPU usage. NOTE: If the
- * computer has 2 CPUs, it has a total of '2' CPU time.
- * Value '0' indicates no CPU limit.
- * @param cpuunits CPU weight for a VM. Argument is used
- * in the kernel fair scheduler. The larger the number
- * is, the more CPU time this VM gets. Number is
- * relative to the weights of all the other running VMs.
- * NOTE: You can disable fair-scheduler configuration by
- * setting this to 0.
- * @param delete A list of settings you want to delete.
- * @param description Container description. Only used
- * on the configuration web interface.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @param features Allow containers access to advanced
- * features.
- * @param hookscript Script that will be exectued during
- * various steps in the containers lifetime.
- * @param hostname Set a host name for the container.
- * @param lock_ Lock/unlock the VM. Enum:
- * backup,create,disk,fstrim,migrate,mounted,rollback,snapshot,snapshot-delete
- * @param memory Amount of RAM for the VM in MB.
- * @param mpN Use volume as container mount point.
- * @param nameserver Sets DNS server IP address for a
- * container. Create will automatically use the setting
- * from the host if you neither set searchdomain nor
- * nameserver.
- * @param netN Specifies network interfaces for the
- * container.
- * @param onboot Specifies whether a VM will be started
- * during system bootup.
- * @param ostype OS type. This is used to setup
- * configuration inside the container, and corresponds
- * to lxc setup scripts in
- * /usr/share/lxc/config/<ostype>.common.conf.
- * Value 'unmanaged' can be used to skip and OS specific
- * setup. Enum:
- * debian,ubuntu,centos,fedora,opensuse,archlinux,alpine,gentoo,unmanaged
- * @param protection Sets the protection flag of the
- * container. This will prevent the CT or CT's disk
- * remove/update operation.
- * @param rootfs Use volume as container root.
- * @param searchdomain Sets DNS search domains for a
- * container. Create will automatically use the setting
- * from the host if you neither set searchdomain nor
- * nameserver.
- * @param startup Startup and shutdown behavior. Order
- * is a non-negative number defining the general startup
- * order. Shutdown in done with reverse ordering.
- * Additionally you can set the 'up' or 'down' delay in
- * seconds, which specifies a delay to wait before the
- * next VM is started or stopped.
- * @param swap Amount of SWAP for the VM in MB.
- * @param template Enable/disable Template.
- * @param tty Specify the number of tty available to the
- * container
- * @param unprivileged Makes the container run as
- * unprivileged user. (Should not be modified manually.)
- * @param unusedN Reference to unused volumes. This is
- * used internally, and should not be modified manually.
- * @return Result
- * @throws JSONException
- */
- public Result updateVm(String arch, String cmode, Boolean console, Integer cores, Integer cpulimit, Integer cpuunits, String delete, String description, String digest, String features, String hookscript, String hostname, String lock_, Integer memory, Map mpN, String nameserver, Map netN, Boolean onboot, String ostype, Boolean protection, String rootfs, String searchdomain, String startup, Integer swap, Boolean template, Integer tty, Boolean unprivileged, Map unusedN) throws JSONException {
- return setRest(arch, cmode, console, cores, cpulimit, cpuunits, delete, description, digest, features, hookscript, hostname, lock_, memory, mpN, nameserver, netN, onboot, ostype, protection, rootfs, searchdomain, startup, swap, template, tty, unprivileged, unusedN);
- }
-
- /**
- * Set container options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/config", null);
- }
-
- /**
- * Set container options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateVm() throws JSONException {
- return setRest();
- }
-
- }
-
- public class PVEStatus {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEStatus(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- private PVECurrent _current;
-
- public PVECurrent getCurrent() {
- if (_current == null) {
- _current = new PVECurrent(_client, _node, _vmid);
- }
-
- return _current;
- }
- private PVEStart _start;
-
- public PVEStart getStart() {
- if (_start == null) {
- _start = new PVEStart(_client, _node, _vmid);
- }
-
- return _start;
- }
- private PVEStop _stop;
-
- public PVEStop getStop() {
- if (_stop == null) {
- _stop = new PVEStop(_client, _node, _vmid);
- }
-
- return _stop;
- }
- private PVEShutdown _shutdown;
-
- public PVEShutdown getShutdown() {
- if (_shutdown == null) {
- _shutdown = new PVEShutdown(_client, _node, _vmid);
- }
-
- return _shutdown;
- }
- private PVESuspend _suspend;
-
- public PVESuspend getSuspend() {
- if (_suspend == null) {
- _suspend = new PVESuspend(_client, _node, _vmid);
- }
-
- return _suspend;
- }
- private PVEResume _resume;
-
- public PVEResume getResume() {
- if (_resume == null) {
- _resume = new PVEResume(_client, _node, _vmid);
- }
-
- return _resume;
- }
-
- public class PVECurrent {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVECurrent(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Get virtual machine status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/status/current", null);
- }
-
- /**
- * Get virtual machine status.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmStatus() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVEStart {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEStart(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Start the container.
- *
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean skiplock) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("skiplock", skiplock);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/status/start", parameters);
- }
-
- /**
- * Start the container.
- *
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result vmStart(Boolean skiplock) throws JSONException {
- return createRest(skiplock);
- }
-
- /**
- * Start the container.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/status/start", null);
- }
-
- /**
- * Start the container.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmStart() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEStop {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEStop(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Stop the container. This will abruptly stop all
- * processes running in the container.
- *
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean skiplock) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("skiplock", skiplock);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/status/stop", parameters);
- }
-
- /**
- * Stop the container. This will abruptly stop all
- * processes running in the container.
- *
- * @param skiplock Ignore locks - only root is
- * allowed to use this option.
- * @return Result
- * @throws JSONException
- */
- public Result vmStop(Boolean skiplock) throws JSONException {
- return createRest(skiplock);
- }
-
- /**
- * Stop the container. This will abruptly stop all
- * processes running in the container.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/status/stop", null);
- }
-
- /**
- * Stop the container. This will abruptly stop all
- * processes running in the container.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmStop() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEShutdown {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEShutdown(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Shutdown the container. This will trigger a clean
- * shutdown of the container, see lxc-stop(1) for
- * details.
- *
- * @param forceStop Make sure the Container stops.
- * @param timeout Wait maximal timeout seconds.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Boolean forceStop, Integer timeout) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("forceStop", forceStop);
- parameters.put("timeout", timeout);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/status/shutdown", parameters);
- }
-
- /**
- * Shutdown the container. This will trigger a clean
- * shutdown of the container, see lxc-stop(1) for
- * details.
- *
- * @param forceStop Make sure the Container stops.
- * @param timeout Wait maximal timeout seconds.
- * @return Result
- * @throws JSONException
- */
- public Result vmShutdown(Boolean forceStop, Integer timeout) throws JSONException {
- return createRest(forceStop, timeout);
- }
-
- /**
- * Shutdown the container. This will trigger a clean
- * shutdown of the container, see lxc-stop(1) for
- * details.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/status/shutdown", null);
- }
-
- /**
- * Shutdown the container. This will trigger a clean
- * shutdown of the container, see lxc-stop(1) for
- * details.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmShutdown() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVESuspend {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESuspend(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Suspend the container.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/status/suspend", null);
- }
-
- /**
- * Suspend the container.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmSuspend() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEResume {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEResume(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Resume the container.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/status/resume", null);
- }
-
- /**
- * Resume the container.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmResume() throws JSONException {
- return createRest();
- }
-
- }
-
- /**
- * Directory index
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/status", null);
- }
-
- /**
- * Directory index
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmcmdidx() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVESnapshot {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESnapshot(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- public PVEItemSnapname get(Object snapname) {
- return new PVEItemSnapname(_client, _node, _vmid, snapname);
- }
-
- public class PVEItemSnapname {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _snapname;
-
- protected PVEItemSnapname(PveClient client, Object node, Object vmid, Object snapname) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _snapname = snapname;
- }
-
- private PVERollback _rollback;
-
- public PVERollback getRollback() {
- if (_rollback == null) {
- _rollback = new PVERollback(_client, _node, _vmid, _snapname);
- }
-
- return _rollback;
- }
- private PVEConfig _config;
-
- public PVEConfig getConfig() {
- if (_config == null) {
- _config = new PVEConfig(_client, _node, _vmid, _snapname);
- }
-
- return _config;
- }
-
- public class PVERollback {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _snapname;
-
- protected PVERollback(PveClient client, Object node, Object vmid, Object snapname) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _snapname = snapname;
- }
-
- /**
- * Rollback LXC state to specified snapshot.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/snapshot/" + _snapname + "/rollback", null);
- }
-
- /**
- * Rollback LXC state to specified snapshot.
- *
- * @return Result
- * @throws JSONException
- */
- public Result rollback() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEConfig {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _snapname;
-
- protected PVEConfig(PveClient client, Object node, Object vmid, Object snapname) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _snapname = snapname;
- }
-
- /**
- * Get snapshot configuration
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/snapshot/" + _snapname + "/config", null);
- }
-
- /**
- * Get snapshot configuration
- *
- * @return Result
- * @throws JSONException
- */
- public Result getSnapshotConfig() throws JSONException {
- return getRest();
- }
-
- /**
- * Update snapshot metadata.
- *
- * @param description A textual description or
- * comment.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String description) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("description", description);
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/snapshot/" + _snapname + "/config", parameters);
- }
-
- /**
- * Update snapshot metadata.
- *
- * @param description A textual description or
- * comment.
- * @return Result
- * @throws JSONException
- */
- public Result updateSnapshotConfig(String description) throws JSONException {
- return setRest(description);
- }
-
- /**
- * Update snapshot metadata.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/snapshot/" + _snapname + "/config", null);
- }
-
- /**
- * Update snapshot metadata.
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateSnapshotConfig() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * Delete a LXC snapshot.
- *
- * @param force For removal from config file, even
- * if removing disk snapshots fails.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(Boolean force) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("force", force);
- return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "/snapshot/" + _snapname + "", parameters);
- }
-
- /**
- * Delete a LXC snapshot.
- *
- * @param force For removal from config file, even
- * if removing disk snapshots fails.
- * @return Result
- * @throws JSONException
- */
- public Result delsnapshot(Boolean force) throws JSONException {
- return deleteRest(force);
- }
-
- /**
- * Delete a LXC snapshot.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "/snapshot/" + _snapname + "", null);
- }
-
- /**
- * Delete a LXC snapshot.
- *
- * @return Result
- * @throws JSONException
- */
- public Result delsnapshot() throws JSONException {
- return deleteRest();
- }
-
- /**
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/snapshot/" + _snapname + "", null);
- }
-
- /**
- *
- * @return Result
- * @throws JSONException
- */
- public Result snapshotCmdIdx() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * List all snapshots.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/snapshot", null);
- }
-
- /**
- * List all snapshots.
- *
- * @return Result
- * @throws JSONException
- */
- public Result list() throws JSONException {
- return getRest();
- }
-
- /**
- * Snapshot a container.
- *
- * @param snapname The name of the snapshot.
- * @param description A textual description or comment.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String snapname, String description) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("snapname", snapname);
- parameters.put("description", description);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/snapshot", parameters);
- }
-
- /**
- * Snapshot a container.
- *
- * @param snapname The name of the snapshot.
- * @param description A textual description or comment.
- * @return Result
- * @throws JSONException
- */
- public Result snapshot(String snapname, String description) throws JSONException {
- return createRest(snapname, description);
- }
-
- /**
- * Snapshot a container.
- *
- * @param snapname The name of the snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String snapname) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("snapname", snapname);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/snapshot", parameters);
- }
-
- /**
- * Snapshot a container.
- *
- * @param snapname The name of the snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result snapshot(String snapname) throws JSONException {
- return createRest(snapname);
- }
-
- }
-
- public class PVEFirewall {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEFirewall(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- private PVERules _rules;
-
- public PVERules getRules() {
- if (_rules == null) {
- _rules = new PVERules(_client, _node, _vmid);
- }
-
- return _rules;
- }
- private PVEAliases _aliases;
-
- public PVEAliases getAliases() {
- if (_aliases == null) {
- _aliases = new PVEAliases(_client, _node, _vmid);
- }
-
- return _aliases;
- }
- private PVEIpset _ipset;
-
- public PVEIpset getIpset() {
- if (_ipset == null) {
- _ipset = new PVEIpset(_client, _node, _vmid);
- }
-
- return _ipset;
- }
- private PVEOptions _options;
-
- public PVEOptions getOptions() {
- if (_options == null) {
- _options = new PVEOptions(_client, _node, _vmid);
- }
-
- return _options;
- }
- private PVELog _log;
-
- public PVELog getLog() {
- if (_log == null) {
- _log = new PVELog(_client, _node, _vmid);
- }
-
- return _log;
- }
- private PVERefs _refs;
-
- public PVERefs getRefs() {
- if (_refs == null) {
- _refs = new PVERefs(_client, _node, _vmid);
- }
-
- return _refs;
- }
-
- public class PVERules {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVERules(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- public PVEItemPos get(Object pos) {
- return new PVEItemPos(_client, _node, _vmid, pos);
- }
-
- public class PVEItemPos {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _pos;
-
- protected PVEItemPos(PveClient client, Object node, Object vmid, Object pos) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _pos = pos;
- }
-
- /**
- * Delete rule.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("digest", digest);
- return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/rules/" + _pos + "", parameters);
- }
-
- /**
- * Delete rule.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRule(String digest) throws JSONException {
- return deleteRest(digest);
- }
-
- /**
- * Delete rule.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/rules/" + _pos + "", null);
- }
-
- /**
- * Delete rule.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRule() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Get single rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/rules/" + _pos + "", null);
- }
-
- /**
- * Get single rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRule() throws JSONException {
- return getRest();
- }
-
- /**
- * Modify rule data.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param comment Descriptive comment.
- * @param delete A list of settings you want to
- * delete.
- * @param dest Restrict packet destination
- * address. This can refer to a single IP
- * address, an IP set ('+ipsetname') or an IP
- * alias definition. You can also specify an
- * address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated
- * by comma). Please do not mix IPv4 and IPv6
- * addresses inside such lists.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param dport Restrict TCP/UDP destination
- * port. You can use service names or simple
- * numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified
- * with '\d+:\d+', for example '80:85', and you
- * can use comma separated list to match several
- * ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have
- * to use network configuration key names for
- * VMs and containers ('net\d+'). Host related
- * rules can use arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param moveto Move rule to new position
- * <moveto>. Other arguments are
- * ignored.
- * @param proto IP protocol. You can use
- * protocol names ('tcp'/'udp') or simple
- * numbers, as defined in '/etc/protocols'.
- * @param source Restrict packet source address.
- * This can refer to a single IP address, an IP
- * set ('+ipsetname') or an IP alias definition.
- * You can also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated
- * by comma). Please do not mix IPv4 and IPv6
- * addresses inside such lists.
- * @param sport Restrict TCP/UDP source port.
- * You can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'.
- * Port ranges can be specified with '\d+:\d+',
- * for example '80:85', and you can use comma
- * separated list to match several ports or
- * ranges.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("comment", comment);
- parameters.put("delete", delete);
- parameters.put("dest", dest);
- parameters.put("digest", digest);
- parameters.put("dport", dport);
- parameters.put("enable", enable);
- parameters.put("iface", iface);
- parameters.put("log", log);
- parameters.put("macro", macro);
- parameters.put("moveto", moveto);
- parameters.put("proto", proto);
- parameters.put("source", source);
- parameters.put("sport", sport);
- parameters.put("type", type);
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/rules/" + _pos + "", parameters);
- }
-
- /**
- * Modify rule data.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param comment Descriptive comment.
- * @param delete A list of settings you want to
- * delete.
- * @param dest Restrict packet destination
- * address. This can refer to a single IP
- * address, an IP set ('+ipsetname') or an IP
- * alias definition. You can also specify an
- * address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated
- * by comma). Please do not mix IPv4 and IPv6
- * addresses inside such lists.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param dport Restrict TCP/UDP destination
- * port. You can use service names or simple
- * numbers (0-65535), as defined in
- * '/etc/services'. Port ranges can be specified
- * with '\d+:\d+', for example '80:85', and you
- * can use comma separated list to match several
- * ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have
- * to use network configuration key names for
- * VMs and containers ('net\d+'). Host related
- * rules can use arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param moveto Move rule to new position
- * <moveto>. Other arguments are
- * ignored.
- * @param proto IP protocol. You can use
- * protocol names ('tcp'/'udp') or simple
- * numbers, as defined in '/etc/protocols'.
- * @param source Restrict packet source address.
- * This can refer to a single IP address, an IP
- * set ('+ipsetname') or an IP alias definition.
- * You can also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated
- * by comma). Please do not mix IPv4 and IPv6
- * addresses inside such lists.
- * @param sport Restrict TCP/UDP source port.
- * You can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'.
- * Port ranges can be specified with '\d+:\d+',
- * for example '80:85', and you can use comma
- * separated list to match several ports or
- * ranges.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result updateRule(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
- return setRest(action, comment, delete, dest, digest, dport, enable, iface, log, macro, moveto, proto, source, sport, type);
- }
-
- /**
- * Modify rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/rules/" + _pos + "", null);
- }
-
- /**
- * Modify rule data.
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateRule() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * List rules.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/rules", null);
- }
-
- /**
- * List rules.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRules() throws JSONException {
- return getRest();
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param type Rule type. Enum: in,out,group
- * @param comment Descriptive comment.
- * @param dest Restrict packet destination address.
- * This can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by
- * comma). Please do not mix IPv4 and IPv6 addresses
- * inside such lists.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param dport Restrict TCP/UDP destination port.
- * You can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'. Port
- * ranges can be specified with '\d+:\d+', for
- * example '80:85', and you can use comma separated
- * list to match several ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to
- * use network configuration key names for VMs and
- * containers ('net\d+'). Host related rules can use
- * arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param pos Update rule at position
- * <pos>.
- * @param proto IP protocol. You can use protocol
- * names ('tcp'/'udp') or simple numbers, as defined
- * in '/etc/protocols'.
- * @param source Restrict packet source address.
- * This can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by
- * comma). Please do not mix IPv4 and IPv6 addresses
- * inside such lists.
- * @param sport Restrict TCP/UDP source port. You
- * can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'. Port
- * ranges can be specified with '\d+:\d+', for
- * example '80:85', and you can use comma separated
- * list to match several ports or ranges.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("type", type);
- parameters.put("comment", comment);
- parameters.put("dest", dest);
- parameters.put("digest", digest);
- parameters.put("dport", dport);
- parameters.put("enable", enable);
- parameters.put("iface", iface);
- parameters.put("log", log);
- parameters.put("macro", macro);
- parameters.put("pos", pos);
- parameters.put("proto", proto);
- parameters.put("source", source);
- parameters.put("sport", sport);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/rules", parameters);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param type Rule type. Enum: in,out,group
- * @param comment Descriptive comment.
- * @param dest Restrict packet destination address.
- * This can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by
- * comma). Please do not mix IPv4 and IPv6 addresses
- * inside such lists.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param dport Restrict TCP/UDP destination port.
- * You can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'. Port
- * ranges can be specified with '\d+:\d+', for
- * example '80:85', and you can use comma separated
- * list to match several ports or ranges.
- * @param enable Flag to enable/disable a rule.
- * @param iface Network interface name. You have to
- * use network configuration key names for VMs and
- * containers ('net\d+'). Host related rules can use
- * arbitrary strings.
- * @param log Log level for firewall rule. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macro Use predefined standard macro.
- * @param pos Update rule at position
- * <pos>.
- * @param proto IP protocol. You can use protocol
- * names ('tcp'/'udp') or simple numbers, as defined
- * in '/etc/protocols'.
- * @param source Restrict packet source address.
- * This can refer to a single IP address, an IP set
- * ('+ipsetname') or an IP alias definition. You can
- * also specify an address range like
- * '20.34.101.207-201.3.9.99', or a list of IP
- * addresses and networks (entries are separated by
- * comma). Please do not mix IPv4 and IPv6 addresses
- * inside such lists.
- * @param sport Restrict TCP/UDP source port. You
- * can use service names or simple numbers
- * (0-65535), as defined in '/etc/services'. Port
- * ranges can be specified with '\d+:\d+', for
- * example '80:85', and you can use comma separated
- * list to match several ports or ranges.
- * @return Result
- * @throws JSONException
- */
- public Result createRule(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String log, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
- return createRest(action, type, comment, dest, digest, dport, enable, iface, log, macro, pos, proto, source, sport);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String action, String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("action", action);
- parameters.put("type", type);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/rules", parameters);
- }
-
- /**
- * Create new rule.
- *
- * @param action Rule action ('ACCEPT', 'DROP',
- * 'REJECT') or security group name.
- * @param type Rule type. Enum: in,out,group
- * @return Result
- * @throws JSONException
- */
- public Result createRule(String action, String type) throws JSONException {
- return createRest(action, type);
- }
-
- }
-
- public class PVEAliases {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEAliases(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- public PVEItemName get(Object name) {
- return new PVEItemName(_client, _node, _vmid, name);
- }
-
- public class PVEItemName {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _name;
-
- protected PVEItemName(PveClient client, Object node, Object vmid, Object name) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _name = name;
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("digest", digest);
- return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/aliases/" + _name + "", parameters);
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @return Result
- * @throws JSONException
- */
- public Result removeAlias(String digest) throws JSONException {
- return deleteRest(digest);
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/aliases/" + _name + "", null);
- }
-
- /**
- * Remove IP or Network alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result removeAlias() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Read alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/aliases/" + _name + "", null);
- }
-
- /**
- * Read alias.
- *
- * @return Result
- * @throws JSONException
- */
- public Result readAlias() throws JSONException {
- return getRest();
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param rename Rename an existing alias.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String cidr, String comment, String digest, String rename) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("comment", comment);
- parameters.put("digest", digest);
- parameters.put("rename", rename);
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/aliases/" + _name + "", parameters);
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param rename Rename an existing alias.
- * @return Result
- * @throws JSONException
- */
- public Result updateAlias(String cidr, String comment, String digest, String rename) throws JSONException {
- return setRest(cidr, comment, digest, rename);
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String cidr) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/aliases/" + _name + "", parameters);
- }
-
- /**
- * Update IP or Network alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @return Result
- * @throws JSONException
- */
- public Result updateAlias(String cidr) throws JSONException {
- return setRest(cidr);
- }
-
- }
-
- /**
- * List aliases
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/aliases", null);
- }
-
- /**
- * List aliases
- *
- * @return Result
- * @throws JSONException
- */
- public Result getAliases() throws JSONException {
- return getRest();
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param name Alias name.
- * @param comment
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr, String name, String comment) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("name", name);
- parameters.put("comment", comment);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/aliases", parameters);
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param name Alias name.
- * @param comment
- * @return Result
- * @throws JSONException
- */
- public Result createAlias(String cidr, String name, String comment) throws JSONException {
- return createRest(cidr, name, comment);
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param name Alias name.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr, String name) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("name", name);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/aliases", parameters);
- }
-
- /**
- * Create IP or Network Alias.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param name Alias name.
- * @return Result
- * @throws JSONException
- */
- public Result createAlias(String cidr, String name) throws JSONException {
- return createRest(cidr, name);
- }
-
- }
-
- public class PVEIpset {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEIpset(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- public PVEItemName get(Object name) {
- return new PVEItemName(_client, _node, _vmid, name);
- }
-
- public class PVEItemName {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _name;
-
- protected PVEItemName(PveClient client, Object node, Object vmid, Object name) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _name = name;
- }
-
- public PVEItemCidr get(Object cidr) {
- return new PVEItemCidr(_client, _node, _vmid, _name, cidr);
- }
-
- public class PVEItemCidr {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
- private final Object _name;
- private final Object _cidr;
-
- protected PVEItemCidr(PveClient client, Object node, Object vmid, Object name, Object cidr) {
- _client = client;
- _node = node;
- _vmid = vmid;
- _name = name;
- _cidr = cidr;
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1
- * digest. This can be used to prevent
- * concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest(String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("digest", digest);
- return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", parameters);
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @param digest Prevent changes if current
- * configuration file has different SHA1
- * digest. This can be used to prevent
- * concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result removeIp(String digest) throws JSONException {
- return deleteRest(digest);
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", null);
- }
-
- /**
- * Remove IP or Network from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result removeIp() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Read IP or Network settings from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", null);
- }
-
- /**
- * Read IP or Network settings from IPSet.
- *
- * @return Result
- * @throws JSONException
- */
- public Result readIp() throws JSONException {
- return getRest();
- }
-
- /**
- * Update IP or Network settings
- *
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1
- * digest. This can be used to prevent
- * concurrent modifications.
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String comment, String digest, Boolean nomatch) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("comment", comment);
- parameters.put("digest", digest);
- parameters.put("nomatch", nomatch);
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", parameters);
- }
-
- /**
- * Update IP or Network settings
- *
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1
- * digest. This can be used to prevent
- * concurrent modifications.
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result updateIp(String comment, String digest, Boolean nomatch) throws JSONException {
- return setRest(comment, digest, nomatch);
- }
-
- /**
- * Update IP or Network settings
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", null);
- }
-
- /**
- * Update IP or Network settings
- *
- * @return Result
- * @throws JSONException
- */
- public Result updateIp() throws JSONException {
- return setRest();
- }
-
- }
-
- /**
- * Delete IPSet
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset/" + _name + "", null);
- }
-
- /**
- * Delete IPSet
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteIpset() throws JSONException {
- return deleteRest();
- }
-
- /**
- * List IPSet content
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset/" + _name + "", null);
- }
-
- /**
- * List IPSet content
- *
- * @return Result
- * @throws JSONException
- */
- public Result getIpset() throws JSONException {
- return getRest();
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param comment
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr, String comment, Boolean nomatch) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- parameters.put("comment", comment);
- parameters.put("nomatch", nomatch);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset/" + _name + "", parameters);
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @param comment
- * @param nomatch
- * @return Result
- * @throws JSONException
- */
- public Result createIp(String cidr, String comment, Boolean nomatch) throws JSONException {
- return createRest(cidr, comment, nomatch);
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String cidr) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("cidr", cidr);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset/" + _name + "", parameters);
- }
-
- /**
- * Add IP or Network to IPSet.
- *
- * @param cidr Network/IP specification in CIDR
- * format.
- * @return Result
- * @throws JSONException
- */
- public Result createIp(String cidr) throws JSONException {
- return createRest(cidr);
- }
-
- }
-
- /**
- * List IPSets
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset", null);
- }
-
- /**
- * List IPSets
- *
- * @return Result
- * @throws JSONException
- */
- public Result ipsetIndex() throws JSONException {
- return getRest();
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param rename Rename an existing IPSet. You can
- * set 'rename' to the same value as 'name' to
- * update the 'comment' of an existing IPSet.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String name, String comment, String digest, String rename) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("name", name);
- parameters.put("comment", comment);
- parameters.put("digest", digest);
- parameters.put("rename", rename);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset", parameters);
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @param comment
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param rename Rename an existing IPSet. You can
- * set 'rename' to the same value as 'name' to
- * update the 'comment' of an existing IPSet.
- * @return Result
- * @throws JSONException
- */
- public Result createIpset(String name, String comment, String digest, String rename) throws JSONException {
- return createRest(name, comment, digest, rename);
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String name) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("name", name);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/ipset", parameters);
- }
-
- /**
- * Create new IPSet
- *
- * @param name IP set name.
- * @return Result
- * @throws JSONException
- */
- public Result createIpset(String name) throws JSONException {
- return createRest(name);
- }
-
- }
-
- public class PVEOptions {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEOptions(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Get VM firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/options", null);
- }
-
- /**
- * Get VM firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getOptions() throws JSONException {
- return getRest();
- }
-
- /**
- * Set Firewall options.
- *
- * @param delete A list of settings you want to
- * delete.
- * @param dhcp Enable DHCP.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param enable Enable/disable firewall rules.
- * @param ipfilter Enable default IP filters. This
- * is equivalent to adding an empty
- * ipfilter-net<id> ipset for every
- * interface. Such ipsets implicitly contain sane
- * default restrictions such as restricting IPv6
- * link local addresses to the one derived from the
- * interface's MAC address. For containers the
- * configured IP addresses will be implicitly added.
- * @param log_level_in Log level for incoming
- * traffic. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param log_level_out Log level for outgoing
- * traffic. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macfilter Enable/disable MAC address
- * filter.
- * @param ndp Enable NDP.
- * @param policy_in Input policy. Enum:
- * ACCEPT,REJECT,DROP
- * @param policy_out Output policy. Enum:
- * ACCEPT,REJECT,DROP
- * @param radv Allow sending Router Advertisement.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String delete, Boolean dhcp, String digest, Boolean enable, Boolean ipfilter, String log_level_in, String log_level_out, Boolean macfilter, Boolean ndp, String policy_in, String policy_out, Boolean radv) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("delete", delete);
- parameters.put("dhcp", dhcp);
- parameters.put("digest", digest);
- parameters.put("enable", enable);
- parameters.put("ipfilter", ipfilter);
- parameters.put("log_level_in", log_level_in);
- parameters.put("log_level_out", log_level_out);
- parameters.put("macfilter", macfilter);
- parameters.put("ndp", ndp);
- parameters.put("policy_in", policy_in);
- parameters.put("policy_out", policy_out);
- parameters.put("radv", radv);
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/options", parameters);
- }
-
- /**
- * Set Firewall options.
- *
- * @param delete A list of settings you want to
- * delete.
- * @param dhcp Enable DHCP.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest.
- * This can be used to prevent concurrent
- * modifications.
- * @param enable Enable/disable firewall rules.
- * @param ipfilter Enable default IP filters. This
- * is equivalent to adding an empty
- * ipfilter-net<id> ipset for every
- * interface. Such ipsets implicitly contain sane
- * default restrictions such as restricting IPv6
- * link local addresses to the one derived from the
- * interface's MAC address. For containers the
- * configured IP addresses will be implicitly added.
- * @param log_level_in Log level for incoming
- * traffic. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param log_level_out Log level for outgoing
- * traffic. Enum:
- * emerg,alert,crit,err,warning,notice,info,debug,nolog
- * @param macfilter Enable/disable MAC address
- * filter.
- * @param ndp Enable NDP.
- * @param policy_in Input policy. Enum:
- * ACCEPT,REJECT,DROP
- * @param policy_out Output policy. Enum:
- * ACCEPT,REJECT,DROP
- * @param radv Allow sending Router Advertisement.
- * @return Result
- * @throws JSONException
- */
- public Result setOptions(String delete, Boolean dhcp, String digest, Boolean enable, Boolean ipfilter, String log_level_in, String log_level_out, Boolean macfilter, Boolean ndp, String policy_in, String policy_out, Boolean radv) throws JSONException {
- return setRest(delete, dhcp, digest, enable, ipfilter, log_level_in, log_level_out, macfilter, ndp, policy_in, policy_out, radv);
- }
-
- /**
- * Set Firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setRest() throws JSONException {
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/options", null);
- }
-
- /**
- * Set Firewall options.
- *
- * @return Result
- * @throws JSONException
- */
- public Result setOptions() throws JSONException {
- return setRest();
- }
-
- }
-
- public class PVELog {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVELog(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Read firewall log
- *
- * @param limit
- * @param start
- * @return Result
- * @throws JSONException
- */
- public Result getRest(Integer limit, Integer start) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("limit", limit);
- parameters.put("start", start);
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/log", parameters);
- }
-
- /**
- * Read firewall log
- *
- * @param limit
- * @param start
- * @return Result
- * @throws JSONException
- */
- public Result log(Integer limit, Integer start) throws JSONException {
- return getRest(limit, start);
- }
-
- /**
- * Read firewall log
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/log", null);
- }
-
- /**
- * Read firewall log
- *
- * @return Result
- * @throws JSONException
- */
- public Result log() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVERefs {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVERefs(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Lists possible IPSet/Alias reference which are
- * allowed in source/dest properties.
- *
- * @param type Only list references of specified
- * type. Enum: alias,ipset
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String type) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("type", type);
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/refs", parameters);
- }
-
- /**
- * Lists possible IPSet/Alias reference which are
- * allowed in source/dest properties.
- *
- * @param type Only list references of specified
- * type. Enum: alias,ipset
- * @return Result
- * @throws JSONException
- */
- public Result refs(String type) throws JSONException {
- return getRest(type);
- }
-
- /**
- * Lists possible IPSet/Alias reference which are
- * allowed in source/dest properties.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall/refs", null);
- }
-
- /**
- * Lists possible IPSet/Alias reference which are
- * allowed in source/dest properties.
- *
- * @return Result
- * @throws JSONException
- */
- public Result refs() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/firewall", null);
- }
-
- /**
- * Directory index.
- *
- * @return Result
- * @throws JSONException
- */
- public Result index() throws JSONException {
- return getRest();
- }
-
- }
-
- public class PVERrd {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVERrd(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Read VM RRD statistics (returns PNG)
- *
- * @param ds The list of datasources you want to
- * display.
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @param cf The RRD consolidation function Enum:
- * AVERAGE,MAX
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String ds, String timeframe, String cf) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("ds", ds);
- parameters.put("timeframe", timeframe);
- parameters.put("cf", cf);
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/rrd", parameters);
- }
-
- /**
- * Read VM RRD statistics (returns PNG)
- *
- * @param ds The list of datasources you want to
- * display.
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @param cf The RRD consolidation function Enum:
- * AVERAGE,MAX
- * @return Result
- * @throws JSONException
- */
- public Result rrd(String ds, String timeframe, String cf) throws JSONException {
- return getRest(ds, timeframe, cf);
- }
-
- /**
- * Read VM RRD statistics (returns PNG)
- *
- * @param ds The list of datasources you want to
- * display.
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String ds, String timeframe) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("ds", ds);
- parameters.put("timeframe", timeframe);
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/rrd", parameters);
- }
-
- /**
- * Read VM RRD statistics (returns PNG)
- *
- * @param ds The list of datasources you want to
- * display.
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @return Result
- * @throws JSONException
- */
- public Result rrd(String ds, String timeframe) throws JSONException {
- return getRest(ds, timeframe);
- }
-
- }
-
- public class PVERrddata {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVERrddata(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Read VM RRD statistics
- *
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @param cf The RRD consolidation function Enum:
- * AVERAGE,MAX
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String timeframe, String cf) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("timeframe", timeframe);
- parameters.put("cf", cf);
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/rrddata", parameters);
- }
-
- /**
- * Read VM RRD statistics
- *
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @param cf The RRD consolidation function Enum:
- * AVERAGE,MAX
- * @return Result
- * @throws JSONException
- */
- public Result rrddata(String timeframe, String cf) throws JSONException {
- return getRest(timeframe, cf);
- }
-
- /**
- * Read VM RRD statistics
- *
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String timeframe) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("timeframe", timeframe);
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/rrddata", parameters);
- }
-
- /**
- * Read VM RRD statistics
- *
- * @param timeframe Specify the time frame you are
- * interested in. Enum: hour,day,week,month,year
- * @return Result
- * @throws JSONException
- */
- public Result rrddata(String timeframe) throws JSONException {
- return getRest(timeframe);
- }
-
- }
-
- public class PVEVncproxy {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEVncproxy(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Creates a TCP VNC proxy connections.
- *
- * @param height sets the height of the console in
- * pixels.
- * @param websocket use websocket instead of standard
- * VNC.
- * @param width sets the width of the console in pixels.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(Integer height, Boolean websocket, Integer width) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("height", height);
- parameters.put("websocket", websocket);
- parameters.put("width", width);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/vncproxy", parameters);
- }
-
- /**
- * Creates a TCP VNC proxy connections.
- *
- * @param height sets the height of the console in
- * pixels.
- * @param websocket use websocket instead of standard
- * VNC.
- * @param width sets the width of the console in pixels.
- * @return Result
- * @throws JSONException
- */
- public Result vncproxy(Integer height, Boolean websocket, Integer width) throws JSONException {
- return createRest(height, websocket, width);
- }
-
- /**
- * Creates a TCP VNC proxy connections.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/vncproxy", null);
- }
-
- /**
- * Creates a TCP VNC proxy connections.
- *
- * @return Result
- * @throws JSONException
- */
- public Result vncproxy() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVETermproxy {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVETermproxy(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Creates a TCP proxy connection.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/termproxy", null);
- }
-
- /**
- * Creates a TCP proxy connection.
- *
- * @return Result
- * @throws JSONException
- */
- public Result termproxy() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEVncwebsocket {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEVncwebsocket(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Opens a weksocket for VNC traffic.
- *
- * @param port Port number returned by previous vncproxy
- * call.
- * @param vncticket Ticket from previous call to
- * vncproxy.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(int port, String vncticket) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("port", port);
- parameters.put("vncticket", vncticket);
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/vncwebsocket", parameters);
- }
-
- /**
- * Opens a weksocket for VNC traffic.
- *
- * @param port Port number returned by previous vncproxy
- * call.
- * @param vncticket Ticket from previous call to
- * vncproxy.
- * @return Result
- * @throws JSONException
- */
- public Result vncwebsocket(int port, String vncticket) throws JSONException {
- return getRest(port, vncticket);
- }
-
- }
-
- public class PVESpiceproxy {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVESpiceproxy(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Returns a SPICE configuration to connect to the CT.
- *
- * @param proxy SPICE proxy server. This can be used by
- * the client to specify the proxy server. All nodes in
- * a cluster runs 'spiceproxy', so it is up to the
- * client to choose one. By default, we return the node
- * where the VM is currently running. As reasonable
- * setting is to use same node you use to connect to the
- * API (This is window.location.hostname for the JS
- * GUI).
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String proxy) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("proxy", proxy);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/spiceproxy", parameters);
- }
-
- /**
- * Returns a SPICE configuration to connect to the CT.
- *
- * @param proxy SPICE proxy server. This can be used by
- * the client to specify the proxy server. All nodes in
- * a cluster runs 'spiceproxy', so it is up to the
- * client to choose one. By default, we return the node
- * where the VM is currently running. As reasonable
- * setting is to use same node you use to connect to the
- * API (This is window.location.hostname for the JS
- * GUI).
- * @return Result
- * @throws JSONException
- */
- public Result spiceproxy(String proxy) throws JSONException {
- return createRest(proxy);
- }
-
- /**
- * Returns a SPICE configuration to connect to the CT.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/spiceproxy", null);
- }
-
- /**
- * Returns a SPICE configuration to connect to the CT.
- *
- * @return Result
- * @throws JSONException
- */
- public Result spiceproxy() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEMigrate {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEMigrate(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Migrate the container to another node. Creates a new
- * migration task.
- *
- * @param target Target node.
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param force Force migration despite local bind /
- * device mounts. NOTE: deprecated, use 'shared'
- * property of mount point instead.
- * @param online Use online/live migration.
- * @param restart Use restart migration
- * @param timeout Timeout in seconds for shutdown for
- * restart migration
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String target, Integer bwlimit, Boolean force, Boolean online, Boolean restart, Integer timeout) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("target", target);
- parameters.put("bwlimit", bwlimit);
- parameters.put("force", force);
- parameters.put("online", online);
- parameters.put("restart", restart);
- parameters.put("timeout", timeout);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/migrate", parameters);
- }
-
- /**
- * Migrate the container to another node. Creates a new
- * migration task.
- *
- * @param target Target node.
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param force Force migration despite local bind /
- * device mounts. NOTE: deprecated, use 'shared'
- * property of mount point instead.
- * @param online Use online/live migration.
- * @param restart Use restart migration
- * @param timeout Timeout in seconds for shutdown for
- * restart migration
- * @return Result
- * @throws JSONException
- */
- public Result migrateVm(String target, Integer bwlimit, Boolean force, Boolean online, Boolean restart, Integer timeout) throws JSONException {
- return createRest(target, bwlimit, force, online, restart, timeout);
- }
-
- /**
- * Migrate the container to another node. Creates a new
- * migration task.
- *
- * @param target Target node.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String target) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("target", target);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/migrate", parameters);
- }
-
- /**
- * Migrate the container to another node. Creates a new
- * migration task.
- *
- * @param target Target node.
- * @return Result
- * @throws JSONException
- */
- public Result migrateVm(String target) throws JSONException {
- return createRest(target);
- }
-
- }
-
- public class PVEFeature {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEFeature(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Check if feature for virtual machine is available.
- *
- * @param feature Feature to check. Enum:
- * snapshot,clone,copy
- * @param snapname The name of the snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String feature, String snapname) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("feature", feature);
- parameters.put("snapname", snapname);
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/feature", parameters);
- }
-
- /**
- * Check if feature for virtual machine is available.
- *
- * @param feature Feature to check. Enum:
- * snapshot,clone,copy
- * @param snapname The name of the snapshot.
- * @return Result
- * @throws JSONException
- */
- public Result vmFeature(String feature, String snapname) throws JSONException {
- return getRest(feature, snapname);
- }
-
- /**
- * Check if feature for virtual machine is available.
- *
- * @param feature Feature to check. Enum:
- * snapshot,clone,copy
- * @return Result
- * @throws JSONException
- */
- public Result getRest(String feature) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("feature", feature);
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/feature", parameters);
- }
-
- /**
- * Check if feature for virtual machine is available.
- *
- * @param feature Feature to check. Enum:
- * snapshot,clone,copy
- * @return Result
- * @throws JSONException
- */
- public Result vmFeature(String feature) throws JSONException {
- return getRest(feature);
- }
-
- }
-
- public class PVETemplate {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVETemplate(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Create a Template.
- *
- * @return Result
- * @throws JSONException
- */
- public Result createRest() throws JSONException {
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/template", null);
- }
-
- /**
- * Create a Template.
- *
- * @return Result
- * @throws JSONException
- */
- public Result template() throws JSONException {
- return createRest();
- }
-
- }
-
- public class PVEClone {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEClone(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Create a container clone/copy
- *
- * @param newid VMID for the clone.
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param description Description for the new CT.
- * @param full Create a full copy of all disks. This is
- * always done when you clone a normal CT. For CT
- * templates, we try to create a linked clone by
- * default.
- * @param hostname Set a hostname for the new CT.
- * @param pool Add the new CT to the specified pool.
- * @param snapname The name of the snapshot.
- * @param storage Target storage for full clone.
- * @param target Target node. Only allowed if the
- * original VM is on shared storage.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(int newid, Integer bwlimit, String description, Boolean full, String hostname, String pool, String snapname, String storage, String target) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("newid", newid);
- parameters.put("bwlimit", bwlimit);
- parameters.put("description", description);
- parameters.put("full", full);
- parameters.put("hostname", hostname);
- parameters.put("pool", pool);
- parameters.put("snapname", snapname);
- parameters.put("storage", storage);
- parameters.put("target", target);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/clone", parameters);
- }
-
- /**
- * Create a container clone/copy
- *
- * @param newid VMID for the clone.
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param description Description for the new CT.
- * @param full Create a full copy of all disks. This is
- * always done when you clone a normal CT. For CT
- * templates, we try to create a linked clone by
- * default.
- * @param hostname Set a hostname for the new CT.
- * @param pool Add the new CT to the specified pool.
- * @param snapname The name of the snapshot.
- * @param storage Target storage for full clone.
- * @param target Target node. Only allowed if the
- * original VM is on shared storage.
- * @return Result
- * @throws JSONException
- */
- public Result cloneVm(int newid, Integer bwlimit, String description, Boolean full, String hostname, String pool, String snapname, String storage, String target) throws JSONException {
- return createRest(newid, bwlimit, description, full, hostname, pool, snapname, storage, target);
- }
-
- /**
- * Create a container clone/copy
- *
- * @param newid VMID for the clone.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(int newid) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("newid", newid);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/clone", parameters);
- }
-
- /**
- * Create a container clone/copy
- *
- * @param newid VMID for the clone.
- * @return Result
- * @throws JSONException
- */
- public Result cloneVm(int newid) throws JSONException {
- return createRest(newid);
- }
-
- }
-
- public class PVEResize {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEResize(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Resize a container mount point.
- *
- * @param disk The disk you want to resize. Enum:
- * rootfs,mp0,mp1,mp2,mp3,mp4,mp5,mp6,mp7,mp8,mp9,mp10,mp11,mp12,mp13,mp14,mp15,mp16,mp17,mp18,mp19,mp20,mp21,mp22,mp23,mp24,mp25,mp26,mp27,mp28,mp29,mp30,mp31,mp32,mp33,mp34,mp35,mp36,mp37,mp38,mp39,mp40,mp41,mp42,mp43,mp44,mp45,mp46,mp47,mp48,mp49,mp50,mp51,mp52,mp53,mp54,mp55,mp56,mp57,mp58,mp59,mp60,mp61,mp62,mp63,mp64,mp65,mp66,mp67,mp68,mp69,mp70,mp71,mp72,mp73,mp74,mp75,mp76,mp77,mp78,mp79,mp80,mp81,mp82,mp83,mp84,mp85,mp86,mp87,mp88,mp89,mp90,mp91,mp92,mp93,mp94,mp95,mp96,mp97,mp98,mp99,mp100,mp101,mp102,mp103,mp104,mp105,mp106,mp107,mp108,mp109,mp110,mp111,mp112,mp113,mp114,mp115,mp116,mp117,mp118,mp119,mp120,mp121,mp122,mp123,mp124,mp125,mp126,mp127,mp128,mp129,mp130,mp131,mp132,mp133,mp134,mp135,mp136,mp137,mp138,mp139,mp140,mp141,mp142,mp143,mp144,mp145,mp146,mp147,mp148,mp149,mp150,mp151,mp152,mp153,mp154,mp155,mp156,mp157,mp158,mp159,mp160,mp161,mp162,mp163,mp164,mp165,mp166,mp167,mp168,mp169,mp170,mp171,mp172,mp173,mp174,mp175,mp176,mp177,mp178,mp179,mp180,mp181,mp182,mp183,mp184,mp185,mp186,mp187,mp188,mp189,mp190,mp191,mp192,mp193,mp194,mp195,mp196,mp197,mp198,mp199,mp200,mp201,mp202,mp203,mp204,mp205,mp206,mp207,mp208,mp209,mp210,mp211,mp212,mp213,mp214,mp215,mp216,mp217,mp218,mp219,mp220,mp221,mp222,mp223,mp224,mp225,mp226,mp227,mp228,mp229,mp230,mp231,mp232,mp233,mp234,mp235,mp236,mp237,mp238,mp239,mp240,mp241,mp242,mp243,mp244,mp245,mp246,mp247,mp248,mp249,mp250,mp251,mp252,mp253,mp254,mp255
- * @param size The new size. With the '+' sign the value
- * is added to the actual size of the volume and without
- * it, the value is taken as an absolute one. Shrinking
- * disk size is not supported.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String disk, String size, String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("disk", disk);
- parameters.put("size", size);
- parameters.put("digest", digest);
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/resize", parameters);
- }
-
- /**
- * Resize a container mount point.
- *
- * @param disk The disk you want to resize. Enum:
- * rootfs,mp0,mp1,mp2,mp3,mp4,mp5,mp6,mp7,mp8,mp9,mp10,mp11,mp12,mp13,mp14,mp15,mp16,mp17,mp18,mp19,mp20,mp21,mp22,mp23,mp24,mp25,mp26,mp27,mp28,mp29,mp30,mp31,mp32,mp33,mp34,mp35,mp36,mp37,mp38,mp39,mp40,mp41,mp42,mp43,mp44,mp45,mp46,mp47,mp48,mp49,mp50,mp51,mp52,mp53,mp54,mp55,mp56,mp57,mp58,mp59,mp60,mp61,mp62,mp63,mp64,mp65,mp66,mp67,mp68,mp69,mp70,mp71,mp72,mp73,mp74,mp75,mp76,mp77,mp78,mp79,mp80,mp81,mp82,mp83,mp84,mp85,mp86,mp87,mp88,mp89,mp90,mp91,mp92,mp93,mp94,mp95,mp96,mp97,mp98,mp99,mp100,mp101,mp102,mp103,mp104,mp105,mp106,mp107,mp108,mp109,mp110,mp111,mp112,mp113,mp114,mp115,mp116,mp117,mp118,mp119,mp120,mp121,mp122,mp123,mp124,mp125,mp126,mp127,mp128,mp129,mp130,mp131,mp132,mp133,mp134,mp135,mp136,mp137,mp138,mp139,mp140,mp141,mp142,mp143,mp144,mp145,mp146,mp147,mp148,mp149,mp150,mp151,mp152,mp153,mp154,mp155,mp156,mp157,mp158,mp159,mp160,mp161,mp162,mp163,mp164,mp165,mp166,mp167,mp168,mp169,mp170,mp171,mp172,mp173,mp174,mp175,mp176,mp177,mp178,mp179,mp180,mp181,mp182,mp183,mp184,mp185,mp186,mp187,mp188,mp189,mp190,mp191,mp192,mp193,mp194,mp195,mp196,mp197,mp198,mp199,mp200,mp201,mp202,mp203,mp204,mp205,mp206,mp207,mp208,mp209,mp210,mp211,mp212,mp213,mp214,mp215,mp216,mp217,mp218,mp219,mp220,mp221,mp222,mp223,mp224,mp225,mp226,mp227,mp228,mp229,mp230,mp231,mp232,mp233,mp234,mp235,mp236,mp237,mp238,mp239,mp240,mp241,mp242,mp243,mp244,mp245,mp246,mp247,mp248,mp249,mp250,mp251,mp252,mp253,mp254,mp255
- * @param size The new size. With the '+' sign the value
- * is added to the actual size of the volume and without
- * it, the value is taken as an absolute one. Shrinking
- * disk size is not supported.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result resizeVm(String disk, String size, String digest) throws JSONException {
- return setRest(disk, size, digest);
- }
-
- /**
- * Resize a container mount point.
- *
- * @param disk The disk you want to resize. Enum:
- * rootfs,mp0,mp1,mp2,mp3,mp4,mp5,mp6,mp7,mp8,mp9,mp10,mp11,mp12,mp13,mp14,mp15,mp16,mp17,mp18,mp19,mp20,mp21,mp22,mp23,mp24,mp25,mp26,mp27,mp28,mp29,mp30,mp31,mp32,mp33,mp34,mp35,mp36,mp37,mp38,mp39,mp40,mp41,mp42,mp43,mp44,mp45,mp46,mp47,mp48,mp49,mp50,mp51,mp52,mp53,mp54,mp55,mp56,mp57,mp58,mp59,mp60,mp61,mp62,mp63,mp64,mp65,mp66,mp67,mp68,mp69,mp70,mp71,mp72,mp73,mp74,mp75,mp76,mp77,mp78,mp79,mp80,mp81,mp82,mp83,mp84,mp85,mp86,mp87,mp88,mp89,mp90,mp91,mp92,mp93,mp94,mp95,mp96,mp97,mp98,mp99,mp100,mp101,mp102,mp103,mp104,mp105,mp106,mp107,mp108,mp109,mp110,mp111,mp112,mp113,mp114,mp115,mp116,mp117,mp118,mp119,mp120,mp121,mp122,mp123,mp124,mp125,mp126,mp127,mp128,mp129,mp130,mp131,mp132,mp133,mp134,mp135,mp136,mp137,mp138,mp139,mp140,mp141,mp142,mp143,mp144,mp145,mp146,mp147,mp148,mp149,mp150,mp151,mp152,mp153,mp154,mp155,mp156,mp157,mp158,mp159,mp160,mp161,mp162,mp163,mp164,mp165,mp166,mp167,mp168,mp169,mp170,mp171,mp172,mp173,mp174,mp175,mp176,mp177,mp178,mp179,mp180,mp181,mp182,mp183,mp184,mp185,mp186,mp187,mp188,mp189,mp190,mp191,mp192,mp193,mp194,mp195,mp196,mp197,mp198,mp199,mp200,mp201,mp202,mp203,mp204,mp205,mp206,mp207,mp208,mp209,mp210,mp211,mp212,mp213,mp214,mp215,mp216,mp217,mp218,mp219,mp220,mp221,mp222,mp223,mp224,mp225,mp226,mp227,mp228,mp229,mp230,mp231,mp232,mp233,mp234,mp235,mp236,mp237,mp238,mp239,mp240,mp241,mp242,mp243,mp244,mp245,mp246,mp247,mp248,mp249,mp250,mp251,mp252,mp253,mp254,mp255
- * @param size The new size. With the '+' sign the value
- * is added to the actual size of the volume and without
- * it, the value is taken as an absolute one. Shrinking
- * disk size is not supported.
- * @return Result
- * @throws JSONException
- */
- public Result setRest(String disk, String size) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("disk", disk);
- parameters.put("size", size);
- return _client.set("/nodes/" + _node + "/lxc/" + _vmid + "/resize", parameters);
- }
-
- /**
- * Resize a container mount point.
- *
- * @param disk The disk you want to resize. Enum:
- * rootfs,mp0,mp1,mp2,mp3,mp4,mp5,mp6,mp7,mp8,mp9,mp10,mp11,mp12,mp13,mp14,mp15,mp16,mp17,mp18,mp19,mp20,mp21,mp22,mp23,mp24,mp25,mp26,mp27,mp28,mp29,mp30,mp31,mp32,mp33,mp34,mp35,mp36,mp37,mp38,mp39,mp40,mp41,mp42,mp43,mp44,mp45,mp46,mp47,mp48,mp49,mp50,mp51,mp52,mp53,mp54,mp55,mp56,mp57,mp58,mp59,mp60,mp61,mp62,mp63,mp64,mp65,mp66,mp67,mp68,mp69,mp70,mp71,mp72,mp73,mp74,mp75,mp76,mp77,mp78,mp79,mp80,mp81,mp82,mp83,mp84,mp85,mp86,mp87,mp88,mp89,mp90,mp91,mp92,mp93,mp94,mp95,mp96,mp97,mp98,mp99,mp100,mp101,mp102,mp103,mp104,mp105,mp106,mp107,mp108,mp109,mp110,mp111,mp112,mp113,mp114,mp115,mp116,mp117,mp118,mp119,mp120,mp121,mp122,mp123,mp124,mp125,mp126,mp127,mp128,mp129,mp130,mp131,mp132,mp133,mp134,mp135,mp136,mp137,mp138,mp139,mp140,mp141,mp142,mp143,mp144,mp145,mp146,mp147,mp148,mp149,mp150,mp151,mp152,mp153,mp154,mp155,mp156,mp157,mp158,mp159,mp160,mp161,mp162,mp163,mp164,mp165,mp166,mp167,mp168,mp169,mp170,mp171,mp172,mp173,mp174,mp175,mp176,mp177,mp178,mp179,mp180,mp181,mp182,mp183,mp184,mp185,mp186,mp187,mp188,mp189,mp190,mp191,mp192,mp193,mp194,mp195,mp196,mp197,mp198,mp199,mp200,mp201,mp202,mp203,mp204,mp205,mp206,mp207,mp208,mp209,mp210,mp211,mp212,mp213,mp214,mp215,mp216,mp217,mp218,mp219,mp220,mp221,mp222,mp223,mp224,mp225,mp226,mp227,mp228,mp229,mp230,mp231,mp232,mp233,mp234,mp235,mp236,mp237,mp238,mp239,mp240,mp241,mp242,mp243,mp244,mp245,mp246,mp247,mp248,mp249,mp250,mp251,mp252,mp253,mp254,mp255
- * @param size The new size. With the '+' sign the value
- * is added to the actual size of the volume and without
- * it, the value is taken as an absolute one. Shrinking
- * disk size is not supported.
- * @return Result
- * @throws JSONException
- */
- public Result resizeVm(String disk, String size) throws JSONException {
- return setRest(disk, size);
- }
-
- }
-
- public class PVEMoveVolume {
-
- private final PveClient _client;
- private final Object _node;
- private final Object _vmid;
-
- protected PVEMoveVolume(PveClient client, Object node, Object vmid) {
- _client = client;
- _node = node;
- _vmid = vmid;
- }
-
- /**
- * Move a rootfs-/mp-volume to a different storage
- *
- * @param storage Target Storage.
- * @param volume Volume which will be moved. Enum:
- * rootfs,mp0,mp1,mp2,mp3,mp4,mp5,mp6,mp7,mp8,mp9,mp10,mp11,mp12,mp13,mp14,mp15,mp16,mp17,mp18,mp19,mp20,mp21,mp22,mp23,mp24,mp25,mp26,mp27,mp28,mp29,mp30,mp31,mp32,mp33,mp34,mp35,mp36,mp37,mp38,mp39,mp40,mp41,mp42,mp43,mp44,mp45,mp46,mp47,mp48,mp49,mp50,mp51,mp52,mp53,mp54,mp55,mp56,mp57,mp58,mp59,mp60,mp61,mp62,mp63,mp64,mp65,mp66,mp67,mp68,mp69,mp70,mp71,mp72,mp73,mp74,mp75,mp76,mp77,mp78,mp79,mp80,mp81,mp82,mp83,mp84,mp85,mp86,mp87,mp88,mp89,mp90,mp91,mp92,mp93,mp94,mp95,mp96,mp97,mp98,mp99,mp100,mp101,mp102,mp103,mp104,mp105,mp106,mp107,mp108,mp109,mp110,mp111,mp112,mp113,mp114,mp115,mp116,mp117,mp118,mp119,mp120,mp121,mp122,mp123,mp124,mp125,mp126,mp127,mp128,mp129,mp130,mp131,mp132,mp133,mp134,mp135,mp136,mp137,mp138,mp139,mp140,mp141,mp142,mp143,mp144,mp145,mp146,mp147,mp148,mp149,mp150,mp151,mp152,mp153,mp154,mp155,mp156,mp157,mp158,mp159,mp160,mp161,mp162,mp163,mp164,mp165,mp166,mp167,mp168,mp169,mp170,mp171,mp172,mp173,mp174,mp175,mp176,mp177,mp178,mp179,mp180,mp181,mp182,mp183,mp184,mp185,mp186,mp187,mp188,mp189,mp190,mp191,mp192,mp193,mp194,mp195,mp196,mp197,mp198,mp199,mp200,mp201,mp202,mp203,mp204,mp205,mp206,mp207,mp208,mp209,mp210,mp211,mp212,mp213,mp214,mp215,mp216,mp217,mp218,mp219,mp220,mp221,mp222,mp223,mp224,mp225,mp226,mp227,mp228,mp229,mp230,mp231,mp232,mp233,mp234,mp235,mp236,mp237,mp238,mp239,mp240,mp241,mp242,mp243,mp244,mp245,mp246,mp247,mp248,mp249,mp250,mp251,mp252,mp253,mp254,mp255
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param delete Delete the original volume after
- * successful copy. By default the original is kept as
- * an unused volume entry.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String storage, String volume, Integer bwlimit, Boolean delete, String digest) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("storage", storage);
- parameters.put("volume", volume);
- parameters.put("bwlimit", bwlimit);
- parameters.put("delete", delete);
- parameters.put("digest", digest);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/move_volume", parameters);
- }
-
- /**
- * Move a rootfs-/mp-volume to a different storage
- *
- * @param storage Target Storage.
- * @param volume Volume which will be moved. Enum:
- * rootfs,mp0,mp1,mp2,mp3,mp4,mp5,mp6,mp7,mp8,mp9,mp10,mp11,mp12,mp13,mp14,mp15,mp16,mp17,mp18,mp19,mp20,mp21,mp22,mp23,mp24,mp25,mp26,mp27,mp28,mp29,mp30,mp31,mp32,mp33,mp34,mp35,mp36,mp37,mp38,mp39,mp40,mp41,mp42,mp43,mp44,mp45,mp46,mp47,mp48,mp49,mp50,mp51,mp52,mp53,mp54,mp55,mp56,mp57,mp58,mp59,mp60,mp61,mp62,mp63,mp64,mp65,mp66,mp67,mp68,mp69,mp70,mp71,mp72,mp73,mp74,mp75,mp76,mp77,mp78,mp79,mp80,mp81,mp82,mp83,mp84,mp85,mp86,mp87,mp88,mp89,mp90,mp91,mp92,mp93,mp94,mp95,mp96,mp97,mp98,mp99,mp100,mp101,mp102,mp103,mp104,mp105,mp106,mp107,mp108,mp109,mp110,mp111,mp112,mp113,mp114,mp115,mp116,mp117,mp118,mp119,mp120,mp121,mp122,mp123,mp124,mp125,mp126,mp127,mp128,mp129,mp130,mp131,mp132,mp133,mp134,mp135,mp136,mp137,mp138,mp139,mp140,mp141,mp142,mp143,mp144,mp145,mp146,mp147,mp148,mp149,mp150,mp151,mp152,mp153,mp154,mp155,mp156,mp157,mp158,mp159,mp160,mp161,mp162,mp163,mp164,mp165,mp166,mp167,mp168,mp169,mp170,mp171,mp172,mp173,mp174,mp175,mp176,mp177,mp178,mp179,mp180,mp181,mp182,mp183,mp184,mp185,mp186,mp187,mp188,mp189,mp190,mp191,mp192,mp193,mp194,mp195,mp196,mp197,mp198,mp199,mp200,mp201,mp202,mp203,mp204,mp205,mp206,mp207,mp208,mp209,mp210,mp211,mp212,mp213,mp214,mp215,mp216,mp217,mp218,mp219,mp220,mp221,mp222,mp223,mp224,mp225,mp226,mp227,mp228,mp229,mp230,mp231,mp232,mp233,mp234,mp235,mp236,mp237,mp238,mp239,mp240,mp241,mp242,mp243,mp244,mp245,mp246,mp247,mp248,mp249,mp250,mp251,mp252,mp253,mp254,mp255
- * @param bwlimit Override I/O bandwidth limit (in
- * KiB/s).
- * @param delete Delete the original volume after
- * successful copy. By default the original is kept as
- * an unused volume entry.
- * @param digest Prevent changes if current
- * configuration file has different SHA1 digest. This
- * can be used to prevent concurrent modifications.
- * @return Result
- * @throws JSONException
- */
- public Result moveVolume(String storage, String volume, Integer bwlimit, Boolean delete, String digest) throws JSONException {
- return createRest(storage, volume, bwlimit, delete, digest);
- }
-
- /**
- * Move a rootfs-/mp-volume to a different storage
- *
- * @param storage Target Storage.
- * @param volume Volume which will be moved. Enum:
- * rootfs,mp0,mp1,mp2,mp3,mp4,mp5,mp6,mp7,mp8,mp9,mp10,mp11,mp12,mp13,mp14,mp15,mp16,mp17,mp18,mp19,mp20,mp21,mp22,mp23,mp24,mp25,mp26,mp27,mp28,mp29,mp30,mp31,mp32,mp33,mp34,mp35,mp36,mp37,mp38,mp39,mp40,mp41,mp42,mp43,mp44,mp45,mp46,mp47,mp48,mp49,mp50,mp51,mp52,mp53,mp54,mp55,mp56,mp57,mp58,mp59,mp60,mp61,mp62,mp63,mp64,mp65,mp66,mp67,mp68,mp69,mp70,mp71,mp72,mp73,mp74,mp75,mp76,mp77,mp78,mp79,mp80,mp81,mp82,mp83,mp84,mp85,mp86,mp87,mp88,mp89,mp90,mp91,mp92,mp93,mp94,mp95,mp96,mp97,mp98,mp99,mp100,mp101,mp102,mp103,mp104,mp105,mp106,mp107,mp108,mp109,mp110,mp111,mp112,mp113,mp114,mp115,mp116,mp117,mp118,mp119,mp120,mp121,mp122,mp123,mp124,mp125,mp126,mp127,mp128,mp129,mp130,mp131,mp132,mp133,mp134,mp135,mp136,mp137,mp138,mp139,mp140,mp141,mp142,mp143,mp144,mp145,mp146,mp147,mp148,mp149,mp150,mp151,mp152,mp153,mp154,mp155,mp156,mp157,mp158,mp159,mp160,mp161,mp162,mp163,mp164,mp165,mp166,mp167,mp168,mp169,mp170,mp171,mp172,mp173,mp174,mp175,mp176,mp177,mp178,mp179,mp180,mp181,mp182,mp183,mp184,mp185,mp186,mp187,mp188,mp189,mp190,mp191,mp192,mp193,mp194,mp195,mp196,mp197,mp198,mp199,mp200,mp201,mp202,mp203,mp204,mp205,mp206,mp207,mp208,mp209,mp210,mp211,mp212,mp213,mp214,mp215,mp216,mp217,mp218,mp219,mp220,mp221,mp222,mp223,mp224,mp225,mp226,mp227,mp228,mp229,mp230,mp231,mp232,mp233,mp234,mp235,mp236,mp237,mp238,mp239,mp240,mp241,mp242,mp243,mp244,mp245,mp246,mp247,mp248,mp249,mp250,mp251,mp252,mp253,mp254,mp255
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String storage, String volume) throws JSONException {
- Map parameters = new HashMap<>();
- parameters.put("storage", storage);
- parameters.put("volume", volume);
- return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/move_volume", parameters);
- }
-
- /**
- * Move a rootfs-/mp-volume to a different storage
- *
- * @param storage Target Storage.
- * @param volume Volume which will be moved. Enum:
- * rootfs,mp0,mp1,mp2,mp3,mp4,mp5,mp6,mp7,mp8,mp9,mp10,mp11,mp12,mp13,mp14,mp15,mp16,mp17,mp18,mp19,mp20,mp21,mp22,mp23,mp24,mp25,mp26,mp27,mp28,mp29,mp30,mp31,mp32,mp33,mp34,mp35,mp36,mp37,mp38,mp39,mp40,mp41,mp42,mp43,mp44,mp45,mp46,mp47,mp48,mp49,mp50,mp51,mp52,mp53,mp54,mp55,mp56,mp57,mp58,mp59,mp60,mp61,mp62,mp63,mp64,mp65,mp66,mp67,mp68,mp69,mp70,mp71,mp72,mp73,mp74,mp75,mp76,mp77,mp78,mp79,mp80,mp81,mp82,mp83,mp84,mp85,mp86,mp87,mp88,mp89,mp90,mp91,mp92,mp93,mp94,mp95,mp96,mp97,mp98,mp99,mp100,mp101,mp102,mp103,mp104,mp105,mp106,mp107,mp108,mp109,mp110,mp111,mp112,mp113,mp114,mp115,mp116,mp117,mp118,mp119,mp120,mp121,mp122,mp123,mp124,mp125,mp126,mp127,mp128,mp129,mp130,mp131,mp132,mp133,mp134,mp135,mp136,mp137,mp138,mp139,mp140,mp141,mp142,mp143,mp144,mp145,mp146,mp147,mp148,mp149,mp150,mp151,mp152,mp153,mp154,mp155,mp156,mp157,mp158,mp159,mp160,mp161,mp162,mp163,mp164,mp165,mp166,mp167,mp168,mp169,mp170,mp171,mp172,mp173,mp174,mp175,mp176,mp177,mp178,mp179,mp180,mp181,mp182,mp183,mp184,mp185,mp186,mp187,mp188,mp189,mp190,mp191,mp192,mp193,mp194,mp195,mp196,mp197,mp198,mp199,mp200,mp201,mp202,mp203,mp204,mp205,mp206,mp207,mp208,mp209,mp210,mp211,mp212,mp213,mp214,mp215,mp216,mp217,mp218,mp219,mp220,mp221,mp222,mp223,mp224,mp225,mp226,mp227,mp228,mp229,mp230,mp231,mp232,mp233,mp234,mp235,mp236,mp237,mp238,mp239,mp240,mp241,mp242,mp243,mp244,mp245,mp246,mp247,mp248,mp249,mp250,mp251,mp252,mp253,mp254,mp255
- * @return Result
- * @throws JSONException
- */
- public Result moveVolume(String storage, String volume) throws JSONException {
- return createRest(storage, volume);
- }
-
- }
-
- /**
- * Destroy the container (also delete all uses files).
- *
- * @return Result
- * @throws JSONException
- */
- public Result deleteRest() throws JSONException {
- return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "", null);
- }
-
- /**
- * Destroy the container (also delete all uses files).
- *
- * @return Result
- * @throws JSONException
- */
- public Result destroyVm() throws JSONException {
- return deleteRest();
- }
-
- /**
- * Directory index
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "", null);
- }
-
- /**
- * Directory index
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmdiridx() throws JSONException {
- return getRest();
- }
-
- }
-
- /**
- * LXC container index (per node).
- *
- * @return Result
- * @throws JSONException
- */
- public Result getRest() throws JSONException {
- return _client.get("/nodes/" + _node + "/lxc", null);
- }
-
- /**
- * LXC container index (per node).
- *
- * @return Result
- * @throws JSONException
- */
- public Result vmlist() throws JSONException {
- return getRest();
- }
-
- /**
- * Create or restore a container.
- *
- * @param ostemplate The OS template or backup file.
- * @param vmid The (unique) ID of the VM.
- * @param arch OS architecture type. Enum:
- * amd64,i386,arm64,armhf
- * @param bwlimit Override I/O bandwidth limit (in KiB/s).
- * @param cmode Console mode. By default, the console command
- * tries to open a connection to one of the available tty
- * devices. By setting cmode to 'console' it tries to attach to
- * /dev/console instead. If you set cmode to 'shell', it simply
- * invokes a shell inside the container (no login). Enum:
- * shell,console,tty
- * @param console Attach a console device (/dev/console) to the
- * container.
- * @param cores The number of cores assigned to the container. A
- * container can use all available cores by default.
- * @param cpulimit Limit of CPU usage. NOTE: If the computer has
- * 2 CPUs, it has a total of '2' CPU time. Value '0' indicates
- * no CPU limit.
- * @param cpuunits CPU weight for a VM. Argument is used in the
- * kernel fair scheduler. The larger the number is, the more CPU
- * time this VM gets. Number is relative to the weights of all
- * the other running VMs. NOTE: You can disable fair-scheduler
- * configuration by setting this to 0.
- * @param description Container description. Only used on the
- * configuration web interface.
- * @param features Allow containers access to advanced features.
- * @param force Allow to overwrite existing container.
- * @param hookscript Script that will be exectued during various
- * steps in the containers lifetime.
- * @param hostname Set a host name for the container.
- * @param ignore_unpack_errors Ignore errors when extracting the
- * template.
- * @param lock_ Lock/unlock the VM. Enum:
- * backup,create,disk,fstrim,migrate,mounted,rollback,snapshot,snapshot-delete
- * @param memory Amount of RAM for the VM in MB.
- * @param mpN Use volume as container mount point.
- * @param nameserver Sets DNS server IP address for a container.
- * Create will automatically use the setting from the host if
- * you neither set searchdomain nor nameserver.
- * @param netN Specifies network interfaces for the container.
- * @param onboot Specifies whether a VM will be started during
- * system bootup.
- * @param ostype OS type. This is used to setup configuration
- * inside the container, and corresponds to lxc setup scripts in
- * /usr/share/lxc/config/<ostype>.common.conf.
- * Value 'unmanaged' can be used to skip and OS specific setup.
- * Enum:
- * debian,ubuntu,centos,fedora,opensuse,archlinux,alpine,gentoo,unmanaged
- * @param password Sets root password inside container.
- * @param pool Add the VM to the specified pool.
- * @param protection Sets the protection flag of the container.
- * This will prevent the CT or CT's disk remove/update
- * operation.
- * @param restore Mark this as restore task.
- * @param rootfs Use volume as container root.
- * @param searchdomain Sets DNS search domains for a container.
- * Create will automatically use the setting from the host if
- * you neither set searchdomain nor nameserver.
- * @param ssh_public_keys Setup public SSH keys (one key per
- * line, OpenSSH format).
- * @param start Start the CT after its creation finished
- * successfully.
- * @param startup Startup and shutdown behavior. Order is a
- * non-negative number defining the general startup order.
- * Shutdown in done with reverse ordering. Additionally you can
- * set the 'up' or 'down' delay in seconds, which specifies a
- * delay to wait before the next VM is started or stopped.
- * @param storage Default Storage.
- * @param swap Amount of SWAP for the VM in MB.
- * @param template Enable/disable Template.
- * @param tty Specify the number of tty available to the
- * container
- * @param unique Assign a unique random ethernet address.
- * @param unprivileged Makes the container run as unprivileged
- * user. (Should not be modified manually.)
- * @param unusedN Reference to unused volumes. This is used
- * internally, and should not be modified manually.
- * @return Result
- * @throws JSONException
- */
- public Result createRest(String ostemplate, int vmid, String arch, Integer bwlimit, String cmode, Boolean console, Integer cores, Integer cpulimit, Integer cpuunits, String description, String features, Boolean force, String hookscript, String hostname, Boolean ignore_unpack_errors, String lock_, Integer memory, Map mpN, String nameserver, Map netN, Boolean onboot, String ostype, String password, String pool, Boolean protection, Boolean restore, String rootfs, String searchdomain, String ssh_public_keys, Boolean start, String startup, String storage, Integer swap, Boolean template, Integer tty, Boolean unique, Boolean unprivileged, Map unusedN) throws JSONException {
- Map