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. - * '&lt;GUEST&gt;-&lt;JOBNUM&gt;'. - * @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. - * '&lt;GUEST&gt;-&lt;JOBNUM&gt;'. - * @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. - * '&lt;GUEST&gt;-&lt;JOBNUM&gt;'. - * @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. - * '&lt;GUEST&gt;-&lt;JOBNUM&gt;'. - * @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 - * &lt;moveto&gt;. 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 - * &lt;moveto&gt;. 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 &lt;pos&gt;. - * @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 &lt;pos&gt;. - * @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 - * &lt;moveto&gt;. 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 - * &lt;moveto&gt;. 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 &lt;pos&gt;. - * @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 &lt;pos&gt;. - * @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&gt;0. N=1 - * uses half of cores, N&gt;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&gt;0. N=1 - * uses half of cores, N&gt;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&gt;0. N=1 uses - * half of cores, N&gt;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&gt;0. N=1 uses - * half of cores, N&gt;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 - * &lt;moveto&gt;. 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 - * &lt;moveto&gt;. 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 - * &lt;pos&gt;. - * @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 - * &lt;pos&gt;. - * @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&lt;id&gt; 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&lt;id&gt; 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/&lt;ostype&gt;.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/&lt;ostype&gt;.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 - * &lt;moveto&gt;. 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 - * &lt;moveto&gt;. 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 - * &lt;pos&gt;. - * @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 - * &lt;pos&gt;. - * @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&lt;id&gt; 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&lt;id&gt; 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/&lt;ostype&gt;.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 parameters = new HashMap<>(); - parameters.put("ostemplate", ostemplate); - parameters.put("vmid", vmid); - parameters.put("arch", arch); - parameters.put("bwlimit", bwlimit); - parameters.put("cmode", cmode); - parameters.put("console", console); - parameters.put("cores", cores); - parameters.put("cpulimit", cpulimit); - parameters.put("cpuunits", cpuunits); - parameters.put("description", description); - parameters.put("features", features); - parameters.put("force", force); - parameters.put("hookscript", hookscript); - parameters.put("hostname", hostname); - parameters.put("ignore-unpack-errors", ignore_unpack_errors); - parameters.put("lock", lock_); - parameters.put("memory", memory); - parameters.put("nameserver", nameserver); - parameters.put("onboot", onboot); - parameters.put("ostype", ostype); - parameters.put("password", password); - parameters.put("pool", pool); - parameters.put("protection", protection); - parameters.put("restore", restore); - parameters.put("rootfs", rootfs); - parameters.put("searchdomain", searchdomain); - parameters.put("ssh-public-keys", ssh_public_keys); - parameters.put("start", start); - parameters.put("startup", startup); - parameters.put("storage", storage); - parameters.put("swap", swap); - parameters.put("template", template); - parameters.put("tty", tty); - parameters.put("unique", unique); - parameters.put("unprivileged", unprivileged); - addIndexedParameter(parameters, "mp", mpN); - addIndexedParameter(parameters, "net", netN); - addIndexedParameter(parameters, "unused", unusedN); - return _client.create("/nodes/" + _node + "/lxc", parameters); - } - - /** - * 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/&lt;ostype&gt;.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 createVm(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 { - return createRest(ostemplate, vmid, arch, bwlimit, cmode, console, cores, cpulimit, cpuunits, description, features, force, hookscript, hostname, ignore_unpack_errors, lock_, memory, mpN, nameserver, netN, onboot, ostype, password, pool, protection, restore, rootfs, searchdomain, ssh_public_keys, start, startup, storage, swap, template, tty, unique, unprivileged, unusedN); - } - - /** - * Create or restore a container. - * - * @param ostemplate The OS template or backup file. - * @param vmid The (unique) ID of the VM. - * @return Result - * @throws JSONException - */ - public Result createRest(String ostemplate, int vmid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("ostemplate", ostemplate); - parameters.put("vmid", vmid); - return _client.create("/nodes/" + _node + "/lxc", parameters); - } - - /** - * Create or restore a container. - * - * @param ostemplate The OS template or backup file. - * @param vmid The (unique) ID of the VM. - * @return Result - * @throws JSONException - */ - public Result createVm(String ostemplate, int vmid) throws JSONException { - return createRest(ostemplate, vmid); - } - - } - - public class PVECeph { - - private final PveClient _client; - private final Object _node; - - protected PVECeph(PveClient client, Object node) { - _client = client; - _node = node; - } - - private PVEOsd _osd; - - public PVEOsd getOsd() { - if (_osd == null) { - _osd = new PVEOsd(_client, _node); - } - - return _osd; - } - private PVEMds _mds; - - public PVEMds getMds() { - if (_mds == null) { - _mds = new PVEMds(_client, _node); - } - - return _mds; - } - private PVEMgr _mgr; - - public PVEMgr getMgr() { - if (_mgr == null) { - _mgr = new PVEMgr(_client, _node); - } - - return _mgr; - } - private PVEMon _mon; - - public PVEMon getMon() { - if (_mon == null) { - _mon = new PVEMon(_client, _node); - } - - return _mon; - } - private PVEFs _fs; - - public PVEFs getFs() { - if (_fs == null) { - _fs = new PVEFs(_client, _node); - } - - return _fs; - } - private PVEDisks _disks; - - public PVEDisks getDisks() { - if (_disks == null) { - _disks = new PVEDisks(_client, _node); - } - - return _disks; - } - private PVEConfig _config; - - public PVEConfig getConfig() { - if (_config == null) { - _config = new PVEConfig(_client, _node); - } - - return _config; - } - private PVEConfigdb _configdb; - - public PVEConfigdb getConfigdb() { - if (_configdb == null) { - _configdb = new PVEConfigdb(_client, _node); - } - - return _configdb; - } - private PVEInit _init; - - public PVEInit getInit() { - if (_init == null) { - _init = new PVEInit(_client, _node); - } - - return _init; - } - private PVEStop _stop; - - public PVEStop getStop() { - if (_stop == null) { - _stop = new PVEStop(_client, _node); - } - - return _stop; - } - private PVEStart _start; - - public PVEStart getStart() { - if (_start == null) { - _start = new PVEStart(_client, _node); - } - - return _start; - } - private PVERestart _restart; - - public PVERestart getRestart() { - if (_restart == null) { - _restart = new PVERestart(_client, _node); - } - - return _restart; - } - private PVEStatus _status; - - public PVEStatus getStatus() { - if (_status == null) { - _status = new PVEStatus(_client, _node); - } - - return _status; - } - private PVEPools _pools; - - public PVEPools getPools() { - if (_pools == null) { - _pools = new PVEPools(_client, _node); - } - - return _pools; - } - private PVEFlags _flags; - - public PVEFlags getFlags() { - if (_flags == null) { - _flags = new PVEFlags(_client, _node); - } - - return _flags; - } - private PVECrush _crush; - - public PVECrush getCrush() { - if (_crush == null) { - _crush = new PVECrush(_client, _node); - } - - return _crush; - } - private PVELog _log; - - public PVELog getLog() { - if (_log == null) { - _log = new PVELog(_client, _node); - } - - return _log; - } - private PVERules _rules; - - public PVERules getRules() { - if (_rules == null) { - _rules = new PVERules(_client, _node); - } - - return _rules; - } - - public class PVEOsd { - - private final PveClient _client; - private final Object _node; - - protected PVEOsd(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemOsdid get(Object osdid) { - return new PVEItemOsdid(_client, _node, osdid); - } - - public class PVEItemOsdid { - - private final PveClient _client; - private final Object _node; - private final Object _osdid; - - protected PVEItemOsdid(PveClient client, Object node, Object osdid) { - _client = client; - _node = node; - _osdid = osdid; - } - - private PVEIn _in; - - public PVEIn getIn() { - if (_in == null) { - _in = new PVEIn(_client, _node, _osdid); - } - - return _in; - } - private PVEOut _out; - - public PVEOut getOut() { - if (_out == null) { - _out = new PVEOut(_client, _node, _osdid); - } - - return _out; - } - private PVEScrub _scrub; - - public PVEScrub getScrub() { - if (_scrub == null) { - _scrub = new PVEScrub(_client, _node, _osdid); - } - - return _scrub; - } - - public class PVEIn { - - private final PveClient _client; - private final Object _node; - private final Object _osdid; - - protected PVEIn(PveClient client, Object node, Object osdid) { - _client = client; - _node = node; - _osdid = osdid; - } - - /** - * ceph osd in - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/osd/" + _osdid + "/in", null); - } - - /** - * ceph osd in - * - * @return Result - * @throws JSONException - */ - public Result in() throws JSONException { - return createRest(); - } - - } - - public class PVEOut { - - private final PveClient _client; - private final Object _node; - private final Object _osdid; - - protected PVEOut(PveClient client, Object node, Object osdid) { - _client = client; - _node = node; - _osdid = osdid; - } - - /** - * ceph osd out - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/osd/" + _osdid + "/out", null); - } - - /** - * ceph osd out - * - * @return Result - * @throws JSONException - */ - public Result out() throws JSONException { - return createRest(); - } - - } - - public class PVEScrub { - - private final PveClient _client; - private final Object _node; - private final Object _osdid; - - protected PVEScrub(PveClient client, Object node, Object osdid) { - _client = client; - _node = node; - _osdid = osdid; - } - - /** - * Instruct the OSD to scrub. - * - * @param deep If set, instructs a deep scrub - * instead of a normal one. - * @return Result - * @throws JSONException - */ - public Result createRest(Boolean deep) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("deep", deep); - return _client.create("/nodes/" + _node + "/ceph/osd/" + _osdid + "/scrub", parameters); - } - - /** - * Instruct the OSD to scrub. - * - * @param deep If set, instructs a deep scrub - * instead of a normal one. - * @return Result - * @throws JSONException - */ - public Result scrub(Boolean deep) throws JSONException { - return createRest(deep); - } - - /** - * Instruct the OSD to scrub. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/osd/" + _osdid + "/scrub", null); - } - - /** - * Instruct the OSD to scrub. - * - * @return Result - * @throws JSONException - */ - public Result scrub() throws JSONException { - return createRest(); - } - - } - - /** - * Destroy OSD - * - * @param cleanup If set, we remove partition table - * entries. - * @return Result - * @throws JSONException - */ - public Result deleteRest(Boolean cleanup) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("cleanup", cleanup); - return _client.delete("/nodes/" + _node + "/ceph/osd/" + _osdid + "", parameters); - } - - /** - * Destroy OSD - * - * @param cleanup If set, we remove partition table - * entries. - * @return Result - * @throws JSONException - */ - public Result destroyosd(Boolean cleanup) throws JSONException { - return deleteRest(cleanup); - } - - /** - * Destroy OSD - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/ceph/osd/" + _osdid + "", null); - } - - /** - * Destroy OSD - * - * @return Result - * @throws JSONException - */ - public Result destroyosd() throws JSONException { - return deleteRest(); - } - - } - - /** - * Get Ceph osd list/tree. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/osd", null); - } - - /** - * Get Ceph osd list/tree. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create OSD - * - * @param dev Block device name. - * @param db_dev Block device name for block.db. - * @param db_size Size in GiB for block.db. - * @param encrypted Enables encryption of the OSD. - * @param wal_dev Block device name for block.wal. - * @param wal_size Size in GiB for block.wal. - * @return Result - * @throws JSONException - */ - public Result createRest(String dev, String db_dev, Integer db_size, Boolean encrypted, String wal_dev, Integer wal_size) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("dev", dev); - parameters.put("db_dev", db_dev); - parameters.put("db_size", db_size); - parameters.put("encrypted", encrypted); - parameters.put("wal_dev", wal_dev); - parameters.put("wal_size", wal_size); - return _client.create("/nodes/" + _node + "/ceph/osd", parameters); - } - - /** - * Create OSD - * - * @param dev Block device name. - * @param db_dev Block device name for block.db. - * @param db_size Size in GiB for block.db. - * @param encrypted Enables encryption of the OSD. - * @param wal_dev Block device name for block.wal. - * @param wal_size Size in GiB for block.wal. - * @return Result - * @throws JSONException - */ - public Result createosd(String dev, String db_dev, Integer db_size, Boolean encrypted, String wal_dev, Integer wal_size) throws JSONException { - return createRest(dev, db_dev, db_size, encrypted, wal_dev, wal_size); - } - - /** - * Create OSD - * - * @param dev Block device name. - * @return Result - * @throws JSONException - */ - public Result createRest(String dev) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("dev", dev); - return _client.create("/nodes/" + _node + "/ceph/osd", parameters); - } - - /** - * Create OSD - * - * @param dev Block device name. - * @return Result - * @throws JSONException - */ - public Result createosd(String dev) throws JSONException { - return createRest(dev); - } - - } - - public class PVEMds { - - private final PveClient _client; - private final Object _node; - - protected PVEMds(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemName get(Object name) { - return new PVEItemName(_client, _node, name); - } - - public class PVEItemName { - - private final PveClient _client; - private final Object _node; - private final Object _name; - - protected PVEItemName(PveClient client, Object node, Object name) { - _client = client; - _node = node; - _name = name; - } - - /** - * Destroy Ceph Metadata Server - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/ceph/mds/" + _name + "", null); - } - - /** - * Destroy Ceph Metadata Server - * - * @return Result - * @throws JSONException - */ - public Result destroymds() throws JSONException { - return deleteRest(); - } - - /** - * Create Ceph Metadata Server (MDS) - * - * @param hotstandby Determines whether a ceph-mds - * daemon should poll and replay the log of an active - * MDS. Faster switch on MDS failure, but needs more - * idle resources. - * @return Result - * @throws JSONException - */ - public Result createRest(Boolean hotstandby) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("hotstandby", hotstandby); - return _client.create("/nodes/" + _node + "/ceph/mds/" + _name + "", parameters); - } - - /** - * Create Ceph Metadata Server (MDS) - * - * @param hotstandby Determines whether a ceph-mds - * daemon should poll and replay the log of an active - * MDS. Faster switch on MDS failure, but needs more - * idle resources. - * @return Result - * @throws JSONException - */ - public Result createmds(Boolean hotstandby) throws JSONException { - return createRest(hotstandby); - } - - /** - * Create Ceph Metadata Server (MDS) - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/mds/" + _name + "", null); - } - - /** - * Create Ceph Metadata Server (MDS) - * - * @return Result - * @throws JSONException - */ - public Result createmds() throws JSONException { - return createRest(); - } - - } - - /** - * MDS directory index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/mds", null); - } - - /** - * MDS directory index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEMgr { - - private final PveClient _client; - private final Object _node; - - protected PVEMgr(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemId get(Object id) { - return new PVEItemId(_client, _node, id); - } - - public class PVEItemId { - - private final PveClient _client; - private final Object _node; - private final Object _id; - - protected PVEItemId(PveClient client, Object node, Object id) { - _client = client; - _node = node; - _id = id; - } - - /** - * Destroy Ceph Manager. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/ceph/mgr/" + _id + "", null); - } - - /** - * Destroy Ceph Manager. - * - * @return Result - * @throws JSONException - */ - public Result destroymgr() throws JSONException { - return deleteRest(); - } - - /** - * Create Ceph Manager - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/mgr/" + _id + "", null); - } - - /** - * Create Ceph Manager - * - * @return Result - * @throws JSONException - */ - public Result createmgr() throws JSONException { - return createRest(); - } - - } - - /** - * MGR directory index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/mgr", null); - } - - /** - * MGR directory index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEMon { - - private final PveClient _client; - private final Object _node; - - protected PVEMon(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemMonid get(Object monid) { - return new PVEItemMonid(_client, _node, monid); - } - - public class PVEItemMonid { - - private final PveClient _client; - private final Object _node; - private final Object _monid; - - protected PVEItemMonid(PveClient client, Object node, Object monid) { - _client = client; - _node = node; - _monid = monid; - } - - /** - * Destroy Ceph Monitor and Manager. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/ceph/mon/" + _monid + "", null); - } - - /** - * Destroy Ceph Monitor and Manager. - * - * @return Result - * @throws JSONException - */ - public Result destroymon() throws JSONException { - return deleteRest(); - } - - /** - * Create Ceph Monitor and Manager - * - * @param mon_address Overwrites autodetected monitor IP - * address. Must be in the public network of ceph. - * @return Result - * @throws JSONException - */ - public Result createRest(String mon_address) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("mon-address", mon_address); - return _client.create("/nodes/" + _node + "/ceph/mon/" + _monid + "", parameters); - } - - /** - * Create Ceph Monitor and Manager - * - * @param mon_address Overwrites autodetected monitor IP - * address. Must be in the public network of ceph. - * @return Result - * @throws JSONException - */ - public Result createmon(String mon_address) throws JSONException { - return createRest(mon_address); - } - - /** - * Create Ceph Monitor and Manager - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/mon/" + _monid + "", null); - } - - /** - * Create Ceph Monitor and Manager - * - * @return Result - * @throws JSONException - */ - public Result createmon() throws JSONException { - return createRest(); - } - - } - - /** - * Get Ceph monitor list. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/mon", null); - } - - /** - * Get Ceph monitor list. - * - * @return Result - * @throws JSONException - */ - public Result listmon() throws JSONException { - return getRest(); - } - - } - - public class PVEFs { - - private final PveClient _client; - private final Object _node; - - protected PVEFs(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemName get(Object name) { - return new PVEItemName(_client, _node, name); - } - - public class PVEItemName { - - private final PveClient _client; - private final Object _node; - private final Object _name; - - protected PVEItemName(PveClient client, Object node, Object name) { - _client = client; - _node = node; - _name = name; - } - - /** - * Create a Ceph filesystem - * - * @param add_storage Configure the created CephFS as - * storage for this cluster. - * @param pg_num Number of placement groups for the - * backing data pool. The metadata pool will use a - * quarter of this. - * @return Result - * @throws JSONException - */ - public Result createRest(Boolean add_storage, Integer pg_num) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("add-storage", add_storage); - parameters.put("pg_num", pg_num); - return _client.create("/nodes/" + _node + "/ceph/fs/" + _name + "", parameters); - } - - /** - * Create a Ceph filesystem - * - * @param add_storage Configure the created CephFS as - * storage for this cluster. - * @param pg_num Number of placement groups for the - * backing data pool. The metadata pool will use a - * quarter of this. - * @return Result - * @throws JSONException - */ - public Result createfs(Boolean add_storage, Integer pg_num) throws JSONException { - return createRest(add_storage, pg_num); - } - - /** - * Create a Ceph filesystem - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/fs/" + _name + "", null); - } - - /** - * Create a Ceph filesystem - * - * @return Result - * @throws JSONException - */ - public Result createfs() throws JSONException { - return createRest(); - } - - } - - /** - * Directory index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/fs", null); - } - - /** - * Directory index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEDisks { - - private final PveClient _client; - private final Object _node; - - protected PVEDisks(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * List local disks. - * - * @param type Only list specific types of disks. Enum: - * unused,journal_disks - * @return Result - * @throws JSONException - */ - public Result getRest(String type) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("type", type); - return _client.get("/nodes/" + _node + "/ceph/disks", parameters); - } - - /** - * List local disks. - * - * @param type Only list specific types of disks. Enum: - * unused,journal_disks - * @return Result - * @throws JSONException - */ - public Result disks(String type) throws JSONException { - return getRest(type); - } - - /** - * List local disks. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/disks", null); - } - - /** - * List local disks. - * - * @return Result - * @throws JSONException - */ - public Result disks() throws JSONException { - return getRest(); - } - - } - - public class PVEConfig { - - private final PveClient _client; - private final Object _node; - - protected PVEConfig(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get Ceph configuration. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/config", null); - } - - /** - * Get Ceph configuration. - * - * @return Result - * @throws JSONException - */ - public Result config() throws JSONException { - return getRest(); - } - - } - - public class PVEConfigdb { - - private final PveClient _client; - private final Object _node; - - protected PVEConfigdb(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get Ceph configuration database. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/configdb", null); - } - - /** - * Get Ceph configuration database. - * - * @return Result - * @throws JSONException - */ - public Result configdb() throws JSONException { - return getRest(); - } - - } - - public class PVEInit { - - private final PveClient _client; - private final Object _node; - - protected PVEInit(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Create initial ceph default configuration and setup - * symlinks. - * - * @param cluster_network Declare a separate cluster - * network, OSDs will routeheartbeat, object replication and - * recovery traffic over it - * @param disable_cephx Disable cephx authentication. - * WARNING: cephx is a security feature protecting against - * man-in-the-middle attacks. Only consider disabling cephx - * if your network is private! - * @param min_size Minimum number of available replicas per - * object to allow I/O - * @param network Use specific network for all ceph related - * traffic - * @param pg_bits Placement group bits, used to specify the - * default number of placement groups. NOTE: 'osd pool - * default pg num' does not work for default pools. - * @param size Targeted number of replicas per object - * @return Result - * @throws JSONException - */ - public Result createRest(String cluster_network, Boolean disable_cephx, Integer min_size, String network, Integer pg_bits, Integer size) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("cluster-network", cluster_network); - parameters.put("disable_cephx", disable_cephx); - parameters.put("min_size", min_size); - parameters.put("network", network); - parameters.put("pg_bits", pg_bits); - parameters.put("size", size); - return _client.create("/nodes/" + _node + "/ceph/init", parameters); - } - - /** - * Create initial ceph default configuration and setup - * symlinks. - * - * @param cluster_network Declare a separate cluster - * network, OSDs will routeheartbeat, object replication and - * recovery traffic over it - * @param disable_cephx Disable cephx authentication. - * WARNING: cephx is a security feature protecting against - * man-in-the-middle attacks. Only consider disabling cephx - * if your network is private! - * @param min_size Minimum number of available replicas per - * object to allow I/O - * @param network Use specific network for all ceph related - * traffic - * @param pg_bits Placement group bits, used to specify the - * default number of placement groups. NOTE: 'osd pool - * default pg num' does not work for default pools. - * @param size Targeted number of replicas per object - * @return Result - * @throws JSONException - */ - public Result init(String cluster_network, Boolean disable_cephx, Integer min_size, String network, Integer pg_bits, Integer size) throws JSONException { - return createRest(cluster_network, disable_cephx, min_size, network, pg_bits, size); - } - - /** - * Create initial ceph default configuration and setup - * symlinks. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/init", null); - } - - /** - * Create initial ceph default configuration and setup - * symlinks. - * - * @return Result - * @throws JSONException - */ - public Result init() throws JSONException { - return createRest(); - } - - } - - public class PVEStop { - - private final PveClient _client; - private final Object _node; - - protected PVEStop(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Stop ceph services. - * - * @param service Ceph service name. - * @return Result - * @throws JSONException - */ - public Result createRest(String service) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("service", service); - return _client.create("/nodes/" + _node + "/ceph/stop", parameters); - } - - /** - * Stop ceph services. - * - * @param service Ceph service name. - * @return Result - * @throws JSONException - */ - public Result stop(String service) throws JSONException { - return createRest(service); - } - - /** - * Stop ceph services. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/stop", null); - } - - /** - * Stop ceph services. - * - * @return Result - * @throws JSONException - */ - public Result stop() throws JSONException { - return createRest(); - } - - } - - public class PVEStart { - - private final PveClient _client; - private final Object _node; - - protected PVEStart(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Start ceph services. - * - * @param service Ceph service name. - * @return Result - * @throws JSONException - */ - public Result createRest(String service) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("service", service); - return _client.create("/nodes/" + _node + "/ceph/start", parameters); - } - - /** - * Start ceph services. - * - * @param service Ceph service name. - * @return Result - * @throws JSONException - */ - public Result start(String service) throws JSONException { - return createRest(service); - } - - /** - * Start ceph services. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/start", null); - } - - /** - * Start ceph services. - * - * @return Result - * @throws JSONException - */ - public Result start() throws JSONException { - return createRest(); - } - - } - - public class PVERestart { - - private final PveClient _client; - private final Object _node; - - protected PVERestart(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Restart ceph services. - * - * @param service Ceph service name. - * @return Result - * @throws JSONException - */ - public Result createRest(String service) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("service", service); - return _client.create("/nodes/" + _node + "/ceph/restart", parameters); - } - - /** - * Restart ceph services. - * - * @param service Ceph service name. - * @return Result - * @throws JSONException - */ - public Result restart(String service) throws JSONException { - return createRest(service); - } - - /** - * Restart ceph services. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/restart", null); - } - - /** - * Restart ceph services. - * - * @return Result - * @throws JSONException - */ - public Result restart() throws JSONException { - return createRest(); - } - - } - - public class PVEStatus { - - private final PveClient _client; - private final Object _node; - - protected PVEStatus(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get ceph status. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/status", null); - } - - /** - * Get ceph status. - * - * @return Result - * @throws JSONException - */ - public Result status() throws JSONException { - return getRest(); - } - - } - - public class PVEPools { - - private final PveClient _client; - private final Object _node; - - protected PVEPools(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemName get(Object name) { - return new PVEItemName(_client, _node, name); - } - - public class PVEItemName { - - private final PveClient _client; - private final Object _node; - private final Object _name; - - protected PVEItemName(PveClient client, Object node, Object name) { - _client = client; - _node = node; - _name = name; - } - - /** - * Destroy pool - * - * @param force If true, destroys pool even if in use - * @param remove_storages Remove all pveceph-managed - * storages configured for this pool - * @return Result - * @throws JSONException - */ - public Result deleteRest(Boolean force, Boolean remove_storages) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("force", force); - parameters.put("remove_storages", remove_storages); - return _client.delete("/nodes/" + _node + "/ceph/pools/" + _name + "", parameters); - } - - /** - * Destroy pool - * - * @param force If true, destroys pool even if in use - * @param remove_storages Remove all pveceph-managed - * storages configured for this pool - * @return Result - * @throws JSONException - */ - public Result destroypool(Boolean force, Boolean remove_storages) throws JSONException { - return deleteRest(force, remove_storages); - } - - /** - * Destroy pool - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/ceph/pools/" + _name + "", null); - } - - /** - * Destroy pool - * - * @return Result - * @throws JSONException - */ - public Result destroypool() throws JSONException { - return deleteRest(); - } - - } - - /** - * List all pools. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/pools", null); - } - - /** - * List all pools. - * - * @return Result - * @throws JSONException - */ - public Result lspools() throws JSONException { - return getRest(); - } - - /** - * Create POOL - * - * @param name The name of the pool. It must be unique. - * @param add_storages Configure VM and CT storage using the - * new pool. - * @param application The application of the pool, 'rbd' by - * default. Enum: rbd,cephfs,rgw - * @param crush_rule The rule to use for mapping object - * placement in the cluster. - * @param min_size Minimum number of replicas per object - * @param pg_num Number of placement groups. - * @param size Number of replicas per object - * @return Result - * @throws JSONException - */ - public Result createRest(String name, Boolean add_storages, String application, String crush_rule, Integer min_size, Integer pg_num, Integer size) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("name", name); - parameters.put("add_storages", add_storages); - parameters.put("application", application); - parameters.put("crush_rule", crush_rule); - parameters.put("min_size", min_size); - parameters.put("pg_num", pg_num); - parameters.put("size", size); - return _client.create("/nodes/" + _node + "/ceph/pools", parameters); - } - - /** - * Create POOL - * - * @param name The name of the pool. It must be unique. - * @param add_storages Configure VM and CT storage using the - * new pool. - * @param application The application of the pool, 'rbd' by - * default. Enum: rbd,cephfs,rgw - * @param crush_rule The rule to use for mapping object - * placement in the cluster. - * @param min_size Minimum number of replicas per object - * @param pg_num Number of placement groups. - * @param size Number of replicas per object - * @return Result - * @throws JSONException - */ - public Result createpool(String name, Boolean add_storages, String application, String crush_rule, Integer min_size, Integer pg_num, Integer size) throws JSONException { - return createRest(name, add_storages, application, crush_rule, min_size, pg_num, size); - } - - /** - * Create POOL - * - * @param name The name of the pool. It must be unique. - * @return Result - * @throws JSONException - */ - public Result createRest(String name) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("name", name); - return _client.create("/nodes/" + _node + "/ceph/pools", parameters); - } - - /** - * Create POOL - * - * @param name The name of the pool. It must be unique. - * @return Result - * @throws JSONException - */ - public Result createpool(String name) throws JSONException { - return createRest(name); - } - - } - - public class PVEFlags { - - private final PveClient _client; - private final Object _node; - - protected PVEFlags(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemFlag get(Object flag) { - return new PVEItemFlag(_client, _node, flag); - } - - public class PVEItemFlag { - - private final PveClient _client; - private final Object _node; - private final Object _flag; - - protected PVEItemFlag(PveClient client, Object node, Object flag) { - _client = client; - _node = node; - _flag = flag; - } - - /** - * Unset a ceph flag - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/ceph/flags/" + _flag + "", null); - } - - /** - * Unset a ceph flag - * - * @return Result - * @throws JSONException - */ - public Result unsetFlag() throws JSONException { - return deleteRest(); - } - - /** - * Set a ceph flag - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/ceph/flags/" + _flag + "", null); - } - - /** - * Set a ceph flag - * - * @return Result - * @throws JSONException - */ - public Result setFlag() throws JSONException { - return createRest(); - } - - } - - /** - * get all set ceph flags - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/flags", null); - } - - /** - * get all set ceph flags - * - * @return Result - * @throws JSONException - */ - public Result getFlags() throws JSONException { - return getRest(); - } - - } - - public class PVECrush { - - private final PveClient _client; - private final Object _node; - - protected PVECrush(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get OSD crush map - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/crush", null); - } - - /** - * Get OSD crush map - * - * @return Result - * @throws JSONException - */ - public Result crush() throws JSONException { - return getRest(); - } - - } - - public class PVELog { - - private final PveClient _client; - private final Object _node; - - protected PVELog(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Read ceph 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 + "/ceph/log", parameters); - } - - /** - * Read ceph log - * - * @param limit - * @param start - * @return Result - * @throws JSONException - */ - public Result log(Integer limit, Integer start) throws JSONException { - return getRest(limit, start); - } - - /** - * Read ceph log - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/log", null); - } - - /** - * Read ceph log - * - * @return Result - * @throws JSONException - */ - public Result log() throws JSONException { - return getRest(); - } - - } - - public class PVERules { - - private final PveClient _client; - private final Object _node; - - protected PVERules(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * List ceph rules. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph/rules", null); - } - - /** - * List ceph rules. - * - * @return Result - * @throws JSONException - */ - public Result rules() throws JSONException { - return getRest(); - } - - } - - /** - * Directory index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/ceph", null); - } - - /** - * Directory index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEVzdump { - - private final PveClient _client; - private final Object _node; - - protected PVEVzdump(PveClient client, Object node) { - _client = client; - _node = node; - } - - private PVEExtractconfig _extractconfig; - - public PVEExtractconfig getExtractconfig() { - if (_extractconfig == null) { - _extractconfig = new PVEExtractconfig(_client, _node); - } - - return _extractconfig; - } - - public class PVEExtractconfig { - - private final PveClient _client; - private final Object _node; - - protected PVEExtractconfig(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Extract configuration from vzdump backup archive. - * - * @param volume Volume identifier - * @return Result - * @throws JSONException - */ - public Result getRest(String volume) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("volume", volume); - return _client.get("/nodes/" + _node + "/vzdump/extractconfig", parameters); - } - - /** - * Extract configuration from vzdump backup archive. - * - * @param volume Volume identifier - * @return Result - * @throws JSONException - */ - public Result extractconfig(String volume) throws JSONException { - return getRest(volume); - } - - } - - /** - * Create backup. - * - * @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 dumpdir Store resulting files to specified directory. - * @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 pigz Use pigz instead of gzip when N&gt;0. N=1 - * uses half of cores, N&gt;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 stdout Write tar to stdout, not to a file. - * @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(Boolean all, Integer bwlimit, String compress, String dumpdir, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, Integer pigz, String pool, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stdout, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("all", all); - parameters.put("bwlimit", bwlimit); - parameters.put("compress", compress); - parameters.put("dumpdir", dumpdir); - 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("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("stdout", stdout); - parameters.put("stop", stop); - parameters.put("stopwait", stopwait); - parameters.put("storage", storage); - parameters.put("tmpdir", tmpdir); - parameters.put("vmid", vmid); - return _client.create("/nodes/" + _node + "/vzdump", parameters); - } - - /** - * Create backup. - * - * @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 dumpdir Store resulting files to specified directory. - * @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 pigz Use pigz instead of gzip when N&gt;0. N=1 - * uses half of cores, N&gt;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 stdout Write tar to stdout, not to a file. - * @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 vzdump(Boolean all, Integer bwlimit, String compress, String dumpdir, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, Integer pigz, String pool, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stdout, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) throws JSONException { - return createRest(all, bwlimit, compress, dumpdir, exclude, exclude_path, ionice, lockwait, mailnotification, mailto, maxfiles, mode, pigz, pool, quiet, remove, script, size, stdexcludes, stdout, stop, stopwait, storage, tmpdir, vmid); - } - - /** - * Create backup. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/vzdump", null); - } - - /** - * Create backup. - * - * @return Result - * @throws JSONException - */ - public Result vzdump() throws JSONException { - return createRest(); - } - - } - - public class PVEServices { - - private final PveClient _client; - private final Object _node; - - protected PVEServices(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemService get(Object service) { - return new PVEItemService(_client, _node, service); - } - - public class PVEItemService { - - private final PveClient _client; - private final Object _node; - private final Object _service; - - protected PVEItemService(PveClient client, Object node, Object service) { - _client = client; - _node = node; - _service = service; - } - - private PVEState _state; - - public PVEState getState() { - if (_state == null) { - _state = new PVEState(_client, _node, _service); - } - - return _state; - } - private PVEStart _start; - - public PVEStart getStart() { - if (_start == null) { - _start = new PVEStart(_client, _node, _service); - } - - return _start; - } - private PVEStop _stop; - - public PVEStop getStop() { - if (_stop == null) { - _stop = new PVEStop(_client, _node, _service); - } - - return _stop; - } - private PVERestart _restart; - - public PVERestart getRestart() { - if (_restart == null) { - _restart = new PVERestart(_client, _node, _service); - } - - return _restart; - } - private PVEReload _reload; - - public PVEReload getReload() { - if (_reload == null) { - _reload = new PVEReload(_client, _node, _service); - } - - return _reload; - } - - public class PVEState { - - private final PveClient _client; - private final Object _node; - private final Object _service; - - protected PVEState(PveClient client, Object node, Object service) { - _client = client; - _node = node; - _service = service; - } - - /** - * Read service properties - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/services/" + _service + "/state", null); - } - - /** - * Read service properties - * - * @return Result - * @throws JSONException - */ - public Result serviceState() throws JSONException { - return getRest(); - } - - } - - public class PVEStart { - - private final PveClient _client; - private final Object _node; - private final Object _service; - - protected PVEStart(PveClient client, Object node, Object service) { - _client = client; - _node = node; - _service = service; - } - - /** - * Start service. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/services/" + _service + "/start", null); - } - - /** - * Start service. - * - * @return Result - * @throws JSONException - */ - public Result serviceStart() throws JSONException { - return createRest(); - } - - } - - public class PVEStop { - - private final PveClient _client; - private final Object _node; - private final Object _service; - - protected PVEStop(PveClient client, Object node, Object service) { - _client = client; - _node = node; - _service = service; - } - - /** - * Stop service. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/services/" + _service + "/stop", null); - } - - /** - * Stop service. - * - * @return Result - * @throws JSONException - */ - public Result serviceStop() throws JSONException { - return createRest(); - } - - } - - public class PVERestart { - - private final PveClient _client; - private final Object _node; - private final Object _service; - - protected PVERestart(PveClient client, Object node, Object service) { - _client = client; - _node = node; - _service = service; - } - - /** - * Restart service. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/services/" + _service + "/restart", null); - } - - /** - * Restart service. - * - * @return Result - * @throws JSONException - */ - public Result serviceRestart() throws JSONException { - return createRest(); - } - - } - - public class PVEReload { - - private final PveClient _client; - private final Object _node; - private final Object _service; - - protected PVEReload(PveClient client, Object node, Object service) { - _client = client; - _node = node; - _service = service; - } - - /** - * Reload service. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/services/" + _service + "/reload", null); - } - - /** - * Reload service. - * - * @return Result - * @throws JSONException - */ - public Result serviceReload() throws JSONException { - return createRest(); - } - - } - - /** - * Directory index - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/services/" + _service + "", null); - } - - /** - * Directory index - * - * @return Result - * @throws JSONException - */ - public Result srvcmdidx() throws JSONException { - return getRest(); - } - - } - - /** - * Service list. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/services", null); - } - - /** - * Service list. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVESubscription { - - private final PveClient _client; - private final Object _node; - - protected PVESubscription(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Read subscription info. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/subscription", null); - } - - /** - * Read subscription info. - * - * @return Result - * @throws JSONException - */ - public Result get() throws JSONException { - return getRest(); - } - - /** - * Update subscription info. - * - * @param force Always connect to server, even if we have up to - * date info inside local cache. - * @return Result - * @throws JSONException - */ - public Result createRest(Boolean force) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("force", force); - return _client.create("/nodes/" + _node + "/subscription", parameters); - } - - /** - * Update subscription info. - * - * @param force Always connect to server, even if we have up to - * date info inside local cache. - * @return Result - * @throws JSONException - */ - public Result update(Boolean force) throws JSONException { - return createRest(force); - } - - /** - * Update subscription info. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/subscription", null); - } - - /** - * Update subscription info. - * - * @return Result - * @throws JSONException - */ - public Result update() throws JSONException { - return createRest(); - } - - /** - * Set subscription key. - * - * @param key Proxmox VE subscription key - * @return Result - * @throws JSONException - */ - public Result setRest(String key) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("key", key); - return _client.set("/nodes/" + _node + "/subscription", parameters); - } - - /** - * Set subscription key. - * - * @param key Proxmox VE subscription key - * @return Result - * @throws JSONException - */ - public Result set(String key) throws JSONException { - return setRest(key); - } - - } - - public class PVENetwork { - - private final PveClient _client; - private final Object _node; - - protected PVENetwork(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemIface get(Object iface) { - return new PVEItemIface(_client, _node, iface); - } - - public class PVEItemIface { - - private final PveClient _client; - private final Object _node; - private final Object _iface; - - protected PVEItemIface(PveClient client, Object node, Object iface) { - _client = client; - _node = node; - _iface = iface; - } - - /** - * Delete network device configuration - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/network/" + _iface + "", null); - } - - /** - * Delete network device configuration - * - * @return Result - * @throws JSONException - */ - public Result deleteNetwork() throws JSONException { - return deleteRest(); - } - - /** - * Read network device configuration - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/network/" + _iface + "", null); - } - - /** - * Read network device configuration - * - * @return Result - * @throws JSONException - */ - public Result networkConfig() throws JSONException { - return getRest(); - } - - /** - * Update network device configuration - * - * @param type Network interface type Enum: - * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown - * @param address IP address. - * @param address6 IP address. - * @param autostart Automatically start interface on boot. - * @param bond_mode Bonding mode. Enum: - * balance-rr,active-backup,balance-xor,broadcast,802.3ad,balance-tlb,balance-alb,balance-slb,lacp-balance-slb,lacp-balance-tcp - * @param bond_xmit_hash_policy Selects the transmit hash - * policy to use for slave selection in balance-xor and - * 802.3ad modes. Enum: layer2,layer2+3,layer3+4 - * @param bridge_ports Specify the interfaces you want to - * add to your bridge. - * @param bridge_vlan_aware Enable bridge vlan support. - * @param cidr IPv4 CIDR. - * @param cidr6 IPv6 CIDR. - * @param comments Comments - * @param comments6 Comments - * @param delete A list of settings you want to delete. - * @param gateway Default gateway address. - * @param gateway6 Default ipv6 gateway address. - * @param netmask Network mask. - * @param netmask6 Network mask. - * @param ovs_bonds Specify the interfaces used by the - * bonding device. - * @param ovs_bridge The OVS bridge associated with a OVS - * port. This is required when you create an OVS port. - * @param ovs_options OVS interface options. - * @param ovs_ports Specify the interfaces you want to add - * to your bridge. - * @param ovs_tag Specify a VLan tag (used by OVSPort, - * OVSIntPort, OVSBond) - * @param slaves Specify the interfaces used by the bonding - * device. - * @return Result - * @throws JSONException - */ - public Result setRest(String type, String address, String address6, Boolean autostart, String bond_mode, String bond_xmit_hash_policy, String bridge_ports, Boolean bridge_vlan_aware, String cidr, String cidr6, String comments, String comments6, String delete, String gateway, String gateway6, String netmask, Integer netmask6, String ovs_bonds, String ovs_bridge, String ovs_options, String ovs_ports, Integer ovs_tag, String slaves) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("type", type); - parameters.put("address", address); - parameters.put("address6", address6); - parameters.put("autostart", autostart); - parameters.put("bond_mode", bond_mode); - parameters.put("bond_xmit_hash_policy", bond_xmit_hash_policy); - parameters.put("bridge_ports", bridge_ports); - parameters.put("bridge_vlan_aware", bridge_vlan_aware); - parameters.put("cidr", cidr); - parameters.put("cidr6", cidr6); - parameters.put("comments", comments); - parameters.put("comments6", comments6); - parameters.put("delete", delete); - parameters.put("gateway", gateway); - parameters.put("gateway6", gateway6); - parameters.put("netmask", netmask); - parameters.put("netmask6", netmask6); - parameters.put("ovs_bonds", ovs_bonds); - parameters.put("ovs_bridge", ovs_bridge); - parameters.put("ovs_options", ovs_options); - parameters.put("ovs_ports", ovs_ports); - parameters.put("ovs_tag", ovs_tag); - parameters.put("slaves", slaves); - return _client.set("/nodes/" + _node + "/network/" + _iface + "", parameters); - } - - /** - * Update network device configuration - * - * @param type Network interface type Enum: - * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown - * @param address IP address. - * @param address6 IP address. - * @param autostart Automatically start interface on boot. - * @param bond_mode Bonding mode. Enum: - * balance-rr,active-backup,balance-xor,broadcast,802.3ad,balance-tlb,balance-alb,balance-slb,lacp-balance-slb,lacp-balance-tcp - * @param bond_xmit_hash_policy Selects the transmit hash - * policy to use for slave selection in balance-xor and - * 802.3ad modes. Enum: layer2,layer2+3,layer3+4 - * @param bridge_ports Specify the interfaces you want to - * add to your bridge. - * @param bridge_vlan_aware Enable bridge vlan support. - * @param cidr IPv4 CIDR. - * @param cidr6 IPv6 CIDR. - * @param comments Comments - * @param comments6 Comments - * @param delete A list of settings you want to delete. - * @param gateway Default gateway address. - * @param gateway6 Default ipv6 gateway address. - * @param netmask Network mask. - * @param netmask6 Network mask. - * @param ovs_bonds Specify the interfaces used by the - * bonding device. - * @param ovs_bridge The OVS bridge associated with a OVS - * port. This is required when you create an OVS port. - * @param ovs_options OVS interface options. - * @param ovs_ports Specify the interfaces you want to add - * to your bridge. - * @param ovs_tag Specify a VLan tag (used by OVSPort, - * OVSIntPort, OVSBond) - * @param slaves Specify the interfaces used by the bonding - * device. - * @return Result - * @throws JSONException - */ - public Result updateNetwork(String type, String address, String address6, Boolean autostart, String bond_mode, String bond_xmit_hash_policy, String bridge_ports, Boolean bridge_vlan_aware, String cidr, String cidr6, String comments, String comments6, String delete, String gateway, String gateway6, String netmask, Integer netmask6, String ovs_bonds, String ovs_bridge, String ovs_options, String ovs_ports, Integer ovs_tag, String slaves) throws JSONException { - return setRest(type, address, address6, autostart, bond_mode, bond_xmit_hash_policy, bridge_ports, bridge_vlan_aware, cidr, cidr6, comments, comments6, delete, gateway, gateway6, netmask, netmask6, ovs_bonds, ovs_bridge, ovs_options, ovs_ports, ovs_tag, slaves); - } - - /** - * Update network device configuration - * - * @param type Network interface type Enum: - * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown - * @return Result - * @throws JSONException - */ - public Result setRest(String type) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("type", type); - return _client.set("/nodes/" + _node + "/network/" + _iface + "", parameters); - } - - /** - * Update network device configuration - * - * @param type Network interface type Enum: - * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown - * @return Result - * @throws JSONException - */ - public Result updateNetwork(String type) throws JSONException { - return setRest(type); - } - - } - - /** - * Revert network configuration changes. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/network", null); - } - - /** - * Revert network configuration changes. - * - * @return Result - * @throws JSONException - */ - public Result revertNetworkChanges() throws JSONException { - return deleteRest(); - } - - /** - * List available networks - * - * @param type Only list specific interface types. Enum: - * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,any_bridge - * @return Result - * @throws JSONException - */ - public Result getRest(String type) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("type", type); - return _client.get("/nodes/" + _node + "/network", parameters); - } - - /** - * List available networks - * - * @param type Only list specific interface types. Enum: - * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,any_bridge - * @return Result - * @throws JSONException - */ - public Result index(String type) throws JSONException { - return getRest(type); - } - - /** - * List available networks - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/network", null); - } - - /** - * List available networks - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create network device configuration - * - * @param iface Network interface name. - * @param type Network interface type Enum: - * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown - * @param address IP address. - * @param address6 IP address. - * @param autostart Automatically start interface on boot. - * @param bond_mode Bonding mode. Enum: - * balance-rr,active-backup,balance-xor,broadcast,802.3ad,balance-tlb,balance-alb,balance-slb,lacp-balance-slb,lacp-balance-tcp - * @param bond_xmit_hash_policy Selects the transmit hash policy - * to use for slave selection in balance-xor and 802.3ad modes. - * Enum: layer2,layer2+3,layer3+4 - * @param bridge_ports Specify the interfaces you want to add to - * your bridge. - * @param bridge_vlan_aware Enable bridge vlan support. - * @param cidr IPv4 CIDR. - * @param cidr6 IPv6 CIDR. - * @param comments Comments - * @param comments6 Comments - * @param gateway Default gateway address. - * @param gateway6 Default ipv6 gateway address. - * @param netmask Network mask. - * @param netmask6 Network mask. - * @param ovs_bonds Specify the interfaces used by the bonding - * device. - * @param ovs_bridge The OVS bridge associated with a OVS port. - * This is required when you create an OVS port. - * @param ovs_options OVS interface options. - * @param ovs_ports Specify the interfaces you want to add to - * your bridge. - * @param ovs_tag Specify a VLan tag (used by OVSPort, - * OVSIntPort, OVSBond) - * @param slaves Specify the interfaces used by the bonding - * device. - * @return Result - * @throws JSONException - */ - public Result createRest(String iface, String type, String address, String address6, Boolean autostart, String bond_mode, String bond_xmit_hash_policy, String bridge_ports, Boolean bridge_vlan_aware, String cidr, String cidr6, String comments, String comments6, String gateway, String gateway6, String netmask, Integer netmask6, String ovs_bonds, String ovs_bridge, String ovs_options, String ovs_ports, Integer ovs_tag, String slaves) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("iface", iface); - parameters.put("type", type); - parameters.put("address", address); - parameters.put("address6", address6); - parameters.put("autostart", autostart); - parameters.put("bond_mode", bond_mode); - parameters.put("bond_xmit_hash_policy", bond_xmit_hash_policy); - parameters.put("bridge_ports", bridge_ports); - parameters.put("bridge_vlan_aware", bridge_vlan_aware); - parameters.put("cidr", cidr); - parameters.put("cidr6", cidr6); - parameters.put("comments", comments); - parameters.put("comments6", comments6); - parameters.put("gateway", gateway); - parameters.put("gateway6", gateway6); - parameters.put("netmask", netmask); - parameters.put("netmask6", netmask6); - parameters.put("ovs_bonds", ovs_bonds); - parameters.put("ovs_bridge", ovs_bridge); - parameters.put("ovs_options", ovs_options); - parameters.put("ovs_ports", ovs_ports); - parameters.put("ovs_tag", ovs_tag); - parameters.put("slaves", slaves); - return _client.create("/nodes/" + _node + "/network", parameters); - } - - /** - * Create network device configuration - * - * @param iface Network interface name. - * @param type Network interface type Enum: - * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown - * @param address IP address. - * @param address6 IP address. - * @param autostart Automatically start interface on boot. - * @param bond_mode Bonding mode. Enum: - * balance-rr,active-backup,balance-xor,broadcast,802.3ad,balance-tlb,balance-alb,balance-slb,lacp-balance-slb,lacp-balance-tcp - * @param bond_xmit_hash_policy Selects the transmit hash policy - * to use for slave selection in balance-xor and 802.3ad modes. - * Enum: layer2,layer2+3,layer3+4 - * @param bridge_ports Specify the interfaces you want to add to - * your bridge. - * @param bridge_vlan_aware Enable bridge vlan support. - * @param cidr IPv4 CIDR. - * @param cidr6 IPv6 CIDR. - * @param comments Comments - * @param comments6 Comments - * @param gateway Default gateway address. - * @param gateway6 Default ipv6 gateway address. - * @param netmask Network mask. - * @param netmask6 Network mask. - * @param ovs_bonds Specify the interfaces used by the bonding - * device. - * @param ovs_bridge The OVS bridge associated with a OVS port. - * This is required when you create an OVS port. - * @param ovs_options OVS interface options. - * @param ovs_ports Specify the interfaces you want to add to - * your bridge. - * @param ovs_tag Specify a VLan tag (used by OVSPort, - * OVSIntPort, OVSBond) - * @param slaves Specify the interfaces used by the bonding - * device. - * @return Result - * @throws JSONException - */ - public Result createNetwork(String iface, String type, String address, String address6, Boolean autostart, String bond_mode, String bond_xmit_hash_policy, String bridge_ports, Boolean bridge_vlan_aware, String cidr, String cidr6, String comments, String comments6, String gateway, String gateway6, String netmask, Integer netmask6, String ovs_bonds, String ovs_bridge, String ovs_options, String ovs_ports, Integer ovs_tag, String slaves) throws JSONException { - return createRest(iface, type, address, address6, autostart, bond_mode, bond_xmit_hash_policy, bridge_ports, bridge_vlan_aware, cidr, cidr6, comments, comments6, gateway, gateway6, netmask, netmask6, ovs_bonds, ovs_bridge, ovs_options, ovs_ports, ovs_tag, slaves); - } - - /** - * Create network device configuration - * - * @param iface Network interface name. - * @param type Network interface type Enum: - * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown - * @return Result - * @throws JSONException - */ - public Result createRest(String iface, String type) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("iface", iface); - parameters.put("type", type); - return _client.create("/nodes/" + _node + "/network", parameters); - } - - /** - * Create network device configuration - * - * @param iface Network interface name. - * @param type Network interface type Enum: - * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown - * @return Result - * @throws JSONException - */ - public Result createNetwork(String iface, String type) throws JSONException { - return createRest(iface, type); - } - - /** - * Reload network configuration - * - * @return Result - * @throws JSONException - */ - public Result setRest() throws JSONException { - return _client.set("/nodes/" + _node + "/network", null); - } - - /** - * Reload network configuration - * - * @return Result - * @throws JSONException - */ - public Result reloadNetworkConfig() throws JSONException { - return setRest(); - } - - } - - public class PVETasks { - - private final PveClient _client; - private final Object _node; - - protected PVETasks(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemUpid get(Object upid) { - return new PVEItemUpid(_client, _node, upid); - } - - public class PVEItemUpid { - - private final PveClient _client; - private final Object _node; - private final Object _upid; - - protected PVEItemUpid(PveClient client, Object node, Object upid) { - _client = client; - _node = node; - _upid = upid; - } - - private PVELog _log; - - public PVELog getLog() { - if (_log == null) { - _log = new PVELog(_client, _node, _upid); - } - - return _log; - } - private PVEStatus _status; - - public PVEStatus getStatus() { - if (_status == null) { - _status = new PVEStatus(_client, _node, _upid); - } - - return _status; - } - - public class PVELog { - - private final PveClient _client; - private final Object _node; - private final Object _upid; - - protected PVELog(PveClient client, Object node, Object upid) { - _client = client; - _node = node; - _upid = upid; - } - - /** - * Read task 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 + "/tasks/" + _upid + "/log", parameters); - } - - /** - * Read task log. - * - * @param limit - * @param start - * @return Result - * @throws JSONException - */ - public Result readTaskLog(Integer limit, Integer start) throws JSONException { - return getRest(limit, start); - } - - /** - * Read task log. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/tasks/" + _upid + "/log", null); - } - - /** - * Read task log. - * - * @return Result - * @throws JSONException - */ - public Result readTaskLog() throws JSONException { - return getRest(); - } - - } - - public class PVEStatus { - - private final PveClient _client; - private final Object _node; - private final Object _upid; - - protected PVEStatus(PveClient client, Object node, Object upid) { - _client = client; - _node = node; - _upid = upid; - } - - /** - * Read task status. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/tasks/" + _upid + "/status", null); - } - - /** - * Read task status. - * - * @return Result - * @throws JSONException - */ - public Result readTaskStatus() throws JSONException { - return getRest(); - } - - } - - /** - * Stop a task. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/tasks/" + _upid + "", null); - } - - /** - * Stop a task. - * - * @return Result - * @throws JSONException - */ - public Result stopTask() throws JSONException { - return deleteRest(); - } - - /** - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/tasks/" + _upid + "", null); - } - - /** - * - * @return Result - * @throws JSONException - */ - public Result upidIndex() throws JSONException { - return getRest(); - } - - } - - /** - * Read task list for one node (finished tasks). - * - * @param errors - * @param limit Only list this amount of tasks. - * @param source List archived, active or all tasks. Enum: - * archive,active,all - * @param start List tasks beginning from this offset. - * @param typefilter Only list tasks of this type (e.g., - * vzstart, vzdump). - * @param userfilter Only list tasks from this user. - * @param vmid Only list tasks for this VM. - * @return Result - * @throws JSONException - */ - public Result getRest(Boolean errors, Integer limit, String source, Integer start, String typefilter, String userfilter, Integer vmid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("errors", errors); - parameters.put("limit", limit); - parameters.put("source", source); - parameters.put("start", start); - parameters.put("typefilter", typefilter); - parameters.put("userfilter", userfilter); - parameters.put("vmid", vmid); - return _client.get("/nodes/" + _node + "/tasks", parameters); - } - - /** - * Read task list for one node (finished tasks). - * - * @param errors - * @param limit Only list this amount of tasks. - * @param source List archived, active or all tasks. Enum: - * archive,active,all - * @param start List tasks beginning from this offset. - * @param typefilter Only list tasks of this type (e.g., - * vzstart, vzdump). - * @param userfilter Only list tasks from this user. - * @param vmid Only list tasks for this VM. - * @return Result - * @throws JSONException - */ - public Result nodeTasks(Boolean errors, Integer limit, String source, Integer start, String typefilter, String userfilter, Integer vmid) throws JSONException { - return getRest(errors, limit, source, start, typefilter, userfilter, vmid); - } - - /** - * Read task list for one node (finished tasks). - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/tasks", null); - } - - /** - * Read task list for one node (finished tasks). - * - * @return Result - * @throws JSONException - */ - public Result nodeTasks() throws JSONException { - return getRest(); - } - - } - - public class PVEScan { - - private final PveClient _client; - private final Object _node; - - protected PVEScan(PveClient client, Object node) { - _client = client; - _node = node; - } - - private PVEZfs _zfs; - - public PVEZfs getZfs() { - if (_zfs == null) { - _zfs = new PVEZfs(_client, _node); - } - - return _zfs; - } - private PVENfs _nfs; - - public PVENfs getNfs() { - if (_nfs == null) { - _nfs = new PVENfs(_client, _node); - } - - return _nfs; - } - private PVECifs _cifs; - - public PVECifs getCifs() { - if (_cifs == null) { - _cifs = new PVECifs(_client, _node); - } - - return _cifs; - } - private PVEGlusterfs _glusterfs; - - public PVEGlusterfs getGlusterfs() { - if (_glusterfs == null) { - _glusterfs = new PVEGlusterfs(_client, _node); - } - - return _glusterfs; - } - private PVEIscsi _iscsi; - - public PVEIscsi getIscsi() { - if (_iscsi == null) { - _iscsi = new PVEIscsi(_client, _node); - } - - return _iscsi; - } - private PVELvm _lvm; - - public PVELvm getLvm() { - if (_lvm == null) { - _lvm = new PVELvm(_client, _node); - } - - return _lvm; - } - private PVELvmthin _lvmthin; - - public PVELvmthin getLvmthin() { - if (_lvmthin == null) { - _lvmthin = new PVELvmthin(_client, _node); - } - - return _lvmthin; - } - private PVEUsb _usb; - - public PVEUsb getUsb() { - if (_usb == null) { - _usb = new PVEUsb(_client, _node); - } - - return _usb; - } - - public class PVEZfs { - - private final PveClient _client; - private final Object _node; - - protected PVEZfs(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Scan zfs pool list on local node. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/scan/zfs", null); - } - - /** - * Scan zfs pool list on local node. - * - * @return Result - * @throws JSONException - */ - public Result zfsscan() throws JSONException { - return getRest(); - } - - } - - public class PVENfs { - - private final PveClient _client; - private final Object _node; - - protected PVENfs(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Scan remote NFS server. - * - * @param server The server address (name or IP). - * @return Result - * @throws JSONException - */ - public Result getRest(String server) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("server", server); - return _client.get("/nodes/" + _node + "/scan/nfs", parameters); - } - - /** - * Scan remote NFS server. - * - * @param server The server address (name or IP). - * @return Result - * @throws JSONException - */ - public Result nfsscan(String server) throws JSONException { - return getRest(server); - } - - } - - public class PVECifs { - - private final PveClient _client; - private final Object _node; - - protected PVECifs(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Scan remote CIFS server. - * - * @param server The server address (name or IP). - * @param domain SMB domain (Workgroup). - * @param password User password. - * @param username User name. - * @return Result - * @throws JSONException - */ - public Result getRest(String server, String domain, String password, String username) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("server", server); - parameters.put("domain", domain); - parameters.put("password", password); - parameters.put("username", username); - return _client.get("/nodes/" + _node + "/scan/cifs", parameters); - } - - /** - * Scan remote CIFS server. - * - * @param server The server address (name or IP). - * @param domain SMB domain (Workgroup). - * @param password User password. - * @param username User name. - * @return Result - * @throws JSONException - */ - public Result cifsscan(String server, String domain, String password, String username) throws JSONException { - return getRest(server, domain, password, username); - } - - /** - * Scan remote CIFS server. - * - * @param server The server address (name or IP). - * @return Result - * @throws JSONException - */ - public Result getRest(String server) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("server", server); - return _client.get("/nodes/" + _node + "/scan/cifs", parameters); - } - - /** - * Scan remote CIFS server. - * - * @param server The server address (name or IP). - * @return Result - * @throws JSONException - */ - public Result cifsscan(String server) throws JSONException { - return getRest(server); - } - - } - - public class PVEGlusterfs { - - private final PveClient _client; - private final Object _node; - - protected PVEGlusterfs(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Scan remote GlusterFS server. - * - * @param server The server address (name or IP). - * @return Result - * @throws JSONException - */ - public Result getRest(String server) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("server", server); - return _client.get("/nodes/" + _node + "/scan/glusterfs", parameters); - } - - /** - * Scan remote GlusterFS server. - * - * @param server The server address (name or IP). - * @return Result - * @throws JSONException - */ - public Result glusterfsscan(String server) throws JSONException { - return getRest(server); - } - - } - - public class PVEIscsi { - - private final PveClient _client; - private final Object _node; - - protected PVEIscsi(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Scan remote iSCSI server. - * - * @param portal The iSCSI portal (IP or DNS name with - * optional port). - * @return Result - * @throws JSONException - */ - public Result getRest(String portal) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("portal", portal); - return _client.get("/nodes/" + _node + "/scan/iscsi", parameters); - } - - /** - * Scan remote iSCSI server. - * - * @param portal The iSCSI portal (IP or DNS name with - * optional port). - * @return Result - * @throws JSONException - */ - public Result iscsiscan(String portal) throws JSONException { - return getRest(portal); - } - - } - - public class PVELvm { - - private final PveClient _client; - private final Object _node; - - protected PVELvm(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * List local LVM volume groups. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/scan/lvm", null); - } - - /** - * List local LVM volume groups. - * - * @return Result - * @throws JSONException - */ - public Result lvmscan() throws JSONException { - return getRest(); - } - - } - - public class PVELvmthin { - - private final PveClient _client; - private final Object _node; - - protected PVELvmthin(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * List local LVM Thin Pools. - * - * @param vg - * @return Result - * @throws JSONException - */ - public Result getRest(String vg) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("vg", vg); - return _client.get("/nodes/" + _node + "/scan/lvmthin", parameters); - } - - /** - * List local LVM Thin Pools. - * - * @param vg - * @return Result - * @throws JSONException - */ - public Result lvmthinscan(String vg) throws JSONException { - return getRest(vg); - } - - } - - public class PVEUsb { - - private final PveClient _client; - private final Object _node; - - protected PVEUsb(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * List local USB devices. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/scan/usb", null); - } - - /** - * List local USB devices. - * - * @return Result - * @throws JSONException - */ - public Result usbscan() throws JSONException { - return getRest(); - } - - } - - /** - * Index of available scan methods - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/scan", null); - } - - /** - * Index of available scan methods - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEHardware { - - private final PveClient _client; - private final Object _node; - - protected PVEHardware(PveClient client, Object node) { - _client = client; - _node = node; - } - - private PVEPci _pci; - - public PVEPci getPci() { - if (_pci == null) { - _pci = new PVEPci(_client, _node); - } - - return _pci; - } - - public class PVEPci { - - private final PveClient _client; - private final Object _node; - - protected PVEPci(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemPciid get(Object pciid) { - return new PVEItemPciid(_client, _node, pciid); - } - - public class PVEItemPciid { - - private final PveClient _client; - private final Object _node; - private final Object _pciid; - - protected PVEItemPciid(PveClient client, Object node, Object pciid) { - _client = client; - _node = node; - _pciid = pciid; - } - - private PVEMdev _mdev; - - public PVEMdev getMdev() { - if (_mdev == null) { - _mdev = new PVEMdev(_client, _node, _pciid); - } - - return _mdev; - } - - public class PVEMdev { - - private final PveClient _client; - private final Object _node; - private final Object _pciid; - - protected PVEMdev(PveClient client, Object node, Object pciid) { - _client = client; - _node = node; - _pciid = pciid; - } - - /** - * List mediated device types for given PCI device. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/hardware/pci/" + _pciid + "/mdev", null); - } - - /** - * List mediated device types for given PCI device. - * - * @return Result - * @throws JSONException - */ - public Result mdevscan() throws JSONException { - return getRest(); - } - - } - - /** - * Index of available pci methods - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/hardware/pci/" + _pciid + "", null); - } - - /** - * Index of available pci methods - * - * @return Result - * @throws JSONException - */ - public Result pciindex() throws JSONException { - return getRest(); - } - - } - - /** - * List local PCI devices. - * - * @param pci_class_blacklist A list of blacklisted PCI - * classes, which will not be returned. Following are - * filtered by default: Memory Controller (05), Bridge (06), - * Generic System Peripheral (08) and Processor (0b). - * @param verbose If disabled, does only print the PCI IDs. - * Otherwise, additional information like vendor and device - * will be returned. - * @return Result - * @throws JSONException - */ - public Result getRest(String pci_class_blacklist, Boolean verbose) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("pci-class-blacklist", pci_class_blacklist); - parameters.put("verbose", verbose); - return _client.get("/nodes/" + _node + "/hardware/pci", parameters); - } - - /** - * List local PCI devices. - * - * @param pci_class_blacklist A list of blacklisted PCI - * classes, which will not be returned. Following are - * filtered by default: Memory Controller (05), Bridge (06), - * Generic System Peripheral (08) and Processor (0b). - * @param verbose If disabled, does only print the PCI IDs. - * Otherwise, additional information like vendor and device - * will be returned. - * @return Result - * @throws JSONException - */ - public Result pciscan(String pci_class_blacklist, Boolean verbose) throws JSONException { - return getRest(pci_class_blacklist, verbose); - } - - /** - * List local PCI devices. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/hardware/pci", null); - } - - /** - * List local PCI devices. - * - * @return Result - * @throws JSONException - */ - public Result pciscan() throws JSONException { - return getRest(); - } - - } - - /** - * Index of hardware types - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/hardware", null); - } - - /** - * Index of hardware types - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEStorage { - - private final PveClient _client; - private final Object _node; - - protected PVEStorage(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemStorage get(Object storage) { - return new PVEItemStorage(_client, _node, storage); - } - - public class PVEItemStorage { - - private final PveClient _client; - private final Object _node; - private final Object _storage; - - protected PVEItemStorage(PveClient client, Object node, Object storage) { - _client = client; - _node = node; - _storage = storage; - } - - private PVEContent _content; - - public PVEContent getContent() { - if (_content == null) { - _content = new PVEContent(_client, _node, _storage); - } - - return _content; - } - private PVEStatus _status; - - public PVEStatus getStatus() { - if (_status == null) { - _status = new PVEStatus(_client, _node, _storage); - } - - return _status; - } - private PVERrd _rrd; - - public PVERrd getRrd() { - if (_rrd == null) { - _rrd = new PVERrd(_client, _node, _storage); - } - - return _rrd; - } - private PVERrddata _rrddata; - - public PVERrddata getRrddata() { - if (_rrddata == null) { - _rrddata = new PVERrddata(_client, _node, _storage); - } - - return _rrddata; - } - private PVEUpload _upload; - - public PVEUpload getUpload() { - if (_upload == null) { - _upload = new PVEUpload(_client, _node, _storage); - } - - return _upload; - } - - public class PVEContent { - - private final PveClient _client; - private final Object _node; - private final Object _storage; - - protected PVEContent(PveClient client, Object node, Object storage) { - _client = client; - _node = node; - _storage = storage; - } - - public PVEItemVolume get(Object volume) { - return new PVEItemVolume(_client, _node, _storage, volume); - } - - public class PVEItemVolume { - - private final PveClient _client; - private final Object _node; - private final Object _storage; - private final Object _volume; - - protected PVEItemVolume(PveClient client, Object node, Object storage, Object volume) { - _client = client; - _node = node; - _storage = storage; - _volume = volume; - } - - /** - * Delete volume - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/storage/" + _storage + "/content/" + _volume + "", null); - } - - /** - * Delete volume - * - * @return Result - * @throws JSONException - */ - public Result delete() throws JSONException { - return deleteRest(); - } - - /** - * Get volume attributes - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/storage/" + _storage + "/content/" + _volume + "", null); - } - - /** - * Get volume attributes - * - * @return Result - * @throws JSONException - */ - public Result info() throws JSONException { - return getRest(); - } - - /** - * Copy a volume. This is experimental code - do not - * use. - * - * @param target Target volume identifier - * @param target_node Target node. Default is local - * node. - * @return Result - * @throws JSONException - */ - public Result createRest(String target, String target_node) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("target", target); - parameters.put("target_node", target_node); - return _client.create("/nodes/" + _node + "/storage/" + _storage + "/content/" + _volume + "", parameters); - } - - /** - * Copy a volume. This is experimental code - do not - * use. - * - * @param target Target volume identifier - * @param target_node Target node. Default is local - * node. - * @return Result - * @throws JSONException - */ - public Result copy(String target, String target_node) throws JSONException { - return createRest(target, target_node); - } - - /** - * Copy a volume. This is experimental code - do not - * use. - * - * @param target Target volume identifier - * @return Result - * @throws JSONException - */ - public Result createRest(String target) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("target", target); - return _client.create("/nodes/" + _node + "/storage/" + _storage + "/content/" + _volume + "", parameters); - } - - /** - * Copy a volume. This is experimental code - do not - * use. - * - * @param target Target volume identifier - * @return Result - * @throws JSONException - */ - public Result copy(String target) throws JSONException { - return createRest(target); - } - - } - - /** - * List storage content. - * - * @param content Only list content of this type. - * @param vmid Only list images for this VM - * @return Result - * @throws JSONException - */ - public Result getRest(String content, Integer vmid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("content", content); - parameters.put("vmid", vmid); - return _client.get("/nodes/" + _node + "/storage/" + _storage + "/content", parameters); - } - - /** - * List storage content. - * - * @param content Only list content of this type. - * @param vmid Only list images for this VM - * @return Result - * @throws JSONException - */ - public Result index(String content, Integer vmid) throws JSONException { - return getRest(content, vmid); - } - - /** - * List storage content. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/storage/" + _storage + "/content", null); - } - - /** - * List storage content. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Allocate disk images. - * - * @param filename The name of the file to create. - * @param size Size in kilobyte (1024 bytes). Optional - * suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, - * 1024M) - * @param vmid Specify owner VM - * @param format Enum: raw,qcow2,subvol - * @return Result - * @throws JSONException - */ - public Result createRest(String filename, String size, int vmid, String format) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("filename", filename); - parameters.put("size", size); - parameters.put("vmid", vmid); - parameters.put("format", format); - return _client.create("/nodes/" + _node + "/storage/" + _storage + "/content", parameters); - } - - /** - * Allocate disk images. - * - * @param filename The name of the file to create. - * @param size Size in kilobyte (1024 bytes). Optional - * suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, - * 1024M) - * @param vmid Specify owner VM - * @param format Enum: raw,qcow2,subvol - * @return Result - * @throws JSONException - */ - public Result create(String filename, String size, int vmid, String format) throws JSONException { - return createRest(filename, size, vmid, format); - } - - /** - * Allocate disk images. - * - * @param filename The name of the file to create. - * @param size Size in kilobyte (1024 bytes). Optional - * suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, - * 1024M) - * @param vmid Specify owner VM - * @return Result - * @throws JSONException - */ - public Result createRest(String filename, String size, int vmid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("filename", filename); - parameters.put("size", size); - parameters.put("vmid", vmid); - return _client.create("/nodes/" + _node + "/storage/" + _storage + "/content", parameters); - } - - /** - * Allocate disk images. - * - * @param filename The name of the file to create. - * @param size Size in kilobyte (1024 bytes). Optional - * suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, - * 1024M) - * @param vmid Specify owner VM - * @return Result - * @throws JSONException - */ - public Result create(String filename, String size, int vmid) throws JSONException { - return createRest(filename, size, vmid); - } - - } - - public class PVEStatus { - - private final PveClient _client; - private final Object _node; - private final Object _storage; - - protected PVEStatus(PveClient client, Object node, Object storage) { - _client = client; - _node = node; - _storage = storage; - } - - /** - * Read storage status. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/storage/" + _storage + "/status", null); - } - - /** - * Read storage status. - * - * @return Result - * @throws JSONException - */ - public Result readStatus() throws JSONException { - return getRest(); - } - - } - - public class PVERrd { - - private final PveClient _client; - private final Object _node; - private final Object _storage; - - protected PVERrd(PveClient client, Object node, Object storage) { - _client = client; - _node = node; - _storage = storage; - } - - /** - * Read storage 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 + "/storage/" + _storage + "/rrd", parameters); - } - - /** - * Read storage 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 storage 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 + "/storage/" + _storage + "/rrd", parameters); - } - - /** - * Read storage 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 _storage; - - protected PVERrddata(PveClient client, Object node, Object storage) { - _client = client; - _node = node; - _storage = storage; - } - - /** - * Read storage 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 + "/storage/" + _storage + "/rrddata", parameters); - } - - /** - * Read storage 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 storage 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 + "/storage/" + _storage + "/rrddata", parameters); - } - - /** - * Read storage 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 PVEUpload { - - private final PveClient _client; - private final Object _node; - private final Object _storage; - - protected PVEUpload(PveClient client, Object node, Object storage) { - _client = client; - _node = node; - _storage = storage; - } - - /** - * Upload templates and ISO images. - * - * @param content Content type. - * @param filename The name of the file to create. - * @param tmpfilename The source file name. This - * parameter is usually set by the REST handler. You can - * only overwrite it when connecting to the trusted port - * on localhost. - * @return Result - * @throws JSONException - */ - public Result createRest(String content, String filename, String tmpfilename) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("content", content); - parameters.put("filename", filename); - parameters.put("tmpfilename", tmpfilename); - return _client.create("/nodes/" + _node + "/storage/" + _storage + "/upload", parameters); - } - - /** - * Upload templates and ISO images. - * - * @param content Content type. - * @param filename The name of the file to create. - * @param tmpfilename The source file name. This - * parameter is usually set by the REST handler. You can - * only overwrite it when connecting to the trusted port - * on localhost. - * @return Result - * @throws JSONException - */ - public Result upload(String content, String filename, String tmpfilename) throws JSONException { - return createRest(content, filename, tmpfilename); - } - - /** - * Upload templates and ISO images. - * - * @param content Content type. - * @param filename The name of the file to create. - * @return Result - * @throws JSONException - */ - public Result createRest(String content, String filename) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("content", content); - parameters.put("filename", filename); - return _client.create("/nodes/" + _node + "/storage/" + _storage + "/upload", parameters); - } - - /** - * Upload templates and ISO images. - * - * @param content Content type. - * @param filename The name of the file to create. - * @return Result - * @throws JSONException - */ - public Result upload(String content, String filename) throws JSONException { - return createRest(content, filename); - } - - } - - /** - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/storage/" + _storage + "", null); - } - - /** - * - * @return Result - * @throws JSONException - */ - public Result diridx() throws JSONException { - return getRest(); - } - - } - - /** - * Get status for all datastores. - * - * @param content Only list stores which support this content - * type. - * @param enabled Only list stores which are enabled (not - * disabled in config). - * @param format Include information about formats - * @param storage Only list status for specified storage - * @param target If target is different to 'node', we only lists - * shared storages which content is accessible on this 'node' - * and the specified 'target' node. - * @return Result - * @throws JSONException - */ - public Result getRest(String content, Boolean enabled, Boolean format, String storage, String target) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("content", content); - parameters.put("enabled", enabled); - parameters.put("format", format); - parameters.put("storage", storage); - parameters.put("target", target); - return _client.get("/nodes/" + _node + "/storage", parameters); - } - - /** - * Get status for all datastores. - * - * @param content Only list stores which support this content - * type. - * @param enabled Only list stores which are enabled (not - * disabled in config). - * @param format Include information about formats - * @param storage Only list status for specified storage - * @param target If target is different to 'node', we only lists - * shared storages which content is accessible on this 'node' - * and the specified 'target' node. - * @return Result - * @throws JSONException - */ - public Result index(String content, Boolean enabled, Boolean format, String storage, String target) throws JSONException { - return getRest(content, enabled, format, storage, target); - } - - /** - * Get status for all datastores. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/storage", null); - } - - /** - * Get status for all datastores. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEDisks { - - private final PveClient _client; - private final Object _node; - - protected PVEDisks(PveClient client, Object node) { - _client = client; - _node = node; - } - - private PVELvm _lvm; - - public PVELvm getLvm() { - if (_lvm == null) { - _lvm = new PVELvm(_client, _node); - } - - return _lvm; - } - private PVELvmthin _lvmthin; - - public PVELvmthin getLvmthin() { - if (_lvmthin == null) { - _lvmthin = new PVELvmthin(_client, _node); - } - - return _lvmthin; - } - private PVEDirectory _directory; - - public PVEDirectory getDirectory() { - if (_directory == null) { - _directory = new PVEDirectory(_client, _node); - } - - return _directory; - } - private PVEZfs _zfs; - - public PVEZfs getZfs() { - if (_zfs == null) { - _zfs = new PVEZfs(_client, _node); - } - - return _zfs; - } - private PVEList _list; - - public PVEList getList() { - if (_list == null) { - _list = new PVEList(_client, _node); - } - - return _list; - } - private PVESmart _smart; - - public PVESmart getSmart() { - if (_smart == null) { - _smart = new PVESmart(_client, _node); - } - - return _smart; - } - private PVEInitgpt _initgpt; - - public PVEInitgpt getInitgpt() { - if (_initgpt == null) { - _initgpt = new PVEInitgpt(_client, _node); - } - - return _initgpt; - } - - public class PVELvm { - - private final PveClient _client; - private final Object _node; - - protected PVELvm(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * List LVM Volume Groups - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/disks/lvm", null); - } - - /** - * List LVM Volume Groups - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create an LVM Volume Group - * - * @param device The block device you want to create the - * volume group on - * @param name The storage identifier. - * @param add_storage Configure storage using the Volume - * Group - * @return Result - * @throws JSONException - */ - public Result createRest(String device, String name, Boolean add_storage) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("device", device); - parameters.put("name", name); - parameters.put("add_storage", add_storage); - return _client.create("/nodes/" + _node + "/disks/lvm", parameters); - } - - /** - * Create an LVM Volume Group - * - * @param device The block device you want to create the - * volume group on - * @param name The storage identifier. - * @param add_storage Configure storage using the Volume - * Group - * @return Result - * @throws JSONException - */ - public Result create(String device, String name, Boolean add_storage) throws JSONException { - return createRest(device, name, add_storage); - } - - /** - * Create an LVM Volume Group - * - * @param device The block device you want to create the - * volume group on - * @param name The storage identifier. - * @return Result - * @throws JSONException - */ - public Result createRest(String device, String name) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("device", device); - parameters.put("name", name); - return _client.create("/nodes/" + _node + "/disks/lvm", parameters); - } - - /** - * Create an LVM Volume Group - * - * @param device The block device you want to create the - * volume group on - * @param name The storage identifier. - * @return Result - * @throws JSONException - */ - public Result create(String device, String name) throws JSONException { - return createRest(device, name); - } - - } - - public class PVELvmthin { - - private final PveClient _client; - private final Object _node; - - protected PVELvmthin(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * List LVM thinpools - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/disks/lvmthin", null); - } - - /** - * List LVM thinpools - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create an LVM thinpool - * - * @param device The block device you want to create the - * thinpool on. - * @param name The storage identifier. - * @param add_storage Configure storage using the thinpool. - * @return Result - * @throws JSONException - */ - public Result createRest(String device, String name, Boolean add_storage) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("device", device); - parameters.put("name", name); - parameters.put("add_storage", add_storage); - return _client.create("/nodes/" + _node + "/disks/lvmthin", parameters); - } - - /** - * Create an LVM thinpool - * - * @param device The block device you want to create the - * thinpool on. - * @param name The storage identifier. - * @param add_storage Configure storage using the thinpool. - * @return Result - * @throws JSONException - */ - public Result create(String device, String name, Boolean add_storage) throws JSONException { - return createRest(device, name, add_storage); - } - - /** - * Create an LVM thinpool - * - * @param device The block device you want to create the - * thinpool on. - * @param name The storage identifier. - * @return Result - * @throws JSONException - */ - public Result createRest(String device, String name) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("device", device); - parameters.put("name", name); - return _client.create("/nodes/" + _node + "/disks/lvmthin", parameters); - } - - /** - * Create an LVM thinpool - * - * @param device The block device you want to create the - * thinpool on. - * @param name The storage identifier. - * @return Result - * @throws JSONException - */ - public Result create(String device, String name) throws JSONException { - return createRest(device, name); - } - - } - - public class PVEDirectory { - - private final PveClient _client; - private final Object _node; - - protected PVEDirectory(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * PVE Managed Directory storages. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/disks/directory", null); - } - - /** - * PVE Managed Directory storages. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create a Filesystem on an unused disk. Will be mounted - * under '/mnt/pve/NAME'. - * - * @param device The block device you want to create the - * filesystem on. - * @param name The storage identifier. - * @param add_storage Configure storage using the directory. - * @param filesystem The desired filesystem. Enum: ext4,xfs - * @return Result - * @throws JSONException - */ - public Result createRest(String device, String name, Boolean add_storage, String filesystem) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("device", device); - parameters.put("name", name); - parameters.put("add_storage", add_storage); - parameters.put("filesystem", filesystem); - return _client.create("/nodes/" + _node + "/disks/directory", parameters); - } - - /** - * Create a Filesystem on an unused disk. Will be mounted - * under '/mnt/pve/NAME'. - * - * @param device The block device you want to create the - * filesystem on. - * @param name The storage identifier. - * @param add_storage Configure storage using the directory. - * @param filesystem The desired filesystem. Enum: ext4,xfs - * @return Result - * @throws JSONException - */ - public Result create(String device, String name, Boolean add_storage, String filesystem) throws JSONException { - return createRest(device, name, add_storage, filesystem); - } - - /** - * Create a Filesystem on an unused disk. Will be mounted - * under '/mnt/pve/NAME'. - * - * @param device The block device you want to create the - * filesystem on. - * @param name The storage identifier. - * @return Result - * @throws JSONException - */ - public Result createRest(String device, String name) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("device", device); - parameters.put("name", name); - return _client.create("/nodes/" + _node + "/disks/directory", parameters); - } - - /** - * Create a Filesystem on an unused disk. Will be mounted - * under '/mnt/pve/NAME'. - * - * @param device The block device you want to create the - * filesystem on. - * @param name The storage identifier. - * @return Result - * @throws JSONException - */ - public Result create(String device, String name) throws JSONException { - return createRest(device, name); - } - - } - - public class PVEZfs { - - private final PveClient _client; - private final Object _node; - - protected PVEZfs(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemName get(Object name) { - return new PVEItemName(_client, _node, name); - } - - public class PVEItemName { - - private final PveClient _client; - private final Object _node; - private final Object _name; - - protected PVEItemName(PveClient client, Object node, Object name) { - _client = client; - _node = node; - _name = name; - } - - /** - * Get details about a zpool. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/disks/zfs/" + _name + "", null); - } - - /** - * Get details about a zpool. - * - * @return Result - * @throws JSONException - */ - public Result detail() throws JSONException { - return getRest(); - } - - } - - /** - * List Zpools. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/disks/zfs", null); - } - - /** - * List Zpools. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create a ZFS pool. - * - * @param devices The block devices you want to create the - * zpool on. - * @param name The storage identifier. - * @param raidlevel The RAID level to use. Enum: - * single,mirror,raid10,raidz,raidz2,raidz3 - * @param add_storage Configure storage using the zpool. - * @param ashift Pool sector size exponent. - * @param compression The compression algorithm to use. - * Enum: on,off,gzip,lz4,lzjb,zle - * @return Result - * @throws JSONException - */ - public Result createRest(String devices, String name, String raidlevel, Boolean add_storage, Integer ashift, String compression) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("devices", devices); - parameters.put("name", name); - parameters.put("raidlevel", raidlevel); - parameters.put("add_storage", add_storage); - parameters.put("ashift", ashift); - parameters.put("compression", compression); - return _client.create("/nodes/" + _node + "/disks/zfs", parameters); - } - - /** - * Create a ZFS pool. - * - * @param devices The block devices you want to create the - * zpool on. - * @param name The storage identifier. - * @param raidlevel The RAID level to use. Enum: - * single,mirror,raid10,raidz,raidz2,raidz3 - * @param add_storage Configure storage using the zpool. - * @param ashift Pool sector size exponent. - * @param compression The compression algorithm to use. - * Enum: on,off,gzip,lz4,lzjb,zle - * @return Result - * @throws JSONException - */ - public Result create(String devices, String name, String raidlevel, Boolean add_storage, Integer ashift, String compression) throws JSONException { - return createRest(devices, name, raidlevel, add_storage, ashift, compression); - } - - /** - * Create a ZFS pool. - * - * @param devices The block devices you want to create the - * zpool on. - * @param name The storage identifier. - * @param raidlevel The RAID level to use. Enum: - * single,mirror,raid10,raidz,raidz2,raidz3 - * @return Result - * @throws JSONException - */ - public Result createRest(String devices, String name, String raidlevel) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("devices", devices); - parameters.put("name", name); - parameters.put("raidlevel", raidlevel); - return _client.create("/nodes/" + _node + "/disks/zfs", parameters); - } - - /** - * Create a ZFS pool. - * - * @param devices The block devices you want to create the - * zpool on. - * @param name The storage identifier. - * @param raidlevel The RAID level to use. Enum: - * single,mirror,raid10,raidz,raidz2,raidz3 - * @return Result - * @throws JSONException - */ - public Result create(String devices, String name, String raidlevel) throws JSONException { - return createRest(devices, name, raidlevel); - } - - } - - public class PVEList { - - private final PveClient _client; - private final Object _node; - - protected PVEList(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * List local disks. - * - * @param skipsmart Skip smart checks. - * @param type Only list specific types of disks. Enum: - * unused,journal_disks - * @return Result - * @throws JSONException - */ - public Result getRest(Boolean skipsmart, String type) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("skipsmart", skipsmart); - parameters.put("type", type); - return _client.get("/nodes/" + _node + "/disks/list", parameters); - } - - /** - * List local disks. - * - * @param skipsmart Skip smart checks. - * @param type Only list specific types of disks. Enum: - * unused,journal_disks - * @return Result - * @throws JSONException - */ - public Result list(Boolean skipsmart, String type) throws JSONException { - return getRest(skipsmart, type); - } - - /** - * List local disks. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/disks/list", null); - } - - /** - * List local disks. - * - * @return Result - * @throws JSONException - */ - public Result list() throws JSONException { - return getRest(); - } - - } - - public class PVESmart { - - private final PveClient _client; - private final Object _node; - - protected PVESmart(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get SMART Health of a disk. - * - * @param disk Block device name - * @param healthonly If true returns only the health status - * @return Result - * @throws JSONException - */ - public Result getRest(String disk, Boolean healthonly) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("disk", disk); - parameters.put("healthonly", healthonly); - return _client.get("/nodes/" + _node + "/disks/smart", parameters); - } - - /** - * Get SMART Health of a disk. - * - * @param disk Block device name - * @param healthonly If true returns only the health status - * @return Result - * @throws JSONException - */ - public Result smart(String disk, Boolean healthonly) throws JSONException { - return getRest(disk, healthonly); - } - - /** - * Get SMART Health of a disk. - * - * @param disk Block device name - * @return Result - * @throws JSONException - */ - public Result getRest(String disk) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("disk", disk); - return _client.get("/nodes/" + _node + "/disks/smart", parameters); - } - - /** - * Get SMART Health of a disk. - * - * @param disk Block device name - * @return Result - * @throws JSONException - */ - public Result smart(String disk) throws JSONException { - return getRest(disk); - } - - } - - public class PVEInitgpt { - - private final PveClient _client; - private final Object _node; - - protected PVEInitgpt(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Initialize Disk with GPT - * - * @param disk Block device name - * @param uuid UUID for the GPT table - * @return Result - * @throws JSONException - */ - public Result createRest(String disk, String uuid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("disk", disk); - parameters.put("uuid", uuid); - return _client.create("/nodes/" + _node + "/disks/initgpt", parameters); - } - - /** - * Initialize Disk with GPT - * - * @param disk Block device name - * @param uuid UUID for the GPT table - * @return Result - * @throws JSONException - */ - public Result initgpt(String disk, String uuid) throws JSONException { - return createRest(disk, uuid); - } - - /** - * Initialize Disk with GPT - * - * @param disk Block device name - * @return Result - * @throws JSONException - */ - public Result createRest(String disk) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("disk", disk); - return _client.create("/nodes/" + _node + "/disks/initgpt", parameters); - } - - /** - * Initialize Disk with GPT - * - * @param disk Block device name - * @return Result - * @throws JSONException - */ - public Result initgpt(String disk) throws JSONException { - return createRest(disk); - } - - } - - /** - * Node index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/disks", null); - } - - /** - * Node index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEApt { - - private final PveClient _client; - private final Object _node; - - protected PVEApt(PveClient client, Object node) { - _client = client; - _node = node; - } - - private PVEUpdate _update; - - public PVEUpdate getUpdate() { - if (_update == null) { - _update = new PVEUpdate(_client, _node); - } - - return _update; - } - private PVEChangelog _changelog; - - public PVEChangelog getChangelog() { - if (_changelog == null) { - _changelog = new PVEChangelog(_client, _node); - } - - return _changelog; - } - private PVEVersions _versions; - - public PVEVersions getVersions() { - if (_versions == null) { - _versions = new PVEVersions(_client, _node); - } - - return _versions; - } - - public class PVEUpdate { - - private final PveClient _client; - private final Object _node; - - protected PVEUpdate(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * List available updates. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/apt/update", null); - } - - /** - * List available updates. - * - * @return Result - * @throws JSONException - */ - public Result listUpdates() throws JSONException { - return getRest(); - } - - /** - * This is used to resynchronize the package index files - * from their sources (apt-get update). - * - * @param notify Send notification mail about new packages - * (to email address specified for user 'root@pam'). - * @param quiet Only produces output suitable for logging, - * omitting progress indicators. - * @return Result - * @throws JSONException - */ - public Result createRest(Boolean notify, Boolean quiet) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("notify", notify); - parameters.put("quiet", quiet); - return _client.create("/nodes/" + _node + "/apt/update", parameters); - } - - /** - * This is used to resynchronize the package index files - * from their sources (apt-get update). - * - * @param notify Send notification mail about new packages - * (to email address specified for user 'root@pam'). - * @param quiet Only produces output suitable for logging, - * omitting progress indicators. - * @return Result - * @throws JSONException - */ - public Result updateDatabase(Boolean notify, Boolean quiet) throws JSONException { - return createRest(notify, quiet); - } - - /** - * This is used to resynchronize the package index files - * from their sources (apt-get update). - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/apt/update", null); - } - - /** - * This is used to resynchronize the package index files - * from their sources (apt-get update). - * - * @return Result - * @throws JSONException - */ - public Result updateDatabase() throws JSONException { - return createRest(); - } - - } - - public class PVEChangelog { - - private final PveClient _client; - private final Object _node; - - protected PVEChangelog(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get package changelogs. - * - * @param name Package name. - * @param version Package version. - * @return Result - * @throws JSONException - */ - public Result getRest(String name, String version) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("name", name); - parameters.put("version", version); - return _client.get("/nodes/" + _node + "/apt/changelog", parameters); - } - - /** - * Get package changelogs. - * - * @param name Package name. - * @param version Package version. - * @return Result - * @throws JSONException - */ - public Result changelog(String name, String version) throws JSONException { - return getRest(name, version); - } - - /** - * Get package changelogs. - * - * @param name Package name. - * @return Result - * @throws JSONException - */ - public Result getRest(String name) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("name", name); - return _client.get("/nodes/" + _node + "/apt/changelog", parameters); - } - - /** - * Get package changelogs. - * - * @param name Package name. - * @return Result - * @throws JSONException - */ - public Result changelog(String name) throws JSONException { - return getRest(name); - } - - } - - public class PVEVersions { - - private final PveClient _client; - private final Object _node; - - protected PVEVersions(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get package information for important Proxmox packages. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/apt/versions", null); - } - - /** - * Get package information for important Proxmox packages. - * - * @return Result - * @throws JSONException - */ - public Result versions() throws JSONException { - return getRest(); - } - - } - - /** - * Directory index for apt (Advanced Package Tool). - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/apt", null); - } - - /** - * Directory index for apt (Advanced Package Tool). - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEFirewall { - - private final PveClient _client; - private final Object _node; - - protected PVEFirewall(PveClient client, Object node) { - _client = client; - _node = node; - } - - private PVERules _rules; - - public PVERules getRules() { - if (_rules == null) { - _rules = new PVERules(_client, _node); - } - - return _rules; - } - private PVEOptions _options; - - public PVEOptions getOptions() { - if (_options == null) { - _options = new PVEOptions(_client, _node); - } - - return _options; - } - private PVELog _log; - - public PVELog getLog() { - if (_log == null) { - _log = new PVELog(_client, _node); - } - - return _log; - } - - public class PVERules { - - private final PveClient _client; - private final Object _node; - - protected PVERules(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemPos get(Object pos) { - return new PVEItemPos(_client, _node, pos); - } - - public class PVEItemPos { - - private final PveClient _client; - private final Object _node; - private final Object _pos; - - protected PVEItemPos(PveClient client, Object node, Object pos) { - _client = client; - _node = node; - _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 + "/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 + "/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 + "/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 - * &lt;moveto&gt;. 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 + "/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 - * &lt;moveto&gt;. 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 + "/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 + "/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 &lt;pos&gt;. - * @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 + "/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 &lt;pos&gt;. - * @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 + "/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 PVEOptions { - - private final PveClient _client; - private final Object _node; - - protected PVEOptions(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get host firewall options. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/firewall/options", null); - } - - /** - * Get host 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 enable Enable host firewall rules. - * @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 log_nf_conntrack Enable logging of conntrack - * information. - * @param ndp Enable NDP. - * @param nf_conntrack_allow_invalid Allow invalid packets - * on connection tracking. - * @param nf_conntrack_max Maximum number of tracked - * connections. - * @param nf_conntrack_tcp_timeout_established Conntrack - * established timeout. - * @param nosmurfs Enable SMURFS filter. - * @param smurf_log_level Log level for SMURFS filter. Enum: - * emerg,alert,crit,err,warning,notice,info,debug,nolog - * @param tcp_flags_log_level Log level for illegal tcp - * flags filter. Enum: - * emerg,alert,crit,err,warning,notice,info,debug,nolog - * @param tcpflags Filter illegal combinations of TCP flags. - * @return Result - * @throws JSONException - */ - public Result setRest(String delete, String digest, Boolean enable, String log_level_in, String log_level_out, Boolean log_nf_conntrack, Boolean ndp, Boolean nf_conntrack_allow_invalid, Integer nf_conntrack_max, Integer nf_conntrack_tcp_timeout_established, Boolean nosmurfs, String smurf_log_level, String tcp_flags_log_level, Boolean tcpflags) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("delete", delete); - parameters.put("digest", digest); - parameters.put("enable", enable); - parameters.put("log_level_in", log_level_in); - parameters.put("log_level_out", log_level_out); - parameters.put("log_nf_conntrack", log_nf_conntrack); - parameters.put("ndp", ndp); - parameters.put("nf_conntrack_allow_invalid", nf_conntrack_allow_invalid); - parameters.put("nf_conntrack_max", nf_conntrack_max); - parameters.put("nf_conntrack_tcp_timeout_established", nf_conntrack_tcp_timeout_established); - parameters.put("nosmurfs", nosmurfs); - parameters.put("smurf_log_level", smurf_log_level); - parameters.put("tcp_flags_log_level", tcp_flags_log_level); - parameters.put("tcpflags", tcpflags); - return _client.set("/nodes/" + _node + "/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 enable Enable host firewall rules. - * @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 log_nf_conntrack Enable logging of conntrack - * information. - * @param ndp Enable NDP. - * @param nf_conntrack_allow_invalid Allow invalid packets - * on connection tracking. - * @param nf_conntrack_max Maximum number of tracked - * connections. - * @param nf_conntrack_tcp_timeout_established Conntrack - * established timeout. - * @param nosmurfs Enable SMURFS filter. - * @param smurf_log_level Log level for SMURFS filter. Enum: - * emerg,alert,crit,err,warning,notice,info,debug,nolog - * @param tcp_flags_log_level Log level for illegal tcp - * flags filter. Enum: - * emerg,alert,crit,err,warning,notice,info,debug,nolog - * @param tcpflags Filter illegal combinations of TCP flags. - * @return Result - * @throws JSONException - */ - public Result setOptions(String delete, String digest, Boolean enable, String log_level_in, String log_level_out, Boolean log_nf_conntrack, Boolean ndp, Boolean nf_conntrack_allow_invalid, Integer nf_conntrack_max, Integer nf_conntrack_tcp_timeout_established, Boolean nosmurfs, String smurf_log_level, String tcp_flags_log_level, Boolean tcpflags) throws JSONException { - return setRest(delete, digest, enable, log_level_in, log_level_out, log_nf_conntrack, ndp, nf_conntrack_allow_invalid, nf_conntrack_max, nf_conntrack_tcp_timeout_established, nosmurfs, smurf_log_level, tcp_flags_log_level, tcpflags); - } - - /** - * Set Firewall options. - * - * @return Result - * @throws JSONException - */ - public Result setRest() throws JSONException { - return _client.set("/nodes/" + _node + "/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; - - protected PVELog(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * 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 + "/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 + "/firewall/log", null); - } - - /** - * Read firewall log - * - * @return Result - * @throws JSONException - */ - public Result log() throws JSONException { - return getRest(); - } - - } - - /** - * Directory index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/firewall", null); - } - - /** - * Directory index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEReplication { - - private final PveClient _client; - private final Object _node; - - protected PVEReplication(PveClient client, Object node) { - _client = client; - _node = node; - } - - public PVEItemId get(Object id) { - return new PVEItemId(_client, _node, id); - } - - public class PVEItemId { - - private final PveClient _client; - private final Object _node; - private final Object _id; - - protected PVEItemId(PveClient client, Object node, Object id) { - _client = client; - _node = node; - _id = id; - } - - private PVEStatus _status; - - public PVEStatus getStatus() { - if (_status == null) { - _status = new PVEStatus(_client, _node, _id); - } - - return _status; - } - private PVELog _log; - - public PVELog getLog() { - if (_log == null) { - _log = new PVELog(_client, _node, _id); - } - - return _log; - } - private PVEScheduleNow _scheduleNow; - - public PVEScheduleNow getScheduleNow() { - if (_scheduleNow == null) { - _scheduleNow = new PVEScheduleNow(_client, _node, _id); - } - - return _scheduleNow; - } - - public class PVEStatus { - - private final PveClient _client; - private final Object _node; - private final Object _id; - - protected PVEStatus(PveClient client, Object node, Object id) { - _client = client; - _node = node; - _id = id; - } - - /** - * Get replication job status. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/replication/" + _id + "/status", null); - } - - /** - * Get replication job status. - * - * @return Result - * @throws JSONException - */ - public Result jobStatus() throws JSONException { - return getRest(); - } - - } - - public class PVELog { - - private final PveClient _client; - private final Object _node; - private final Object _id; - - protected PVELog(PveClient client, Object node, Object id) { - _client = client; - _node = node; - _id = id; - } - - /** - * Read replication job 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 + "/replication/" + _id + "/log", parameters); - } - - /** - * Read replication job log. - * - * @param limit - * @param start - * @return Result - * @throws JSONException - */ - public Result readJobLog(Integer limit, Integer start) throws JSONException { - return getRest(limit, start); - } - - /** - * Read replication job log. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/replication/" + _id + "/log", null); - } - - /** - * Read replication job log. - * - * @return Result - * @throws JSONException - */ - public Result readJobLog() throws JSONException { - return getRest(); - } - - } - - public class PVEScheduleNow { - - private final PveClient _client; - private final Object _node; - private final Object _id; - - protected PVEScheduleNow(PveClient client, Object node, Object id) { - _client = client; - _node = node; - _id = id; - } - - /** - * Schedule replication job to start as soon as - * possible. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/replication/" + _id + "/schedule_now", null); - } - - /** - * Schedule replication job to start as soon as - * possible. - * - * @return Result - * @throws JSONException - */ - public Result scheduleNow() throws JSONException { - return createRest(); - } - - } - - /** - * Directory index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/replication/" + _id + "", null); - } - - /** - * Directory index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - /** - * List status of all replication jobs on this node. - * - * @param guest Only list replication jobs for this guest. - * @return Result - * @throws JSONException - */ - public Result getRest(Integer guest) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("guest", guest); - return _client.get("/nodes/" + _node + "/replication", parameters); - } - - /** - * List status of all replication jobs on this node. - * - * @param guest Only list replication jobs for this guest. - * @return Result - * @throws JSONException - */ - public Result status(Integer guest) throws JSONException { - return getRest(guest); - } - - /** - * List status of all replication jobs on this node. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/replication", null); - } - - /** - * List status of all replication jobs on this node. - * - * @return Result - * @throws JSONException - */ - public Result status() throws JSONException { - return getRest(); - } - - } - - public class PVECertificates { - - private final PveClient _client; - private final Object _node; - - protected PVECertificates(PveClient client, Object node) { - _client = client; - _node = node; - } - - private PVEAcme _acme; - - public PVEAcme getAcme() { - if (_acme == null) { - _acme = new PVEAcme(_client, _node); - } - - return _acme; - } - private PVEInfo _info; - - public PVEInfo getInfo() { - if (_info == null) { - _info = new PVEInfo(_client, _node); - } - - return _info; - } - private PVECustom _custom; - - public PVECustom getCustom() { - if (_custom == null) { - _custom = new PVECustom(_client, _node); - } - - return _custom; - } - - public class PVEAcme { - - private final PveClient _client; - private final Object _node; - - protected PVEAcme(PveClient client, Object node) { - _client = client; - _node = node; - } - - private PVECertificate _certificate; - - public PVECertificate getCertificate() { - if (_certificate == null) { - _certificate = new PVECertificate(_client, _node); - } - - return _certificate; - } - - public class PVECertificate { - - private final PveClient _client; - private final Object _node; - - protected PVECertificate(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Revoke existing certificate from CA. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/certificates/acme/certificate", null); - } - - /** - * Revoke existing certificate from CA. - * - * @return Result - * @throws JSONException - */ - public Result revokeCertificate() throws JSONException { - return deleteRest(); - } - - /** - * Order a new certificate from ACME-compatible CA. - * - * @param force Overwrite existing custom certificate. - * @return Result - * @throws JSONException - */ - public Result createRest(Boolean force) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("force", force); - return _client.create("/nodes/" + _node + "/certificates/acme/certificate", parameters); - } - - /** - * Order a new certificate from ACME-compatible CA. - * - * @param force Overwrite existing custom certificate. - * @return Result - * @throws JSONException - */ - public Result newCertificate(Boolean force) throws JSONException { - return createRest(force); - } - - /** - * Order a new certificate from ACME-compatible CA. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/certificates/acme/certificate", null); - } - - /** - * Order a new certificate from ACME-compatible CA. - * - * @return Result - * @throws JSONException - */ - public Result newCertificate() throws JSONException { - return createRest(); - } - - /** - * Renew existing certificate from CA. - * - * @param force Force renewal even if expiry is more - * than 30 days away. - * @return Result - * @throws JSONException - */ - public Result setRest(Boolean force) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("force", force); - return _client.set("/nodes/" + _node + "/certificates/acme/certificate", parameters); - } - - /** - * Renew existing certificate from CA. - * - * @param force Force renewal even if expiry is more - * than 30 days away. - * @return Result - * @throws JSONException - */ - public Result renewCertificate(Boolean force) throws JSONException { - return setRest(force); - } - - /** - * Renew existing certificate from CA. - * - * @return Result - * @throws JSONException - */ - public Result setRest() throws JSONException { - return _client.set("/nodes/" + _node + "/certificates/acme/certificate", null); - } - - /** - * Renew existing certificate from CA. - * - * @return Result - * @throws JSONException - */ - public Result renewCertificate() throws JSONException { - return setRest(); - } - - } - - /** - * ACME index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/certificates/acme", null); - } - - /** - * ACME index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEInfo { - - private final PveClient _client; - private final Object _node; - - protected PVEInfo(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get information about node's certificates. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/certificates/info", null); - } - - /** - * Get information about node's certificates. - * - * @return Result - * @throws JSONException - */ - public Result info() throws JSONException { - return getRest(); - } - - } - - public class PVECustom { - - private final PveClient _client; - private final Object _node; - - protected PVECustom(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * DELETE custom certificate chain and key. - * - * @param restart Restart pveproxy. - * @return Result - * @throws JSONException - */ - public Result deleteRest(Boolean restart) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("restart", restart); - return _client.delete("/nodes/" + _node + "/certificates/custom", parameters); - } - - /** - * DELETE custom certificate chain and key. - * - * @param restart Restart pveproxy. - * @return Result - * @throws JSONException - */ - public Result removeCustomCert(Boolean restart) throws JSONException { - return deleteRest(restart); - } - - /** - * DELETE custom certificate chain and key. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/nodes/" + _node + "/certificates/custom", null); - } - - /** - * DELETE custom certificate chain and key. - * - * @return Result - * @throws JSONException - */ - public Result removeCustomCert() throws JSONException { - return deleteRest(); - } - - /** - * Upload or update custom certificate chain and key. - * - * @param certificates PEM encoded certificate (chain). - * @param force Overwrite existing custom or ACME - * certificate files. - * @param key PEM encoded private key. - * @param restart Restart pveproxy. - * @return Result - * @throws JSONException - */ - public Result createRest(String certificates, Boolean force, String key, Boolean restart) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("certificates", certificates); - parameters.put("force", force); - parameters.put("key", key); - parameters.put("restart", restart); - return _client.create("/nodes/" + _node + "/certificates/custom", parameters); - } - - /** - * Upload or update custom certificate chain and key. - * - * @param certificates PEM encoded certificate (chain). - * @param force Overwrite existing custom or ACME - * certificate files. - * @param key PEM encoded private key. - * @param restart Restart pveproxy. - * @return Result - * @throws JSONException - */ - public Result uploadCustomCert(String certificates, Boolean force, String key, Boolean restart) throws JSONException { - return createRest(certificates, force, key, restart); - } - - /** - * Upload or update custom certificate chain and key. - * - * @param certificates PEM encoded certificate (chain). - * @return Result - * @throws JSONException - */ - public Result createRest(String certificates) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("certificates", certificates); - return _client.create("/nodes/" + _node + "/certificates/custom", parameters); - } - - /** - * Upload or update custom certificate chain and key. - * - * @param certificates PEM encoded certificate (chain). - * @return Result - * @throws JSONException - */ - public Result uploadCustomCert(String certificates) throws JSONException { - return createRest(certificates); - } - - } - - /** - * Node index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/certificates", null); - } - - /** - * Node index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEConfig { - - private final PveClient _client; - private final Object _node; - - protected PVEConfig(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get node configuration options. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/config", null); - } - - /** - * Get node configuration options. - * - * @return Result - * @throws JSONException - */ - public Result getConfig() throws JSONException { - return getRest(); - } - - /** - * Set node configuration options. - * - * @param acme Node specific ACME settings. - * @param delete A list of settings you want to delete. - * @param description Node description/comment. - * @param digest Prevent changes if current configuration file - * has different SHA1 digest. This can be used to prevent - * concurrent modifications. - * @param wakeonlan MAC address for wake on LAN - * @return Result - * @throws JSONException - */ - public Result setRest(String acme, String delete, String description, String digest, String wakeonlan) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("acme", acme); - parameters.put("delete", delete); - parameters.put("description", description); - parameters.put("digest", digest); - parameters.put("wakeonlan", wakeonlan); - return _client.set("/nodes/" + _node + "/config", parameters); - } - - /** - * Set node configuration options. - * - * @param acme Node specific ACME settings. - * @param delete A list of settings you want to delete. - * @param description Node description/comment. - * @param digest Prevent changes if current configuration file - * has different SHA1 digest. This can be used to prevent - * concurrent modifications. - * @param wakeonlan MAC address for wake on LAN - * @return Result - * @throws JSONException - */ - public Result setOptions(String acme, String delete, String description, String digest, String wakeonlan) throws JSONException { - return setRest(acme, delete, description, digest, wakeonlan); - } - - /** - * Set node configuration options. - * - * @return Result - * @throws JSONException - */ - public Result setRest() throws JSONException { - return _client.set("/nodes/" + _node + "/config", null); - } - - /** - * Set node configuration options. - * - * @return Result - * @throws JSONException - */ - public Result setOptions() throws JSONException { - return setRest(); - } - - } - - public class PVEVersion { - - private final PveClient _client; - private final Object _node; - - protected PVEVersion(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * API version details - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/version", null); - } - - /** - * API version details - * - * @return Result - * @throws JSONException - */ - public Result version() throws JSONException { - return getRest(); - } - - } - - public class PVEStatus { - - private final PveClient _client; - private final Object _node; - - protected PVEStatus(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Read node status - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/status", null); - } - - /** - * Read node status - * - * @return Result - * @throws JSONException - */ - public Result status() throws JSONException { - return getRest(); - } - - /** - * Reboot or shutdown a node. - * - * @param command Specify the command. Enum: reboot,shutdown - * @return Result - * @throws JSONException - */ - public Result createRest(String command) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("command", command); - return _client.create("/nodes/" + _node + "/status", parameters); - } - - /** - * Reboot or shutdown a node. - * - * @param command Specify the command. Enum: reboot,shutdown - * @return Result - * @throws JSONException - */ - public Result nodeCmd(String command) throws JSONException { - return createRest(command); - } - - } - - public class PVENetstat { - - private final PveClient _client; - private final Object _node; - - protected PVENetstat(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Read tap/vm network device interface counters - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/netstat", null); - } - - /** - * Read tap/vm network device interface counters - * - * @return Result - * @throws JSONException - */ - public Result netstat() throws JSONException { - return getRest(); - } - - } - - public class PVEExecute { - - private final PveClient _client; - private final Object _node; - - protected PVEExecute(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Execute multiple commands in order. - * - * @param commands JSON encoded array of commands. - * @return Result - * @throws JSONException - */ - public Result createRest(String commands) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("commands", commands); - return _client.create("/nodes/" + _node + "/execute", parameters); - } - - /** - * Execute multiple commands in order. - * - * @param commands JSON encoded array of commands. - * @return Result - * @throws JSONException - */ - public Result execute(String commands) throws JSONException { - return createRest(commands); - } - - } - - public class PVEWakeonlan { - - private final PveClient _client; - private final Object _node; - - protected PVEWakeonlan(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Try to wake a node via 'wake on LAN' network packet. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/wakeonlan", null); - } - - /** - * Try to wake a node via 'wake on LAN' network packet. - * - * @return Result - * @throws JSONException - */ - public Result wakeonlan() throws JSONException { - return createRest(); - } - - } - - public class PVERrd { - - private final PveClient _client; - private final Object _node; - - protected PVERrd(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Read node 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 + "/rrd", parameters); - } - - /** - * Read node 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 node 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 + "/rrd", parameters); - } - - /** - * Read node 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; - - protected PVERrddata(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Read node 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 + "/rrddata", parameters); - } - - /** - * Read node 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 node 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 + "/rrddata", parameters); - } - - /** - * Read node 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 PVESyslog { - - private final PveClient _client; - private final Object _node; - - protected PVESyslog(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Read system log - * - * @param limit - * @param service Service ID - * @param since Display all log since this date-time string. - * @param start - * @param until Display all log until this date-time string. - * @return Result - * @throws JSONException - */ - public Result getRest(Integer limit, String service, String since, Integer start, String until) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("limit", limit); - parameters.put("service", service); - parameters.put("since", since); - parameters.put("start", start); - parameters.put("until", until); - return _client.get("/nodes/" + _node + "/syslog", parameters); - } - - /** - * Read system log - * - * @param limit - * @param service Service ID - * @param since Display all log since this date-time string. - * @param start - * @param until Display all log until this date-time string. - * @return Result - * @throws JSONException - */ - public Result syslog(Integer limit, String service, String since, Integer start, String until) throws JSONException { - return getRest(limit, service, since, start, until); - } - - /** - * Read system log - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/syslog", null); - } - - /** - * Read system log - * - * @return Result - * @throws JSONException - */ - public Result syslog() throws JSONException { - return getRest(); - } - - } - - public class PVEJournal { - - private final PveClient _client; - private final Object _node; - - protected PVEJournal(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Read Journal - * - * @param endcursor End before the given Cursor. Conflicts with - * 'until' - * @param lastentries Limit to the last X lines. Conflicts with - * a range. - * @param since Display all log since this UNIX epoch. Conflicts - * with 'startcursor'. - * @param startcursor Start after the given Cursor. Conflicts - * with 'since' - * @param until Display all log until this UNIX epoch. Conflicts - * with 'endcursor'. - * @return Result - * @throws JSONException - */ - public Result getRest(String endcursor, Integer lastentries, Integer since, String startcursor, Integer until) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("endcursor", endcursor); - parameters.put("lastentries", lastentries); - parameters.put("since", since); - parameters.put("startcursor", startcursor); - parameters.put("until", until); - return _client.get("/nodes/" + _node + "/journal", parameters); - } - - /** - * Read Journal - * - * @param endcursor End before the given Cursor. Conflicts with - * 'until' - * @param lastentries Limit to the last X lines. Conflicts with - * a range. - * @param since Display all log since this UNIX epoch. Conflicts - * with 'startcursor'. - * @param startcursor Start after the given Cursor. Conflicts - * with 'since' - * @param until Display all log until this UNIX epoch. Conflicts - * with 'endcursor'. - * @return Result - * @throws JSONException - */ - public Result journal(String endcursor, Integer lastentries, Integer since, String startcursor, Integer until) throws JSONException { - return getRest(endcursor, lastentries, since, startcursor, until); - } - - /** - * Read Journal - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/journal", null); - } - - /** - * Read Journal - * - * @return Result - * @throws JSONException - */ - public Result journal() throws JSONException { - return getRest(); - } - - } - - public class PVEVncshell { - - private final PveClient _client; - private final Object _node; - - protected PVEVncshell(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Creates a VNC Shell proxy. - * - * @param cmd Run specific command or default to login. Enum: - * upgrade,ceph_install,login - * @param height sets the height of the console in pixels. - * @param upgrade Deprecated, use the 'cmd' property instead! - * Run 'apt-get dist-upgrade' instead of normal shell. - * @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(String cmd, Integer height, Boolean upgrade, Boolean websocket, Integer width) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("cmd", cmd); - parameters.put("height", height); - parameters.put("upgrade", upgrade); - parameters.put("websocket", websocket); - parameters.put("width", width); - return _client.create("/nodes/" + _node + "/vncshell", parameters); - } - - /** - * Creates a VNC Shell proxy. - * - * @param cmd Run specific command or default to login. Enum: - * upgrade,ceph_install,login - * @param height sets the height of the console in pixels. - * @param upgrade Deprecated, use the 'cmd' property instead! - * Run 'apt-get dist-upgrade' instead of normal shell. - * @param websocket use websocket instead of standard vnc. - * @param width sets the width of the console in pixels. - * @return Result - * @throws JSONException - */ - public Result vncshell(String cmd, Integer height, Boolean upgrade, Boolean websocket, Integer width) throws JSONException { - return createRest(cmd, height, upgrade, websocket, width); - } - - /** - * Creates a VNC Shell proxy. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/vncshell", null); - } - - /** - * Creates a VNC Shell proxy. - * - * @return Result - * @throws JSONException - */ - public Result vncshell() throws JSONException { - return createRest(); - } - - } - - public class PVETermproxy { - - private final PveClient _client; - private final Object _node; - - protected PVETermproxy(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Creates a VNC Shell proxy. - * - * @param cmd Run specific command or default to login. Enum: - * upgrade,ceph_install,login - * @param upgrade Deprecated, use the 'cmd' property instead! - * Run 'apt-get dist-upgrade' instead of normal shell. - * @return Result - * @throws JSONException - */ - public Result createRest(String cmd, Boolean upgrade) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("cmd", cmd); - parameters.put("upgrade", upgrade); - return _client.create("/nodes/" + _node + "/termproxy", parameters); - } - - /** - * Creates a VNC Shell proxy. - * - * @param cmd Run specific command or default to login. Enum: - * upgrade,ceph_install,login - * @param upgrade Deprecated, use the 'cmd' property instead! - * Run 'apt-get dist-upgrade' instead of normal shell. - * @return Result - * @throws JSONException - */ - public Result termproxy(String cmd, Boolean upgrade) throws JSONException { - return createRest(cmd, upgrade); - } - - /** - * Creates a VNC Shell proxy. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/termproxy", null); - } - - /** - * Creates a VNC Shell proxy. - * - * @return Result - * @throws JSONException - */ - public Result termproxy() throws JSONException { - return createRest(); - } - - } - - public class PVEVncwebsocket { - - private final PveClient _client; - private final Object _node; - - protected PVEVncwebsocket(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * 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 + "/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 PVESpiceshell { - - private final PveClient _client; - private final Object _node; - - protected PVESpiceshell(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Creates a SPICE shell. - * - * @param cmd Run specific command or default to login. Enum: - * upgrade,ceph_install,login - * @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). - * @param upgrade Deprecated, use the 'cmd' property instead! - * Run 'apt-get dist-upgrade' instead of normal shell. - * @return Result - * @throws JSONException - */ - public Result createRest(String cmd, String proxy, Boolean upgrade) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("cmd", cmd); - parameters.put("proxy", proxy); - parameters.put("upgrade", upgrade); - return _client.create("/nodes/" + _node + "/spiceshell", parameters); - } - - /** - * Creates a SPICE shell. - * - * @param cmd Run specific command or default to login. Enum: - * upgrade,ceph_install,login - * @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). - * @param upgrade Deprecated, use the 'cmd' property instead! - * Run 'apt-get dist-upgrade' instead of normal shell. - * @return Result - * @throws JSONException - */ - public Result spiceshell(String cmd, String proxy, Boolean upgrade) throws JSONException { - return createRest(cmd, proxy, upgrade); - } - - /** - * Creates a SPICE shell. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/spiceshell", null); - } - - /** - * Creates a SPICE shell. - * - * @return Result - * @throws JSONException - */ - public Result spiceshell() throws JSONException { - return createRest(); - } - - } - - public class PVEDns { - - private final PveClient _client; - private final Object _node; - - protected PVEDns(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Read DNS settings. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/dns", null); - } - - /** - * Read DNS settings. - * - * @return Result - * @throws JSONException - */ - public Result dns() throws JSONException { - return getRest(); - } - - /** - * Write DNS settings. - * - * @param search Search domain for host-name lookup. - * @param dns1 First name server IP address. - * @param dns2 Second name server IP address. - * @param dns3 Third name server IP address. - * @return Result - * @throws JSONException - */ - public Result setRest(String search, String dns1, String dns2, String dns3) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("search", search); - parameters.put("dns1", dns1); - parameters.put("dns2", dns2); - parameters.put("dns3", dns3); - return _client.set("/nodes/" + _node + "/dns", parameters); - } - - /** - * Write DNS settings. - * - * @param search Search domain for host-name lookup. - * @param dns1 First name server IP address. - * @param dns2 Second name server IP address. - * @param dns3 Third name server IP address. - * @return Result - * @throws JSONException - */ - public Result updateDns(String search, String dns1, String dns2, String dns3) throws JSONException { - return setRest(search, dns1, dns2, dns3); - } - - /** - * Write DNS settings. - * - * @param search Search domain for host-name lookup. - * @return Result - * @throws JSONException - */ - public Result setRest(String search) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("search", search); - return _client.set("/nodes/" + _node + "/dns", parameters); - } - - /** - * Write DNS settings. - * - * @param search Search domain for host-name lookup. - * @return Result - * @throws JSONException - */ - public Result updateDns(String search) throws JSONException { - return setRest(search); - } - - } - - public class PVETime { - - private final PveClient _client; - private final Object _node; - - protected PVETime(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Read server time and time zone settings. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/time", null); - } - - /** - * Read server time and time zone settings. - * - * @return Result - * @throws JSONException - */ - public Result time() throws JSONException { - return getRest(); - } - - /** - * Set time zone. - * - * @param timezone Time zone. The file - * '/usr/share/zoneinfo/zone.tab' contains the list of valid - * names. - * @return Result - * @throws JSONException - */ - public Result setRest(String timezone) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("timezone", timezone); - return _client.set("/nodes/" + _node + "/time", parameters); - } - - /** - * Set time zone. - * - * @param timezone Time zone. The file - * '/usr/share/zoneinfo/zone.tab' contains the list of valid - * names. - * @return Result - * @throws JSONException - */ - public Result setTimezone(String timezone) throws JSONException { - return setRest(timezone); - } - - } - - public class PVEAplinfo { - - private final PveClient _client; - private final Object _node; - - protected PVEAplinfo(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get list of appliances. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/aplinfo", null); - } - - /** - * Get list of appliances. - * - * @return Result - * @throws JSONException - */ - public Result aplinfo() throws JSONException { - return getRest(); - } - - /** - * Download appliance templates. - * - * @param storage The storage where the template will be stored - * @param template The template which will downloaded - * @return Result - * @throws JSONException - */ - public Result createRest(String storage, String template) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("storage", storage); - parameters.put("template", template); - return _client.create("/nodes/" + _node + "/aplinfo", parameters); - } - - /** - * Download appliance templates. - * - * @param storage The storage where the template will be stored - * @param template The template which will downloaded - * @return Result - * @throws JSONException - */ - public Result aplDownload(String storage, String template) throws JSONException { - return createRest(storage, template); - } - - } - - public class PVEReport { - - private final PveClient _client; - private final Object _node; - - protected PVEReport(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Gather various systems information about a node - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/report", null); - } - - /** - * Gather various systems information about a node - * - * @return Result - * @throws JSONException - */ - public Result report() throws JSONException { - return getRest(); - } - - } - - public class PVEStartall { - - private final PveClient _client; - private final Object _node; - - protected PVEStartall(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Start all VMs and containers (when onboot=1). - * - * @param force force if onboot=0. - * @param vms Only consider Guests with these IDs. - * @return Result - * @throws JSONException - */ - public Result createRest(Boolean force, String vms) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("force", force); - parameters.put("vms", vms); - return _client.create("/nodes/" + _node + "/startall", parameters); - } - - /** - * Start all VMs and containers (when onboot=1). - * - * @param force force if onboot=0. - * @param vms Only consider Guests with these IDs. - * @return Result - * @throws JSONException - */ - public Result startall(Boolean force, String vms) throws JSONException { - return createRest(force, vms); - } - - /** - * Start all VMs and containers (when onboot=1). - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/startall", null); - } - - /** - * Start all VMs and containers (when onboot=1). - * - * @return Result - * @throws JSONException - */ - public Result startall() throws JSONException { - return createRest(); - } - - } - - public class PVEStopall { - - private final PveClient _client; - private final Object _node; - - protected PVEStopall(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Stop all VMs and Containers. - * - * @param vms Only consider Guests with these IDs. - * @return Result - * @throws JSONException - */ - public Result createRest(String vms) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("vms", vms); - return _client.create("/nodes/" + _node + "/stopall", parameters); - } - - /** - * Stop all VMs and Containers. - * - * @param vms Only consider Guests with these IDs. - * @return Result - * @throws JSONException - */ - public Result stopall(String vms) throws JSONException { - return createRest(vms); - } - - /** - * Stop all VMs and Containers. - * - * @return Result - * @throws JSONException - */ - public Result createRest() throws JSONException { - return _client.create("/nodes/" + _node + "/stopall", null); - } - - /** - * Stop all VMs and Containers. - * - * @return Result - * @throws JSONException - */ - public Result stopall() throws JSONException { - return createRest(); - } - - } - - public class PVEMigrateall { - - private final PveClient _client; - private final Object _node; - - protected PVEMigrateall(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Migrate all VMs and Containers. - * - * @param target Target node. - * @param maxworkers Maximal number of parallel migration job. - * If not set use 'max_workers' from datacenter.cfg, one of both - * must be set! - * @param vms Only consider Guests with these IDs. - * @return Result - * @throws JSONException - */ - public Result createRest(String target, Integer maxworkers, String vms) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("target", target); - parameters.put("maxworkers", maxworkers); - parameters.put("vms", vms); - return _client.create("/nodes/" + _node + "/migrateall", parameters); - } - - /** - * Migrate all VMs and Containers. - * - * @param target Target node. - * @param maxworkers Maximal number of parallel migration job. - * If not set use 'max_workers' from datacenter.cfg, one of both - * must be set! - * @param vms Only consider Guests with these IDs. - * @return Result - * @throws JSONException - */ - public Result migrateall(String target, Integer maxworkers, String vms) throws JSONException { - return createRest(target, maxworkers, vms); - } - - /** - * Migrate all VMs and Containers. - * - * @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 + "/migrateall", parameters); - } - - /** - * Migrate all VMs and Containers. - * - * @param target Target node. - * @return Result - * @throws JSONException - */ - public Result migrateall(String target) throws JSONException { - return createRest(target); - } - - } - - public class PVEHosts { - - private final PveClient _client; - private final Object _node; - - protected PVEHosts(PveClient client, Object node) { - _client = client; - _node = node; - } - - /** - * Get the content of /etc/hosts. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "/hosts", null); - } - - /** - * Get the content of /etc/hosts. - * - * @return Result - * @throws JSONException - */ - public Result getEtcHosts() throws JSONException { - return getRest(); - } - - /** - * Write /etc/hosts. - * - * @param data The target content of /etc/hosts. - * @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 data, String digest) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("data", data); - parameters.put("digest", digest); - return _client.create("/nodes/" + _node + "/hosts", parameters); - } - - /** - * Write /etc/hosts. - * - * @param data The target content of /etc/hosts. - * @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 writeEtcHosts(String data, String digest) throws JSONException { - return createRest(data, digest); - } - - /** - * Write /etc/hosts. - * - * @param data The target content of /etc/hosts. - * @return Result - * @throws JSONException - */ - public Result createRest(String data) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("data", data); - return _client.create("/nodes/" + _node + "/hosts", parameters); - } - - /** - * Write /etc/hosts. - * - * @param data The target content of /etc/hosts. - * @return Result - * @throws JSONException - */ - public Result writeEtcHosts(String data) throws JSONException { - return createRest(data); - } - - } - - /** - * Node index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes/" + _node + "", null); - } - - /** - * Node index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - /** - * Cluster node index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/nodes", null); - } - - /** - * Cluster node index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEStorage { - - private final PveClient _client; - - protected PVEStorage(PveClient client) { - _client = client; - - } - - public PVEItemStorage get(Object storage) { - return new PVEItemStorage(_client, storage); - } - - public class PVEItemStorage { - - private final PveClient _client; - private final Object _storage; - - protected PVEItemStorage(PveClient client, Object storage) { - _client = client; - _storage = storage; - } - - /** - * Delete storage configuration. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/storage/" + _storage + "", null); - } - - /** - * Delete storage configuration. - * - * @return Result - * @throws JSONException - */ - public Result delete() throws JSONException { - return deleteRest(); - } - - /** - * Read storage configuration. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/storage/" + _storage + "", null); - } - - /** - * Read storage configuration. - * - * @return Result - * @throws JSONException - */ - public Result read() throws JSONException { - return getRest(); - } - - /** - * Update storage configuration. - * - * @param blocksize block size - * @param bwlimit Set bandwidth/io limits various operations. - * @param comstar_hg host group for comstar views - * @param comstar_tg target group for comstar views - * @param content Allowed content types. NOTE: the value 'rootdir' - * is used for Containers, and value 'images' for VMs. - * @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 the storage. - * @param domain CIFS domain. - * @param format Default image format. - * @param fuse Mount CephFS through FUSE. - * @param is_mountpoint Assume the given path is an externally - * managed mountpoint and consider the storage offline if it is not - * mounted. Using a boolean (yes/no) value serves as a shortcut to - * using the target path in this field. - * @param krbd Always access rbd through krbd kernel module. - * @param lio_tpg target portal group for Linux LIO targets - * @param maxfiles Maximal number of backup files per VM. Use '0' - * for unlimted. - * @param mkdir Create the directory if it doesn't exist. - * @param monhost IP addresses of monitors (for external clusters). - * @param nodes List of cluster node names. - * @param nowritecache disable write caching on the target - * @param options NFS mount options (see 'man nfs') - * @param password Password for CIFS share. - * @param pool Pool. - * @param redundancy The redundancy count specifies the number of - * nodes to which the resource should be deployed. It must be at - * least 1 and at most the number of nodes in the cluster. - * @param saferemove Zero-out data when removing LVs. - * @param saferemove_throughput Wipe throughput (cstream -t - * parameter value). - * @param server Server IP or DNS name. - * @param server2 Backup volfile server IP or DNS name. - * @param shared Mark storage as shared. - * @param smbversion SMB protocol version Enum: 2.0,2.1,3.0 - * @param sparse use sparse volumes - * @param subdir Subdir to mount. - * @param tagged_only Only use logical volumes tagged with - * 'pve-vm-ID'. - * @param transport Gluster transport: tcp or rdma Enum: - * tcp,rdma,unix - * @param username RBD Id. - * @return Result - * @throws JSONException - */ - public Result setRest(String blocksize, String bwlimit, String comstar_hg, String comstar_tg, String content, String delete, String digest, Boolean disable, String domain, String format, Boolean fuse, String is_mountpoint, Boolean krbd, String lio_tpg, Integer maxfiles, Boolean mkdir, String monhost, String nodes, Boolean nowritecache, String options, String password, String pool, Integer redundancy, Boolean saferemove, String saferemove_throughput, String server, String server2, Boolean shared, String smbversion, Boolean sparse, String subdir, Boolean tagged_only, String transport, String username) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("blocksize", blocksize); - parameters.put("bwlimit", bwlimit); - parameters.put("comstar_hg", comstar_hg); - parameters.put("comstar_tg", comstar_tg); - parameters.put("content", content); - parameters.put("delete", delete); - parameters.put("digest", digest); - parameters.put("disable", disable); - parameters.put("domain", domain); - parameters.put("format", format); - parameters.put("fuse", fuse); - parameters.put("is_mountpoint", is_mountpoint); - parameters.put("krbd", krbd); - parameters.put("lio_tpg", lio_tpg); - parameters.put("maxfiles", maxfiles); - parameters.put("mkdir", mkdir); - parameters.put("monhost", monhost); - parameters.put("nodes", nodes); - parameters.put("nowritecache", nowritecache); - parameters.put("options", options); - parameters.put("password", password); - parameters.put("pool", pool); - parameters.put("redundancy", redundancy); - parameters.put("saferemove", saferemove); - parameters.put("saferemove_throughput", saferemove_throughput); - parameters.put("server", server); - parameters.put("server2", server2); - parameters.put("shared", shared); - parameters.put("smbversion", smbversion); - parameters.put("sparse", sparse); - parameters.put("subdir", subdir); - parameters.put("tagged_only", tagged_only); - parameters.put("transport", transport); - parameters.put("username", username); - return _client.set("/storage/" + _storage + "", parameters); - } - - /** - * Update storage configuration. - * - * @param blocksize block size - * @param bwlimit Set bandwidth/io limits various operations. - * @param comstar_hg host group for comstar views - * @param comstar_tg target group for comstar views - * @param content Allowed content types. NOTE: the value 'rootdir' - * is used for Containers, and value 'images' for VMs. - * @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 the storage. - * @param domain CIFS domain. - * @param format Default image format. - * @param fuse Mount CephFS through FUSE. - * @param is_mountpoint Assume the given path is an externally - * managed mountpoint and consider the storage offline if it is not - * mounted. Using a boolean (yes/no) value serves as a shortcut to - * using the target path in this field. - * @param krbd Always access rbd through krbd kernel module. - * @param lio_tpg target portal group for Linux LIO targets - * @param maxfiles Maximal number of backup files per VM. Use '0' - * for unlimted. - * @param mkdir Create the directory if it doesn't exist. - * @param monhost IP addresses of monitors (for external clusters). - * @param nodes List of cluster node names. - * @param nowritecache disable write caching on the target - * @param options NFS mount options (see 'man nfs') - * @param password Password for CIFS share. - * @param pool Pool. - * @param redundancy The redundancy count specifies the number of - * nodes to which the resource should be deployed. It must be at - * least 1 and at most the number of nodes in the cluster. - * @param saferemove Zero-out data when removing LVs. - * @param saferemove_throughput Wipe throughput (cstream -t - * parameter value). - * @param server Server IP or DNS name. - * @param server2 Backup volfile server IP or DNS name. - * @param shared Mark storage as shared. - * @param smbversion SMB protocol version Enum: 2.0,2.1,3.0 - * @param sparse use sparse volumes - * @param subdir Subdir to mount. - * @param tagged_only Only use logical volumes tagged with - * 'pve-vm-ID'. - * @param transport Gluster transport: tcp or rdma Enum: - * tcp,rdma,unix - * @param username RBD Id. - * @return Result - * @throws JSONException - */ - public Result update(String blocksize, String bwlimit, String comstar_hg, String comstar_tg, String content, String delete, String digest, Boolean disable, String domain, String format, Boolean fuse, String is_mountpoint, Boolean krbd, String lio_tpg, Integer maxfiles, Boolean mkdir, String monhost, String nodes, Boolean nowritecache, String options, String password, String pool, Integer redundancy, Boolean saferemove, String saferemove_throughput, String server, String server2, Boolean shared, String smbversion, Boolean sparse, String subdir, Boolean tagged_only, String transport, String username) throws JSONException { - return setRest(blocksize, bwlimit, comstar_hg, comstar_tg, content, delete, digest, disable, domain, format, fuse, is_mountpoint, krbd, lio_tpg, maxfiles, mkdir, monhost, nodes, nowritecache, options, password, pool, redundancy, saferemove, saferemove_throughput, server, server2, shared, smbversion, sparse, subdir, tagged_only, transport, username); - } - - /** - * Update storage configuration. - * - * @return Result - * @throws JSONException - */ - public Result setRest() throws JSONException { - return _client.set("/storage/" + _storage + "", null); - } - - /** - * Update storage configuration. - * - * @return Result - * @throws JSONException - */ - public Result update() throws JSONException { - return setRest(); - } - - } - - /** - * Storage index. - * - * @param type Only list storage of specific type Enum: - * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool - * @return Result - * @throws JSONException - */ - public Result getRest(String type) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("type", type); - return _client.get("/storage", parameters); - } - - /** - * Storage index. - * - * @param type Only list storage of specific type Enum: - * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool - * @return Result - * @throws JSONException - */ - public Result index(String type) throws JSONException { - return getRest(type); - } - - /** - * Storage index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/storage", null); - } - - /** - * Storage index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create a new storage. - * - * @param storage The storage identifier. - * @param type Storage type. Enum: - * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool - * @param authsupported Authsupported. - * @param base_ Base volume. This volume is automatically activated. - * @param blocksize block size - * @param bwlimit Set bandwidth/io limits various operations. - * @param comstar_hg host group for comstar views - * @param comstar_tg target group for comstar views - * @param content Allowed content types. NOTE: the value 'rootdir' is - * used for Containers, and value 'images' for VMs. - * @param disable Flag to disable the storage. - * @param domain CIFS domain. - * @param export NFS export path. - * @param format Default image format. - * @param fuse Mount CephFS through FUSE. - * @param is_mountpoint Assume the given path is an externally managed - * mountpoint and consider the storage offline if it is not mounted. - * Using a boolean (yes/no) value serves as a shortcut to using the - * target path in this field. - * @param iscsiprovider iscsi provider - * @param krbd Always access rbd through krbd kernel module. - * @param lio_tpg target portal group for Linux LIO targets - * @param maxfiles Maximal number of backup files per VM. Use '0' for - * unlimted. - * @param mkdir Create the directory if it doesn't exist. - * @param monhost IP addresses of monitors (for external clusters). - * @param nodes List of cluster node names. - * @param nowritecache disable write caching on the target - * @param options NFS mount options (see 'man nfs') - * @param password Password for CIFS share. - * @param path File system path. - * @param pool Pool. - * @param portal iSCSI portal (IP or DNS name with optional port). - * @param redundancy The redundancy count specifies the number of nodes - * to which the resource should be deployed. It must be at least 1 and - * at most the number of nodes in the cluster. - * @param saferemove Zero-out data when removing LVs. - * @param saferemove_throughput Wipe throughput (cstream -t parameter - * value). - * @param server Server IP or DNS name. - * @param server2 Backup volfile server IP or DNS name. - * @param share CIFS share. - * @param shared Mark storage as shared. - * @param smbversion SMB protocol version Enum: 2.0,2.1,3.0 - * @param sparse use sparse volumes - * @param subdir Subdir to mount. - * @param tagged_only Only use logical volumes tagged with 'pve-vm-ID'. - * @param target iSCSI target. - * @param thinpool LVM thin pool LV name. - * @param transport Gluster transport: tcp or rdma Enum: tcp,rdma,unix - * @param username RBD Id. - * @param vgname Volume group name. - * @param volume Glusterfs Volume. - * @return Result - * @throws JSONException - */ - public Result createRest(String storage, String type, String authsupported, String base_, String blocksize, String bwlimit, String comstar_hg, String comstar_tg, String content, Boolean disable, String domain, String export, String format, Boolean fuse, String is_mountpoint, String iscsiprovider, Boolean krbd, String lio_tpg, Integer maxfiles, Boolean mkdir, String monhost, String nodes, Boolean nowritecache, String options, String password, String path, String pool, String portal, Integer redundancy, Boolean saferemove, String saferemove_throughput, String server, String server2, String share, Boolean shared, String smbversion, Boolean sparse, String subdir, Boolean tagged_only, String target, String thinpool, String transport, String username, String vgname, String volume) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("storage", storage); - parameters.put("type", type); - parameters.put("authsupported", authsupported); - parameters.put("base", base_); - parameters.put("blocksize", blocksize); - parameters.put("bwlimit", bwlimit); - parameters.put("comstar_hg", comstar_hg); - parameters.put("comstar_tg", comstar_tg); - parameters.put("content", content); - parameters.put("disable", disable); - parameters.put("domain", domain); - parameters.put("export", export); - parameters.put("format", format); - parameters.put("fuse", fuse); - parameters.put("is_mountpoint", is_mountpoint); - parameters.put("iscsiprovider", iscsiprovider); - parameters.put("krbd", krbd); - parameters.put("lio_tpg", lio_tpg); - parameters.put("maxfiles", maxfiles); - parameters.put("mkdir", mkdir); - parameters.put("monhost", monhost); - parameters.put("nodes", nodes); - parameters.put("nowritecache", nowritecache); - parameters.put("options", options); - parameters.put("password", password); - parameters.put("path", path); - parameters.put("pool", pool); - parameters.put("portal", portal); - parameters.put("redundancy", redundancy); - parameters.put("saferemove", saferemove); - parameters.put("saferemove_throughput", saferemove_throughput); - parameters.put("server", server); - parameters.put("server2", server2); - parameters.put("share", share); - parameters.put("shared", shared); - parameters.put("smbversion", smbversion); - parameters.put("sparse", sparse); - parameters.put("subdir", subdir); - parameters.put("tagged_only", tagged_only); - parameters.put("target", target); - parameters.put("thinpool", thinpool); - parameters.put("transport", transport); - parameters.put("username", username); - parameters.put("vgname", vgname); - parameters.put("volume", volume); - return _client.create("/storage", parameters); - } - - /** - * Create a new storage. - * - * @param storage The storage identifier. - * @param type Storage type. Enum: - * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool - * @param authsupported Authsupported. - * @param base_ Base volume. This volume is automatically activated. - * @param blocksize block size - * @param bwlimit Set bandwidth/io limits various operations. - * @param comstar_hg host group for comstar views - * @param comstar_tg target group for comstar views - * @param content Allowed content types. NOTE: the value 'rootdir' is - * used for Containers, and value 'images' for VMs. - * @param disable Flag to disable the storage. - * @param domain CIFS domain. - * @param export NFS export path. - * @param format Default image format. - * @param fuse Mount CephFS through FUSE. - * @param is_mountpoint Assume the given path is an externally managed - * mountpoint and consider the storage offline if it is not mounted. - * Using a boolean (yes/no) value serves as a shortcut to using the - * target path in this field. - * @param iscsiprovider iscsi provider - * @param krbd Always access rbd through krbd kernel module. - * @param lio_tpg target portal group for Linux LIO targets - * @param maxfiles Maximal number of backup files per VM. Use '0' for - * unlimted. - * @param mkdir Create the directory if it doesn't exist. - * @param monhost IP addresses of monitors (for external clusters). - * @param nodes List of cluster node names. - * @param nowritecache disable write caching on the target - * @param options NFS mount options (see 'man nfs') - * @param password Password for CIFS share. - * @param path File system path. - * @param pool Pool. - * @param portal iSCSI portal (IP or DNS name with optional port). - * @param redundancy The redundancy count specifies the number of nodes - * to which the resource should be deployed. It must be at least 1 and - * at most the number of nodes in the cluster. - * @param saferemove Zero-out data when removing LVs. - * @param saferemove_throughput Wipe throughput (cstream -t parameter - * value). - * @param server Server IP or DNS name. - * @param server2 Backup volfile server IP or DNS name. - * @param share CIFS share. - * @param shared Mark storage as shared. - * @param smbversion SMB protocol version Enum: 2.0,2.1,3.0 - * @param sparse use sparse volumes - * @param subdir Subdir to mount. - * @param tagged_only Only use logical volumes tagged with 'pve-vm-ID'. - * @param target iSCSI target. - * @param thinpool LVM thin pool LV name. - * @param transport Gluster transport: tcp or rdma Enum: tcp,rdma,unix - * @param username RBD Id. - * @param vgname Volume group name. - * @param volume Glusterfs Volume. - * @return Result - * @throws JSONException - */ - public Result create(String storage, String type, String authsupported, String base_, String blocksize, String bwlimit, String comstar_hg, String comstar_tg, String content, Boolean disable, String domain, String export, String format, Boolean fuse, String is_mountpoint, String iscsiprovider, Boolean krbd, String lio_tpg, Integer maxfiles, Boolean mkdir, String monhost, String nodes, Boolean nowritecache, String options, String password, String path, String pool, String portal, Integer redundancy, Boolean saferemove, String saferemove_throughput, String server, String server2, String share, Boolean shared, String smbversion, Boolean sparse, String subdir, Boolean tagged_only, String target, String thinpool, String transport, String username, String vgname, String volume) throws JSONException { - return createRest(storage, type, authsupported, base_, blocksize, bwlimit, comstar_hg, comstar_tg, content, disable, domain, export, format, fuse, is_mountpoint, iscsiprovider, krbd, lio_tpg, maxfiles, mkdir, monhost, nodes, nowritecache, options, password, path, pool, portal, redundancy, saferemove, saferemove_throughput, server, server2, share, shared, smbversion, sparse, subdir, tagged_only, target, thinpool, transport, username, vgname, volume); - } - - /** - * Create a new storage. - * - * @param storage The storage identifier. - * @param type Storage type. Enum: - * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool - * @return Result - * @throws JSONException - */ - public Result createRest(String storage, String type) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("storage", storage); - parameters.put("type", type); - return _client.create("/storage", parameters); - } - - /** - * Create a new storage. - * - * @param storage The storage identifier. - * @param type Storage type. Enum: - * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool - * @return Result - * @throws JSONException - */ - public Result create(String storage, String type) throws JSONException { - return createRest(storage, type); - } - - } - - public class PVEAccess { - - private final PveClient _client; - - protected PVEAccess(PveClient client) { - _client = client; - - } - - private PVEUsers _users; - - public PVEUsers getUsers() { - if (_users == null) { - _users = new PVEUsers(_client); - } - - return _users; - } - private PVEGroups _groups; - - public PVEGroups getGroups() { - if (_groups == null) { - _groups = new PVEGroups(_client); - } - - return _groups; - } - private PVERoles _roles; - - public PVERoles getRoles() { - if (_roles == null) { - _roles = new PVERoles(_client); - } - - return _roles; - } - private PVEAcl _acl; - - public PVEAcl getAcl() { - if (_acl == null) { - _acl = new PVEAcl(_client); - } - - return _acl; - } - private PVEDomains _domains; - - public PVEDomains getDomains() { - if (_domains == null) { - _domains = new PVEDomains(_client); - } - - return _domains; - } - private PVETicket _ticket; - - public PVETicket getTicket() { - if (_ticket == null) { - _ticket = new PVETicket(_client); - } - - return _ticket; - } - private PVEPassword _password; - - public PVEPassword getPassword() { - if (_password == null) { - _password = new PVEPassword(_client); - } - - return _password; - } - private PVETfa _tfa; - - public PVETfa getTfa() { - if (_tfa == null) { - _tfa = new PVETfa(_client); - } - - return _tfa; - } - - public class PVEUsers { - - private final PveClient _client; - - protected PVEUsers(PveClient client) { - _client = client; - - } - - public PVEItemUserid get(Object userid) { - return new PVEItemUserid(_client, userid); - } - - public class PVEItemUserid { - - private final PveClient _client; - private final Object _userid; - - protected PVEItemUserid(PveClient client, Object userid) { - _client = client; - _userid = userid; - } - - private PVETfa _tfa; - - public PVETfa getTfa() { - if (_tfa == null) { - _tfa = new PVETfa(_client, _userid); - } - - return _tfa; - } - - public class PVETfa { - - private final PveClient _client; - private final Object _userid; - - protected PVETfa(PveClient client, Object userid) { - _client = client; - _userid = userid; - } - - /** - * Get user TFA types (Personal and Realm). - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/users/" + _userid + "/tfa", null); - } - - /** - * Get user TFA types (Personal and Realm). - * - * @return Result - * @throws JSONException - */ - public Result readUserTfaType() throws JSONException { - return getRest(); - } - - } - - /** - * Delete user. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/access/users/" + _userid + "", null); - } - - /** - * Delete user. - * - * @return Result - * @throws JSONException - */ - public Result deleteUser() throws JSONException { - return deleteRest(); - } - - /** - * Get user configuration. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/users/" + _userid + "", null); - } - - /** - * Get user configuration. - * - * @return Result - * @throws JSONException - */ - public Result readUser() throws JSONException { - return getRest(); - } - - /** - * Update user configuration. - * - * @param append - * @param comment - * @param email - * @param enable Enable the account (default). You can set this - * to '0' to disable the account - * @param expire Account expiration date (seconds since epoch). - * '0' means no expiration date. - * @param firstname - * @param groups - * @param keys Keys for two factor auth (yubico). - * @param lastname - * @return Result - * @throws JSONException - */ - public Result setRest(Boolean append, String comment, String email, Boolean enable, Integer expire, String firstname, String groups, String keys, String lastname) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("append", append); - parameters.put("comment", comment); - parameters.put("email", email); - parameters.put("enable", enable); - parameters.put("expire", expire); - parameters.put("firstname", firstname); - parameters.put("groups", groups); - parameters.put("keys", keys); - parameters.put("lastname", lastname); - return _client.set("/access/users/" + _userid + "", parameters); - } - - /** - * Update user configuration. - * - * @param append - * @param comment - * @param email - * @param enable Enable the account (default). You can set this - * to '0' to disable the account - * @param expire Account expiration date (seconds since epoch). - * '0' means no expiration date. - * @param firstname - * @param groups - * @param keys Keys for two factor auth (yubico). - * @param lastname - * @return Result - * @throws JSONException - */ - public Result updateUser(Boolean append, String comment, String email, Boolean enable, Integer expire, String firstname, String groups, String keys, String lastname) throws JSONException { - return setRest(append, comment, email, enable, expire, firstname, groups, keys, lastname); - } - - /** - * Update user configuration. - * - * @return Result - * @throws JSONException - */ - public Result setRest() throws JSONException { - return _client.set("/access/users/" + _userid + "", null); - } - - /** - * Update user configuration. - * - * @return Result - * @throws JSONException - */ - public Result updateUser() throws JSONException { - return setRest(); - } - - } - - /** - * User index. - * - * @param enabled Optional filter for enable property. - * @return Result - * @throws JSONException - */ - public Result getRest(Boolean enabled) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("enabled", enabled); - return _client.get("/access/users", parameters); - } - - /** - * User index. - * - * @param enabled Optional filter for enable property. - * @return Result - * @throws JSONException - */ - public Result index(Boolean enabled) throws JSONException { - return getRest(enabled); - } - - /** - * User index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/users", null); - } - - /** - * User index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create new user. - * - * @param userid User ID - * @param comment - * @param email - * @param enable Enable the account (default). You can set this to - * '0' to disable the account - * @param expire Account expiration date (seconds since epoch). '0' - * means no expiration date. - * @param firstname - * @param groups - * @param keys Keys for two factor auth (yubico). - * @param lastname - * @param password Initial password. - * @return Result - * @throws JSONException - */ - public Result createRest(String userid, String comment, String email, Boolean enable, Integer expire, String firstname, String groups, String keys, String lastname, String password) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("userid", userid); - parameters.put("comment", comment); - parameters.put("email", email); - parameters.put("enable", enable); - parameters.put("expire", expire); - parameters.put("firstname", firstname); - parameters.put("groups", groups); - parameters.put("keys", keys); - parameters.put("lastname", lastname); - parameters.put("password", password); - return _client.create("/access/users", parameters); - } - - /** - * Create new user. - * - * @param userid User ID - * @param comment - * @param email - * @param enable Enable the account (default). You can set this to - * '0' to disable the account - * @param expire Account expiration date (seconds since epoch). '0' - * means no expiration date. - * @param firstname - * @param groups - * @param keys Keys for two factor auth (yubico). - * @param lastname - * @param password Initial password. - * @return Result - * @throws JSONException - */ - public Result createUser(String userid, String comment, String email, Boolean enable, Integer expire, String firstname, String groups, String keys, String lastname, String password) throws JSONException { - return createRest(userid, comment, email, enable, expire, firstname, groups, keys, lastname, password); - } - - /** - * Create new user. - * - * @param userid User ID - * @return Result - * @throws JSONException - */ - public Result createRest(String userid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("userid", userid); - return _client.create("/access/users", parameters); - } - - /** - * Create new user. - * - * @param userid User ID - * @return Result - * @throws JSONException - */ - public Result createUser(String userid) throws JSONException { - return createRest(userid); - } - - } - - public class PVEGroups { - - private final PveClient _client; - - protected PVEGroups(PveClient client) { - _client = client; - - } - - public PVEItemGroupid get(Object groupid) { - return new PVEItemGroupid(_client, groupid); - } - - public class PVEItemGroupid { - - private final PveClient _client; - private final Object _groupid; - - protected PVEItemGroupid(PveClient client, Object groupid) { - _client = client; - _groupid = groupid; - } - - /** - * Delete group. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/access/groups/" + _groupid + "", null); - } - - /** - * Delete group. - * - * @return Result - * @throws JSONException - */ - public Result deleteGroup() throws JSONException { - return deleteRest(); - } - - /** - * Get group configuration. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/groups/" + _groupid + "", null); - } - - /** - * Get group configuration. - * - * @return Result - * @throws JSONException - */ - public Result readGroup() throws JSONException { - return getRest(); - } - - /** - * Update group data. - * - * @param comment - * @return Result - * @throws JSONException - */ - public Result setRest(String comment) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("comment", comment); - return _client.set("/access/groups/" + _groupid + "", parameters); - } - - /** - * Update group data. - * - * @param comment - * @return Result - * @throws JSONException - */ - public Result updateGroup(String comment) throws JSONException { - return setRest(comment); - } - - /** - * Update group data. - * - * @return Result - * @throws JSONException - */ - public Result setRest() throws JSONException { - return _client.set("/access/groups/" + _groupid + "", null); - } - - /** - * Update group data. - * - * @return Result - * @throws JSONException - */ - public Result updateGroup() throws JSONException { - return setRest(); - } - - } - - /** - * Group index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/groups", null); - } - - /** - * Group index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create new group. - * - * @param groupid - * @param comment - * @return Result - * @throws JSONException - */ - public Result createRest(String groupid, String comment) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("groupid", groupid); - parameters.put("comment", comment); - return _client.create("/access/groups", parameters); - } - - /** - * Create new group. - * - * @param groupid - * @param comment - * @return Result - * @throws JSONException - */ - public Result createGroup(String groupid, String comment) throws JSONException { - return createRest(groupid, comment); - } - - /** - * Create new group. - * - * @param groupid - * @return Result - * @throws JSONException - */ - public Result createRest(String groupid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("groupid", groupid); - return _client.create("/access/groups", parameters); - } - - /** - * Create new group. - * - * @param groupid - * @return Result - * @throws JSONException - */ - public Result createGroup(String groupid) throws JSONException { - return createRest(groupid); - } - - } - - public class PVERoles { - - private final PveClient _client; - - protected PVERoles(PveClient client) { - _client = client; - - } - - public PVEItemRoleid get(Object roleid) { - return new PVEItemRoleid(_client, roleid); - } - - public class PVEItemRoleid { - - private final PveClient _client; - private final Object _roleid; - - protected PVEItemRoleid(PveClient client, Object roleid) { - _client = client; - _roleid = roleid; - } - - /** - * Delete role. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/access/roles/" + _roleid + "", null); - } - - /** - * Delete role. - * - * @return Result - * @throws JSONException - */ - public Result deleteRole() throws JSONException { - return deleteRest(); - } - - /** - * Get role configuration. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/roles/" + _roleid + "", null); - } - - /** - * Get role configuration. - * - * @return Result - * @throws JSONException - */ - public Result readRole() throws JSONException { - return getRest(); - } - - /** - * Update an existing role. - * - * @param append - * @param privs - * @return Result - * @throws JSONException - */ - public Result setRest(Boolean append, String privs) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("append", append); - parameters.put("privs", privs); - return _client.set("/access/roles/" + _roleid + "", parameters); - } - - /** - * Update an existing role. - * - * @param append - * @param privs - * @return Result - * @throws JSONException - */ - public Result updateRole(Boolean append, String privs) throws JSONException { - return setRest(append, privs); - } - - /** - * Update an existing role. - * - * @return Result - * @throws JSONException - */ - public Result setRest() throws JSONException { - return _client.set("/access/roles/" + _roleid + "", null); - } - - /** - * Update an existing role. - * - * @return Result - * @throws JSONException - */ - public Result updateRole() throws JSONException { - return setRest(); - } - - } - - /** - * Role index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/roles", null); - } - - /** - * Role index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create new role. - * - * @param roleid - * @param privs - * @return Result - * @throws JSONException - */ - public Result createRest(String roleid, String privs) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("roleid", roleid); - parameters.put("privs", privs); - return _client.create("/access/roles", parameters); - } - - /** - * Create new role. - * - * @param roleid - * @param privs - * @return Result - * @throws JSONException - */ - public Result createRole(String roleid, String privs) throws JSONException { - return createRest(roleid, privs); - } - - /** - * Create new role. - * - * @param roleid - * @return Result - * @throws JSONException - */ - public Result createRest(String roleid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("roleid", roleid); - return _client.create("/access/roles", parameters); - } - - /** - * Create new role. - * - * @param roleid - * @return Result - * @throws JSONException - */ - public Result createRole(String roleid) throws JSONException { - return createRest(roleid); - } - - } - - public class PVEAcl { - - private final PveClient _client; - - protected PVEAcl(PveClient client) { - _client = client; - - } - - /** - * Get Access Control List (ACLs). - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/acl", null); - } - - /** - * Get Access Control List (ACLs). - * - * @return Result - * @throws JSONException - */ - public Result readAcl() throws JSONException { - return getRest(); - } - - /** - * Update Access Control List (add or remove permissions). - * - * @param path Access control path - * @param roles List of roles. - * @param delete Remove permissions (instead of adding it). - * @param groups List of groups. - * @param propagate Allow to propagate (inherit) permissions. - * @param users List of users. - * @return Result - * @throws JSONException - */ - public Result setRest(String path, String roles, Boolean delete, String groups, Boolean propagate, String users) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("path", path); - parameters.put("roles", roles); - parameters.put("delete", delete); - parameters.put("groups", groups); - parameters.put("propagate", propagate); - parameters.put("users", users); - return _client.set("/access/acl", parameters); - } - - /** - * Update Access Control List (add or remove permissions). - * - * @param path Access control path - * @param roles List of roles. - * @param delete Remove permissions (instead of adding it). - * @param groups List of groups. - * @param propagate Allow to propagate (inherit) permissions. - * @param users List of users. - * @return Result - * @throws JSONException - */ - public Result updateAcl(String path, String roles, Boolean delete, String groups, Boolean propagate, String users) throws JSONException { - return setRest(path, roles, delete, groups, propagate, users); - } - - /** - * Update Access Control List (add or remove permissions). - * - * @param path Access control path - * @param roles List of roles. - * @return Result - * @throws JSONException - */ - public Result setRest(String path, String roles) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("path", path); - parameters.put("roles", roles); - return _client.set("/access/acl", parameters); - } - - /** - * Update Access Control List (add or remove permissions). - * - * @param path Access control path - * @param roles List of roles. - * @return Result - * @throws JSONException - */ - public Result updateAcl(String path, String roles) throws JSONException { - return setRest(path, roles); - } - - } - - public class PVEDomains { - - private final PveClient _client; - - protected PVEDomains(PveClient client) { - _client = client; - - } - - public PVEItemRealm get(Object realm) { - return new PVEItemRealm(_client, realm); - } - - public class PVEItemRealm { - - private final PveClient _client; - private final Object _realm; - - protected PVEItemRealm(PveClient client, Object realm) { - _client = client; - _realm = realm; - } - - /** - * Delete an authentication server. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/access/domains/" + _realm + "", null); - } - - /** - * Delete an authentication server. - * - * @return Result - * @throws JSONException - */ - public Result delete() throws JSONException { - return deleteRest(); - } - - /** - * Get auth server configuration. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/domains/" + _realm + "", null); - } - - /** - * Get auth server configuration. - * - * @return Result - * @throws JSONException - */ - public Result read() throws JSONException { - return getRest(); - } - - /** - * Update authentication server settings. - * - * @param base_dn LDAP base domain name - * @param bind_dn LDAP bind domain name - * @param capath Path to the CA certificate store - * @param cert Path to the client certificate - * @param certkey Path to the client certificate key - * @param comment Description. - * @param default_ Use this as default realm - * @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 domain AD domain name - * @param port Server port. - * @param secure Use secure LDAPS protocol. - * @param server1 Server IP address (or DNS name) - * @param server2 Fallback Server IP address (or DNS name) - * @param tfa Use Two-factor authentication. - * @param user_attr LDAP user attribute name - * @param verify Verify the server's SSL certificate - * @return Result - * @throws JSONException - */ - public Result setRest(String base_dn, String bind_dn, String capath, String cert, String certkey, String comment, Boolean default_, String delete, String digest, String domain, Integer port, Boolean secure, String server1, String server2, String tfa, String user_attr, Boolean verify) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("base_dn", base_dn); - parameters.put("bind_dn", bind_dn); - parameters.put("capath", capath); - parameters.put("cert", cert); - parameters.put("certkey", certkey); - parameters.put("comment", comment); - parameters.put("default", default_); - parameters.put("delete", delete); - parameters.put("digest", digest); - parameters.put("domain", domain); - parameters.put("port", port); - parameters.put("secure", secure); - parameters.put("server1", server1); - parameters.put("server2", server2); - parameters.put("tfa", tfa); - parameters.put("user_attr", user_attr); - parameters.put("verify", verify); - return _client.set("/access/domains/" + _realm + "", parameters); - } - - /** - * Update authentication server settings. - * - * @param base_dn LDAP base domain name - * @param bind_dn LDAP bind domain name - * @param capath Path to the CA certificate store - * @param cert Path to the client certificate - * @param certkey Path to the client certificate key - * @param comment Description. - * @param default_ Use this as default realm - * @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 domain AD domain name - * @param port Server port. - * @param secure Use secure LDAPS protocol. - * @param server1 Server IP address (or DNS name) - * @param server2 Fallback Server IP address (or DNS name) - * @param tfa Use Two-factor authentication. - * @param user_attr LDAP user attribute name - * @param verify Verify the server's SSL certificate - * @return Result - * @throws JSONException - */ - public Result update(String base_dn, String bind_dn, String capath, String cert, String certkey, String comment, Boolean default_, String delete, String digest, String domain, Integer port, Boolean secure, String server1, String server2, String tfa, String user_attr, Boolean verify) throws JSONException { - return setRest(base_dn, bind_dn, capath, cert, certkey, comment, default_, delete, digest, domain, port, secure, server1, server2, tfa, user_attr, verify); - } - - /** - * Update authentication server settings. - * - * @return Result - * @throws JSONException - */ - public Result setRest() throws JSONException { - return _client.set("/access/domains/" + _realm + "", null); - } - - /** - * Update authentication server settings. - * - * @return Result - * @throws JSONException - */ - public Result update() throws JSONException { - return setRest(); - } - - } - - /** - * Authentication domain index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/domains", null); - } - - /** - * Authentication domain index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Add an authentication server. - * - * @param realm Authentication domain ID - * @param type Realm type. Enum: ad,ldap,pam,pve - * @param base_dn LDAP base domain name - * @param bind_dn LDAP bind domain name - * @param capath Path to the CA certificate store - * @param cert Path to the client certificate - * @param certkey Path to the client certificate key - * @param comment Description. - * @param default_ Use this as default realm - * @param domain AD domain name - * @param port Server port. - * @param secure Use secure LDAPS protocol. - * @param server1 Server IP address (or DNS name) - * @param server2 Fallback Server IP address (or DNS name) - * @param tfa Use Two-factor authentication. - * @param user_attr LDAP user attribute name - * @param verify Verify the server's SSL certificate - * @return Result - * @throws JSONException - */ - public Result createRest(String realm, String type, String base_dn, String bind_dn, String capath, String cert, String certkey, String comment, Boolean default_, String domain, Integer port, Boolean secure, String server1, String server2, String tfa, String user_attr, Boolean verify) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("realm", realm); - parameters.put("type", type); - parameters.put("base_dn", base_dn); - parameters.put("bind_dn", bind_dn); - parameters.put("capath", capath); - parameters.put("cert", cert); - parameters.put("certkey", certkey); - parameters.put("comment", comment); - parameters.put("default", default_); - parameters.put("domain", domain); - parameters.put("port", port); - parameters.put("secure", secure); - parameters.put("server1", server1); - parameters.put("server2", server2); - parameters.put("tfa", tfa); - parameters.put("user_attr", user_attr); - parameters.put("verify", verify); - return _client.create("/access/domains", parameters); - } - - /** - * Add an authentication server. - * - * @param realm Authentication domain ID - * @param type Realm type. Enum: ad,ldap,pam,pve - * @param base_dn LDAP base domain name - * @param bind_dn LDAP bind domain name - * @param capath Path to the CA certificate store - * @param cert Path to the client certificate - * @param certkey Path to the client certificate key - * @param comment Description. - * @param default_ Use this as default realm - * @param domain AD domain name - * @param port Server port. - * @param secure Use secure LDAPS protocol. - * @param server1 Server IP address (or DNS name) - * @param server2 Fallback Server IP address (or DNS name) - * @param tfa Use Two-factor authentication. - * @param user_attr LDAP user attribute name - * @param verify Verify the server's SSL certificate - * @return Result - * @throws JSONException - */ - public Result create(String realm, String type, String base_dn, String bind_dn, String capath, String cert, String certkey, String comment, Boolean default_, String domain, Integer port, Boolean secure, String server1, String server2, String tfa, String user_attr, Boolean verify) throws JSONException { - return createRest(realm, type, base_dn, bind_dn, capath, cert, certkey, comment, default_, domain, port, secure, server1, server2, tfa, user_attr, verify); - } - - /** - * Add an authentication server. - * - * @param realm Authentication domain ID - * @param type Realm type. Enum: ad,ldap,pam,pve - * @return Result - * @throws JSONException - */ - public Result createRest(String realm, String type) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("realm", realm); - parameters.put("type", type); - return _client.create("/access/domains", parameters); - } - - /** - * Add an authentication server. - * - * @param realm Authentication domain ID - * @param type Realm type. Enum: ad,ldap,pam,pve - * @return Result - * @throws JSONException - */ - public Result create(String realm, String type) throws JSONException { - return createRest(realm, type); - } - - } - - public class PVETicket { - - private final PveClient _client; - - protected PVETicket(PveClient client) { - _client = client; - - } - - /** - * Dummy. Useful for formatters which want to provide a login page. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access/ticket", null); - } - - /** - * Dummy. Useful for formatters which want to provide a login page. - * - * @return Result - * @throws JSONException - */ - public Result getTicket() throws JSONException { - return getRest(); - } - - /** - * Create or verify authentication ticket. - * - * @param password The secret password. This can also be a valid - * ticket. - * @param username User name - * @param otp One-time password for Two-factor authentication. - * @param path Verify ticket, and check if user have access 'privs' - * on 'path' - * @param privs Verify ticket, and check if user have access 'privs' - * on 'path' - * @param realm You can optionally pass the realm using this - * parameter. Normally the realm is simply added to the username - * &lt;username&gt;@&lt;relam&gt;. - * @return Result - * @throws JSONException - */ - public Result createRest(String password, String username, String otp, String path, String privs, String realm) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("password", password); - parameters.put("username", username); - parameters.put("otp", otp); - parameters.put("path", path); - parameters.put("privs", privs); - parameters.put("realm", realm); - return _client.create("/access/ticket", parameters); - } - - /** - * Create or verify authentication ticket. - * - * @param password The secret password. This can also be a valid - * ticket. - * @param username User name - * @param otp One-time password for Two-factor authentication. - * @param path Verify ticket, and check if user have access 'privs' - * on 'path' - * @param privs Verify ticket, and check if user have access 'privs' - * on 'path' - * @param realm You can optionally pass the realm using this - * parameter. Normally the realm is simply added to the username - * &lt;username&gt;@&lt;relam&gt;. - * @return Result - * @throws JSONException - */ - public Result createTicket(String password, String username, String otp, String path, String privs, String realm) throws JSONException { - return createRest(password, username, otp, path, privs, realm); - } - - /** - * Create or verify authentication ticket. - * - * @param password The secret password. This can also be a valid - * ticket. - * @param username User name - * @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("/access/ticket", parameters); - } - - /** - * Create or verify authentication ticket. - * - * @param password The secret password. This can also be a valid - * ticket. - * @param username User name - * @return Result - * @throws JSONException - */ - public Result createTicket(String password, String username) throws JSONException { - return createRest(password, username); - } - - } - - public class PVEPassword { - - private final PveClient _client; - - protected PVEPassword(PveClient client) { - _client = client; - - } - - /** - * Change user password. - * - * @param password The new password. - * @param userid User ID - * @return Result - * @throws JSONException - */ - public Result setRest(String password, String userid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("password", password); - parameters.put("userid", userid); - return _client.set("/access/password", parameters); - } - - /** - * Change user password. - * - * @param password The new password. - * @param userid User ID - * @return Result - * @throws JSONException - */ - public Result changePassword(String password, String userid) throws JSONException { - return setRest(password, userid); - } - - } - - public class PVETfa { - - private final PveClient _client; - - protected PVETfa(PveClient client) { - _client = client; - - } - - /** - * Finish a u2f challenge. - * - * @param response The response to the current authentication - * challenge. - * @return Result - * @throws JSONException - */ - public Result createRest(String response) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("response", response); - return _client.create("/access/tfa", parameters); - } - - /** - * Finish a u2f challenge. - * - * @param response The response to the current authentication - * challenge. - * @return Result - * @throws JSONException - */ - public Result verifyTfa(String response) throws JSONException { - return createRest(response); - } - - /** - * Change user u2f authentication. - * - * @param action The action to perform Enum: delete,new,confirm - * @param userid User ID - * @param config A TFA configuration. This must currently be of type - * TOTP of not set at all. - * @param key When adding TOTP, the shared secret value. - * @param password The current password. - * @param response Either the the response to the current u2f - * registration challenge, or, when adding TOTP, the currently valid - * TOTP value. - * @return Result - * @throws JSONException - */ - public Result setRest(String action, String userid, String config, String key, String password, String response) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("action", action); - parameters.put("userid", userid); - parameters.put("config", config); - parameters.put("key", key); - parameters.put("password", password); - parameters.put("response", response); - return _client.set("/access/tfa", parameters); - } - - /** - * Change user u2f authentication. - * - * @param action The action to perform Enum: delete,new,confirm - * @param userid User ID - * @param config A TFA configuration. This must currently be of type - * TOTP of not set at all. - * @param key When adding TOTP, the shared secret value. - * @param password The current password. - * @param response Either the the response to the current u2f - * registration challenge, or, when adding TOTP, the currently valid - * TOTP value. - * @return Result - * @throws JSONException - */ - public Result changeTfa(String action, String userid, String config, String key, String password, String response) throws JSONException { - return setRest(action, userid, config, key, password, response); - } - - /** - * Change user u2f authentication. - * - * @param action The action to perform Enum: delete,new,confirm - * @param userid User ID - * @return Result - * @throws JSONException - */ - public Result setRest(String action, String userid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("action", action); - parameters.put("userid", userid); - return _client.set("/access/tfa", parameters); - } - - /** - * Change user u2f authentication. - * - * @param action The action to perform Enum: delete,new,confirm - * @param userid User ID - * @return Result - * @throws JSONException - */ - public Result changeTfa(String action, String userid) throws JSONException { - return setRest(action, userid); - } - - } - - /** - * Directory index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/access", null); - } - - /** - * Directory index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - } - - public class PVEPools { - - private final PveClient _client; - - protected PVEPools(PveClient client) { - _client = client; - - } - - public PVEItemPoolid get(Object poolid) { - return new PVEItemPoolid(_client, poolid); - } - - public class PVEItemPoolid { - - private final PveClient _client; - private final Object _poolid; - - protected PVEItemPoolid(PveClient client, Object poolid) { - _client = client; - _poolid = poolid; - } - - /** - * Delete pool. - * - * @return Result - * @throws JSONException - */ - public Result deleteRest() throws JSONException { - return _client.delete("/pools/" + _poolid + "", null); - } - - /** - * Delete pool. - * - * @return Result - * @throws JSONException - */ - public Result deletePool() throws JSONException { - return deleteRest(); - } - - /** - * Get pool configuration. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/pools/" + _poolid + "", null); - } - - /** - * Get pool configuration. - * - * @return Result - * @throws JSONException - */ - public Result readPool() throws JSONException { - return getRest(); - } - - /** - * Update pool data. - * - * @param comment - * @param delete Remove vms/storage (instead of adding it). - * @param storage List of storage IDs. - * @param vms List of virtual machines. - * @return Result - * @throws JSONException - */ - public Result setRest(String comment, Boolean delete, String storage, String vms) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("comment", comment); - parameters.put("delete", delete); - parameters.put("storage", storage); - parameters.put("vms", vms); - return _client.set("/pools/" + _poolid + "", parameters); - } - - /** - * Update pool data. - * - * @param comment - * @param delete Remove vms/storage (instead of adding it). - * @param storage List of storage IDs. - * @param vms List of virtual machines. - * @return Result - * @throws JSONException - */ - public Result updatePool(String comment, Boolean delete, String storage, String vms) throws JSONException { - return setRest(comment, delete, storage, vms); - } - - /** - * Update pool data. - * - * @return Result - * @throws JSONException - */ - public Result setRest() throws JSONException { - return _client.set("/pools/" + _poolid + "", null); - } - - /** - * Update pool data. - * - * @return Result - * @throws JSONException - */ - public Result updatePool() throws JSONException { - return setRest(); - } - - } - - /** - * Pool index. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/pools", null); - } - - /** - * Pool index. - * - * @return Result - * @throws JSONException - */ - public Result index() throws JSONException { - return getRest(); - } - - /** - * Create new pool. - * - * @param poolid - * @param comment - * @return Result - * @throws JSONException - */ - public Result createRest(String poolid, String comment) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("poolid", poolid); - parameters.put("comment", comment); - return _client.create("/pools", parameters); - } - - /** - * Create new pool. - * - * @param poolid - * @param comment - * @return Result - * @throws JSONException - */ - public Result createPool(String poolid, String comment) throws JSONException { - return createRest(poolid, comment); - } - - /** - * Create new pool. - * - * @param poolid - * @return Result - * @throws JSONException - */ - public Result createRest(String poolid) throws JSONException { - Map parameters = new HashMap<>(); - parameters.put("poolid", poolid); - return _client.create("/pools", parameters); - } - - /** - * Create new pool. - * - * @param poolid - * @return Result - * @throws JSONException - */ - public Result createPool(String poolid) throws JSONException { - return createRest(poolid); - } - - } - - public class PVEVersion { - - private final PveClient _client; - - protected PVEVersion(PveClient client) { - _client = client; - - } - - /** - * API version details. The result also includes the global datacenter - * confguration. - * - * @return Result - * @throws JSONException - */ - public Result getRest() throws JSONException { - return _client.get("/version", null); - } - - /** - * API version details. The result also includes the global datacenter - * confguration. - * - * @return Result - * @throws JSONException - */ - public Result version() throws JSONException { - return getRest(); - } - - } -} +/* + * 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 PVECeph _ceph; + + public PVECeph getCeph() { + if (_ceph == null) { + _ceph = new PVECeph(_client); + } + + return _ceph; + } + 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; + } + + 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. + * '&lt;GUEST&gt;-&lt;JOBNUM&gt;'. + * @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. + * '&lt;GUEST&gt;-&lt;JOBNUM&gt;'. + * @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. + * '&lt;GUEST&gt;-&lt;JOBNUM&gt;'. + * @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. + * '&lt;GUEST&gt;-&lt;JOBNUM&gt;'. + * @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 + * &lt;moveto&gt;. 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 + * &lt;moveto&gt;. 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 &lt;pos&gt;. + * @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 &lt;pos&gt;. + * @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 + * &lt;moveto&gt;. 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 + * &lt;moveto&gt;. 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 &lt;pos&gt;. + * @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 &lt;pos&gt;. + * @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&gt;0. N=1 + * uses half of cores, N&gt;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&gt;0. N=1 + * uses half of cores, N&gt;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&gt;0. N=1 uses + * half of cores, N&gt;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&gt;0. N=1 uses + * half of cores, N&gt;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 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; + } + private PVEFlags _flags; + + public PVEFlags getFlags() { + if (_flags == null) { + _flags = new PVEFlags(_client); + } + + return _flags; + } + + 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 metadata() 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 status() throws JSONException { + return getRest(); + } + + } + + public class PVEFlags { + + private final PveClient _client; + + protected PVEFlags(PveClient client) { + _client = client; + + } + + public PVEItemFlag get(Object flag) { + return new PVEItemFlag(_client, flag); + } + + public class PVEItemFlag { + + private final PveClient _client; + private final Object _flag; + + protected PVEItemFlag(PveClient client, Object flag) { + _client = client; + _flag = flag; + } + + /** + * Get the status of a specific ceph flag. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/cluster/ceph/flags/" + _flag + "", null); + } + + /** + * Get the status of a specific ceph flag. + * + * @return Result + * @throws JSONException + */ + public Result getFlag() throws JSONException { + return getRest(); + } + + /** + * Set or clear (unset) a specific ceph flag + * + * @param value The new value of the flag + * @return Result + * @throws JSONException + */ + + public Result setRest(boolean value) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("value", value); + return _client.set("/cluster/ceph/flags/" + _flag + "", parameters); + } + + /** + * Set or clear (unset) a specific ceph flag + * + * @param value The new value of the flag + * @return Result + * @throws JSONException + */ + public Result updateFlag(boolean value) throws JSONException { + return setRest(value); + } + + } + + /** + * get the status of all ceph flags + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/cluster/ceph/flags", null); + } + + /** + * get the status of all ceph flags + * + * @return Result + * @throws JSONException + */ + public Result getAllFlags() throws JSONException { + return getRest(); + } + + /** + * Set/Unset multiple ceph flags at once. + * + * @param nobackfill Backfilling of PGs is suspended. + * @param nodeep_scrub Deep Scrubbing is disabled. + * @param nodown OSD failure reports are being ignored, such + * that the monitors will not mark OSDs down. + * @param noin OSDs that were previously marked out will not be + * marked back in when they start. + * @param noout OSDs will not automatically be marked out after + * the configured interval. + * @param norebalance Rebalancing of PGs is suspended. + * @param norecover Recovery of PGs is suspended. + * @param noscrub Scrubbing is disabled. + * @param notieragent Cache tiering activity is suspended. + * @param noup OSDs are not allowed to start. + * @param pause Pauses read and writes. + * @return Result + * @throws JSONException + */ + + public Result setRest(Boolean nobackfill, Boolean nodeep_scrub, Boolean nodown, Boolean noin, Boolean noout, Boolean norebalance, Boolean norecover, Boolean noscrub, Boolean notieragent, Boolean noup, Boolean pause) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("nobackfill", nobackfill); + parameters.put("nodeep-scrub", nodeep_scrub); + parameters.put("nodown", nodown); + parameters.put("noin", noin); + parameters.put("noout", noout); + parameters.put("norebalance", norebalance); + parameters.put("norecover", norecover); + parameters.put("noscrub", noscrub); + parameters.put("notieragent", notieragent); + parameters.put("noup", noup); + parameters.put("pause", pause); + return _client.set("/cluster/ceph/flags", parameters); + } + + /** + * Set/Unset multiple ceph flags at once. + * + * @param nobackfill Backfilling of PGs is suspended. + * @param nodeep_scrub Deep Scrubbing is disabled. + * @param nodown OSD failure reports are being ignored, such + * that the monitors will not mark OSDs down. + * @param noin OSDs that were previously marked out will not be + * marked back in when they start. + * @param noout OSDs will not automatically be marked out after + * the configured interval. + * @param norebalance Rebalancing of PGs is suspended. + * @param norecover Recovery of PGs is suspended. + * @param noscrub Scrubbing is disabled. + * @param notieragent Cache tiering activity is suspended. + * @param noup OSDs are not allowed to start. + * @param pause Pauses read and writes. + * @return Result + * @throws JSONException + */ + public Result setFlags(Boolean nobackfill, Boolean nodeep_scrub, Boolean nodown, Boolean noin, Boolean noout, Boolean norebalance, Boolean norecover, Boolean noscrub, Boolean notieragent, Boolean noup, Boolean pause) throws JSONException { + return setRest(nobackfill, nodeep_scrub, nodown, noin, noout, norebalance, norecover, noscrub, notieragent, noup, pause); + } + + /** + * Set/Unset multiple ceph flags at once. + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/cluster/ceph/flags", null); + } + + /** + * Set/Unset multiple ceph flags at once. + * + * @return Result + * @throws JSONException + */ + public Result setFlags() throws JSONException { + return setRest(); + } + + } + + /** + * 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(); + } + + } + + 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,sdn + * @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,sdn + * @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: + * ca,da,de,en,es,eu,fa,fr,he,it,ja,nb,nn,pl,pt_BR,ru,sl,sv,tr,zh_CN,zh_TW + * @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: + * ca,da,de,en,es,eu,fa,fr,he,it,ja,nb,nn,pl,pt_BR,ru,sl,sv,tr,zh_CN,zh_TW + * @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(); + } + + } + + /** + * 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 + * &lt;moveto&gt;. 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 + * &lt;moveto&gt;. 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 + * &lt;pos&gt;. + * @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 + * &lt;pos&gt;. + * @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&lt;id&gt; 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 (Neighbor Discovery + * Protocol). + * @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&lt;id&gt; 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 (Neighbor Discovery + * Protocol). + * @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 audio0 Configure a audio device, useful in + * combination with QXL/Spice. + * @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 spice_enhancements Configure additional + * enhancements for SPICE. + * @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 tags Tags of the VM. This is only meta + * information. + * @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, String audio0, 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 spice_enhancements, String sshkeys, String startdate, String startup, Boolean tablet, String tags, 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("audio0", audio0); + 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("spice_enhancements", spice_enhancements); + parameters.put("sshkeys", sshkeys); + parameters.put("startdate", startdate); + parameters.put("startup", startup); + parameters.put("tablet", tablet); + parameters.put("tags", tags); + 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 audio0 Configure a audio device, useful in + * combination with QXL/Spice. + * @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 spice_enhancements Configure additional + * enhancements for SPICE. + * @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 tags Tags of the VM. This is only meta + * information. + * @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, String audio0, 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 spice_enhancements, String sshkeys, String startdate, String startup, Boolean tablet, String tags, 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, audio0, 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, spice_enhancements, sshkeys, startdate, startup, tablet, tags, 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 audio0 Configure a audio device, useful in + * combination with QXL/Spice. + * @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 spice_enhancements Configure additional + * enhancements for SPICE. + * @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 tags Tags of the VM. This is only meta + * information. + * @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, String audio0, 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 spice_enhancements, String sshkeys, String startdate, String startup, Boolean tablet, String tags, 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("audio0", audio0); + 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("spice_enhancements", spice_enhancements); + parameters.put("sshkeys", sshkeys); + parameters.put("startdate", startdate); + parameters.put("startup", startup); + parameters.put("tablet", tablet); + parameters.put("tags", tags); + 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 audio0 Configure a audio device, useful in + * combination with QXL/Spice. + * @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 spice_enhancements Configure additional + * enhancements for SPICE. + * @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 tags Tags of the VM. This is only meta + * information. + * @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, String audio0, 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 spice_enhancements, String sshkeys, String startdate, String startup, Boolean tablet, String tags, 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, audio0, 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, spice_enhancements, sshkeys, startdate, startup, tablet, tags, 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 PVEReboot _reboot; + + public PVEReboot getReboot() { + if (_reboot == null) { + _reboot = new PVEReboot(_client, _node, _vmid); + } + + return _reboot; + } + 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 PVEReboot { + + private final PveClient _client; + private final Object _node; + private final Object _vmid; + + protected PVEReboot(PveClient client, Object node, Object vmid) { + _client = client; + _node = node; + _vmid = vmid; + } + + /** + * Reboot the VM by shutting it down, and starting + * it again. Applies pending changes. + * + * @param timeout Wait maximal timeout seconds for + * the shutdown. + * @return Result + * @throws JSONException + */ + public Result createRest(Integer timeout) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("timeout", timeout); + return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/reboot", parameters); + } + + /** + * Reboot the VM by shutting it down, and starting + * it again. Applies pending changes. + * + * @param timeout Wait maximal timeout seconds for + * the shutdown. + * @return Result + * @throws JSONException + */ + public Result vmReboot(Integer timeout) throws JSONException { + return createRest(timeout); + } + + /** + * Reboot the VM by shutting it down, and starting + * it again. Applies pending changes. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/qemu/" + _vmid + "/status/reboot", null); + } + + /** + * Reboot the VM by shutting it down, and starting + * it again. Applies pending changes. + * + * @return Result + * @throws JSONException + */ + public Result vmReboot() 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 if VM is + * running. Ignored if VM is stopped. + * @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 if VM is + * running. Ignored if VM is stopped. + * @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 purge Remove vmid from backup cron jobs. + * @param skiplock Ignore locks - only root is allowed to + * use this option. + * @return Result + * @throws JSONException + */ + public Result deleteRest(Boolean purge, Boolean skiplock) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("purge", purge); + parameters.put("skiplock", skiplock); + return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "", parameters); + } + + /** + * Destroy the vm (also delete all used/owned volumes). + * + * @param purge Remove vmid from backup cron jobs. + * @param skiplock Ignore locks - only root is allowed to + * use this option. + * @return Result + * @throws JSONException + */ + public Result destroyVm(Boolean purge, Boolean skiplock) throws JSONException { + return deleteRest(purge, 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 audio0 Configure a audio device, useful in combination + * with QXL/Spice. + * @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 spice_enhancements Configure additional enhancements + * for SPICE. + * @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 tags Tags of the VM. This is only meta information. + * @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, String audio0, 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 spice_enhancements, String sshkeys, Boolean start, String startdate, String startup, String storage, Boolean tablet, String tags, 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("audio0", audio0); + 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("spice_enhancements", spice_enhancements); + 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("tags", tags); + 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 audio0 Configure a audio device, useful in combination + * with QXL/Spice. + * @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 spice_enhancements Configure additional enhancements + * for SPICE. + * @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 tags Tags of the VM. This is only meta information. + * @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, String audio0, 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 spice_enhancements, String sshkeys, Boolean start, String startdate, String startup, String storage, Boolean tablet, String tags, 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, audio0, 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, spice_enhancements, sshkeys, start, startdate, startup, storage, tablet, tags, 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; + } + private PVEPending _pending; + + public PVEPending getPending() { + if (_pending == null) { + _pending = new PVEPending(_client, _node, _vmid); + } + + return _pending; + } + + 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 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 + "/lxc/" + _vmid + "/config", parameters); + } + + /** + * Get container configuration. + * + * @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 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,destroyed,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/&lt;ostype&gt;.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 revert Revert a pending change. + * @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 tags Tags of the Container. This is only meta + * information. + * @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 revert, String rootfs, String searchdomain, String startup, Integer swap, String tags, 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("revert", revert); + parameters.put("rootfs", rootfs); + parameters.put("searchdomain", searchdomain); + parameters.put("startup", startup); + parameters.put("swap", swap); + parameters.put("tags", tags); + 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,destroyed,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/&lt;ostype&gt;.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 revert Revert a pending change. + * @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 tags Tags of the Container. This is only meta + * information. + * @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 revert, String rootfs, String searchdomain, String startup, Integer swap, String tags, 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, revert, rootfs, searchdomain, startup, swap, tags, 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; + } + private PVEReboot _reboot; + + public PVEReboot getReboot() { + if (_reboot == null) { + _reboot = new PVEReboot(_client, _node, _vmid); + } + + return _reboot; + } + + 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(); + } + + } + + public class PVEReboot { + + private final PveClient _client; + private final Object _node; + private final Object _vmid; + + protected PVEReboot(PveClient client, Object node, Object vmid) { + _client = client; + _node = node; + _vmid = vmid; + } + + /** + * Reboot the container by shutting it down, and + * starting it again. Applies pending changes. + * + * @param timeout Wait maximal timeout seconds for + * the shutdown. + * @return Result + * @throws JSONException + */ + public Result createRest(Integer timeout) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("timeout", timeout); + return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/status/reboot", parameters); + } + + /** + * Reboot the container by shutting it down, and + * starting it again. Applies pending changes. + * + * @param timeout Wait maximal timeout seconds for + * the shutdown. + * @return Result + * @throws JSONException + */ + public Result vmReboot(Integer timeout) throws JSONException { + return createRest(timeout); + } + + /** + * Reboot the container by shutting it down, and + * starting it again. Applies pending changes. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/lxc/" + _vmid + "/status/reboot", null); + } + + /** + * Reboot the container by shutting it down, and + * starting it again. Applies pending changes. + * + * @return Result + * @throws JSONException + */ + public Result vmReboot() 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 + * &lt;moveto&gt;. 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 + * &lt;moveto&gt;. 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 + * &lt;pos&gt;. + * @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 + * &lt;pos&gt;. + * @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&lt;id&gt; 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 (Neighbor Discovery + * Protocol). + * @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&lt;id&gt; 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 (Neighbor Discovery + * Protocol). + * @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); + } + + } + + 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 container configuration, including pending + * changes. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/lxc/" + _vmid + "/pending", null); + } + + /** + * Get container configuration, including pending + * changes. + * + * @return Result + * @throws JSONException + */ + public Result vmPending() throws JSONException { + return getRest(); + } + + } + + /** + * Destroy the container (also delete all uses files). + * + * @param purge Remove vmid from backup cron jobs. + * @return Result + * @throws JSONException + */ + public Result deleteRest(Boolean purge) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("purge", purge); + return _client.delete("/nodes/" + _node + "/lxc/" + _vmid + "", parameters); + } + + /** + * Destroy the container (also delete all uses files). + * + * @param purge Remove vmid from backup cron jobs. + * @return Result + * @throws JSONException + */ + public Result destroyVm(Boolean purge) throws JSONException { + return deleteRest(purge); + } + + /** + * 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,destroyed,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/&lt;ostype&gt;.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 tags Tags of the Container. This is only meta + * information. + * @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, String tags, Boolean template, Integer tty, Boolean unique, Boolean unprivileged, Map unusedN) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("ostemplate", ostemplate); + parameters.put("vmid", vmid); + parameters.put("arch", arch); + parameters.put("bwlimit", bwlimit); + parameters.put("cmode", cmode); + parameters.put("console", console); + parameters.put("cores", cores); + parameters.put("cpulimit", cpulimit); + parameters.put("cpuunits", cpuunits); + parameters.put("description", description); + parameters.put("features", features); + parameters.put("force", force); + parameters.put("hookscript", hookscript); + parameters.put("hostname", hostname); + parameters.put("ignore-unpack-errors", ignore_unpack_errors); + parameters.put("lock", lock_); + parameters.put("memory", memory); + parameters.put("nameserver", nameserver); + parameters.put("onboot", onboot); + parameters.put("ostype", ostype); + parameters.put("password", password); + parameters.put("pool", pool); + parameters.put("protection", protection); + parameters.put("restore", restore); + parameters.put("rootfs", rootfs); + parameters.put("searchdomain", searchdomain); + parameters.put("ssh-public-keys", ssh_public_keys); + parameters.put("start", start); + parameters.put("startup", startup); + parameters.put("storage", storage); + parameters.put("swap", swap); + parameters.put("tags", tags); + parameters.put("template", template); + parameters.put("tty", tty); + parameters.put("unique", unique); + parameters.put("unprivileged", unprivileged); + addIndexedParameter(parameters, "mp", mpN); + addIndexedParameter(parameters, "net", netN); + addIndexedParameter(parameters, "unused", unusedN); + return _client.create("/nodes/" + _node + "/lxc", parameters); + } + + /** + * 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,destroyed,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/&lt;ostype&gt;.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 tags Tags of the Container. This is only meta + * information. + * @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 createVm(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, String tags, Boolean template, Integer tty, Boolean unique, Boolean unprivileged, Map unusedN) throws JSONException { + return createRest(ostemplate, vmid, arch, bwlimit, cmode, console, cores, cpulimit, cpuunits, description, features, force, hookscript, hostname, ignore_unpack_errors, lock_, memory, mpN, nameserver, netN, onboot, ostype, password, pool, protection, restore, rootfs, searchdomain, ssh_public_keys, start, startup, storage, swap, tags, template, tty, unique, unprivileged, unusedN); + } + + /** + * Create or restore a container. + * + * @param ostemplate The OS template or backup file. + * @param vmid The (unique) ID of the VM. + * @return Result + * @throws JSONException + */ + + public Result createRest(String ostemplate, int vmid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("ostemplate", ostemplate); + parameters.put("vmid", vmid); + return _client.create("/nodes/" + _node + "/lxc", parameters); + } + + /** + * Create or restore a container. + * + * @param ostemplate The OS template or backup file. + * @param vmid The (unique) ID of the VM. + * @return Result + * @throws JSONException + */ + public Result createVm(String ostemplate, int vmid) throws JSONException { + return createRest(ostemplate, vmid); + } + + } + + public class PVECeph { + + private final PveClient _client; + private final Object _node; + + protected PVECeph(PveClient client, Object node) { + _client = client; + _node = node; + } + + private PVEOsd _osd; + + public PVEOsd getOsd() { + if (_osd == null) { + _osd = new PVEOsd(_client, _node); + } + + return _osd; + } + private PVEMds _mds; + + public PVEMds getMds() { + if (_mds == null) { + _mds = new PVEMds(_client, _node); + } + + return _mds; + } + private PVEMgr _mgr; + + public PVEMgr getMgr() { + if (_mgr == null) { + _mgr = new PVEMgr(_client, _node); + } + + return _mgr; + } + private PVEMon _mon; + + public PVEMon getMon() { + if (_mon == null) { + _mon = new PVEMon(_client, _node); + } + + return _mon; + } + private PVEFs _fs; + + public PVEFs getFs() { + if (_fs == null) { + _fs = new PVEFs(_client, _node); + } + + return _fs; + } + private PVEDisks _disks; + + public PVEDisks getDisks() { + if (_disks == null) { + _disks = new PVEDisks(_client, _node); + } + + return _disks; + } + private PVEConfig _config; + + public PVEConfig getConfig() { + if (_config == null) { + _config = new PVEConfig(_client, _node); + } + + return _config; + } + private PVEConfigdb _configdb; + + public PVEConfigdb getConfigdb() { + if (_configdb == null) { + _configdb = new PVEConfigdb(_client, _node); + } + + return _configdb; + } + private PVEInit _init; + + public PVEInit getInit() { + if (_init == null) { + _init = new PVEInit(_client, _node); + } + + return _init; + } + private PVEStop _stop; + + public PVEStop getStop() { + if (_stop == null) { + _stop = new PVEStop(_client, _node); + } + + return _stop; + } + private PVEStart _start; + + public PVEStart getStart() { + if (_start == null) { + _start = new PVEStart(_client, _node); + } + + return _start; + } + private PVERestart _restart; + + public PVERestart getRestart() { + if (_restart == null) { + _restart = new PVERestart(_client, _node); + } + + return _restart; + } + private PVEStatus _status; + + public PVEStatus getStatus() { + if (_status == null) { + _status = new PVEStatus(_client, _node); + } + + return _status; + } + private PVEPools _pools; + + public PVEPools getPools() { + if (_pools == null) { + _pools = new PVEPools(_client, _node); + } + + return _pools; + } + private PVEFlags _flags; + + public PVEFlags getFlags() { + if (_flags == null) { + _flags = new PVEFlags(_client, _node); + } + + return _flags; + } + private PVECrush _crush; + + public PVECrush getCrush() { + if (_crush == null) { + _crush = new PVECrush(_client, _node); + } + + return _crush; + } + private PVELog _log; + + public PVELog getLog() { + if (_log == null) { + _log = new PVELog(_client, _node); + } + + return _log; + } + private PVERules _rules; + + public PVERules getRules() { + if (_rules == null) { + _rules = new PVERules(_client, _node); + } + + return _rules; + } + + public class PVEOsd { + + private final PveClient _client; + private final Object _node; + + protected PVEOsd(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemOsdid get(Object osdid) { + return new PVEItemOsdid(_client, _node, osdid); + } + + public class PVEItemOsdid { + + private final PveClient _client; + private final Object _node; + private final Object _osdid; + + protected PVEItemOsdid(PveClient client, Object node, Object osdid) { + _client = client; + _node = node; + _osdid = osdid; + } + + private PVEIn _in; + + public PVEIn getIn() { + if (_in == null) { + _in = new PVEIn(_client, _node, _osdid); + } + + return _in; + } + private PVEOut _out; + + public PVEOut getOut() { + if (_out == null) { + _out = new PVEOut(_client, _node, _osdid); + } + + return _out; + } + private PVEScrub _scrub; + + public PVEScrub getScrub() { + if (_scrub == null) { + _scrub = new PVEScrub(_client, _node, _osdid); + } + + return _scrub; + } + + public class PVEIn { + + private final PveClient _client; + private final Object _node; + private final Object _osdid; + + protected PVEIn(PveClient client, Object node, Object osdid) { + _client = client; + _node = node; + _osdid = osdid; + } + + /** + * ceph osd in + * + * @return Result + * @throws JSONException + */ + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/osd/" + _osdid + "/in", null); + } + + /** + * ceph osd in + * + * @return Result + * @throws JSONException + */ + public Result in() throws JSONException { + return createRest(); + } + + } + + public class PVEOut { + + private final PveClient _client; + private final Object _node; + private final Object _osdid; + + protected PVEOut(PveClient client, Object node, Object osdid) { + _client = client; + _node = node; + _osdid = osdid; + } + + /** + * ceph osd out + * + * @return Result + * @throws JSONException + */ + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/osd/" + _osdid + "/out", null); + } + + /** + * ceph osd out + * + * @return Result + * @throws JSONException + */ + public Result out() throws JSONException { + return createRest(); + } + + } + + public class PVEScrub { + + private final PveClient _client; + private final Object _node; + private final Object _osdid; + + protected PVEScrub(PveClient client, Object node, Object osdid) { + _client = client; + _node = node; + _osdid = osdid; + } + + /** + * Instruct the OSD to scrub. + * + * @param deep If set, instructs a deep scrub + * instead of a normal one. + * @return Result + * @throws JSONException + */ + public Result createRest(Boolean deep) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("deep", deep); + return _client.create("/nodes/" + _node + "/ceph/osd/" + _osdid + "/scrub", parameters); + } + + /** + * Instruct the OSD to scrub. + * + * @param deep If set, instructs a deep scrub + * instead of a normal one. + * @return Result + * @throws JSONException + */ + public Result scrub(Boolean deep) throws JSONException { + return createRest(deep); + } + + /** + * Instruct the OSD to scrub. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/osd/" + _osdid + "/scrub", null); + } + + /** + * Instruct the OSD to scrub. + * + * @return Result + * @throws JSONException + */ + public Result scrub() throws JSONException { + return createRest(); + } + + } + + /** + * Destroy OSD + * + * @param cleanup If set, we remove partition table + * entries. + * @return Result + * @throws JSONException + */ + public Result deleteRest(Boolean cleanup) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("cleanup", cleanup); + return _client.delete("/nodes/" + _node + "/ceph/osd/" + _osdid + "", parameters); + } + + /** + * Destroy OSD + * + * @param cleanup If set, we remove partition table + * entries. + * @return Result + * @throws JSONException + */ + public Result destroyosd(Boolean cleanup) throws JSONException { + return deleteRest(cleanup); + } + + /** + * Destroy OSD + * + * @return Result + * @throws JSONException + */ + + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/ceph/osd/" + _osdid + "", null); + } + + /** + * Destroy OSD + * + * @return Result + * @throws JSONException + */ + public Result destroyosd() throws JSONException { + return deleteRest(); + } + + } + + /** + * Get Ceph osd list/tree. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/osd", null); + } + + /** + * Get Ceph osd list/tree. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create OSD + * + * @param dev Block device name. + * @param db_dev Block device name for block.db. + * @param db_size Size in GiB for block.db. + * @param encrypted Enables encryption of the OSD. + * @param wal_dev Block device name for block.wal. + * @param wal_size Size in GiB for block.wal. + * @return Result + * @throws JSONException + */ + + public Result createRest(String dev, String db_dev, Integer db_size, Boolean encrypted, String wal_dev, Integer wal_size) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("dev", dev); + parameters.put("db_dev", db_dev); + parameters.put("db_size", db_size); + parameters.put("encrypted", encrypted); + parameters.put("wal_dev", wal_dev); + parameters.put("wal_size", wal_size); + return _client.create("/nodes/" + _node + "/ceph/osd", parameters); + } + + /** + * Create OSD + * + * @param dev Block device name. + * @param db_dev Block device name for block.db. + * @param db_size Size in GiB for block.db. + * @param encrypted Enables encryption of the OSD. + * @param wal_dev Block device name for block.wal. + * @param wal_size Size in GiB for block.wal. + * @return Result + * @throws JSONException + */ + public Result createosd(String dev, String db_dev, Integer db_size, Boolean encrypted, String wal_dev, Integer wal_size) throws JSONException { + return createRest(dev, db_dev, db_size, encrypted, wal_dev, wal_size); + } + + /** + * Create OSD + * + * @param dev Block device name. + * @return Result + * @throws JSONException + */ + + public Result createRest(String dev) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("dev", dev); + return _client.create("/nodes/" + _node + "/ceph/osd", parameters); + } + + /** + * Create OSD + * + * @param dev Block device name. + * @return Result + * @throws JSONException + */ + public Result createosd(String dev) throws JSONException { + return createRest(dev); + } + + } + + public class PVEMds { + + private final PveClient _client; + private final Object _node; + + protected PVEMds(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemName get(Object name) { + return new PVEItemName(_client, _node, name); + } + + public class PVEItemName { + + private final PveClient _client; + private final Object _node; + private final Object _name; + + protected PVEItemName(PveClient client, Object node, Object name) { + _client = client; + _node = node; + _name = name; + } + + /** + * Destroy Ceph Metadata Server + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/ceph/mds/" + _name + "", null); + } + + /** + * Destroy Ceph Metadata Server + * + * @return Result + * @throws JSONException + */ + public Result destroymds() throws JSONException { + return deleteRest(); + } + + /** + * Create Ceph Metadata Server (MDS) + * + * @param hotstandby Determines whether a ceph-mds + * daemon should poll and replay the log of an active + * MDS. Faster switch on MDS failure, but needs more + * idle resources. + * @return Result + * @throws JSONException + */ + + public Result createRest(Boolean hotstandby) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("hotstandby", hotstandby); + return _client.create("/nodes/" + _node + "/ceph/mds/" + _name + "", parameters); + } + + /** + * Create Ceph Metadata Server (MDS) + * + * @param hotstandby Determines whether a ceph-mds + * daemon should poll and replay the log of an active + * MDS. Faster switch on MDS failure, but needs more + * idle resources. + * @return Result + * @throws JSONException + */ + public Result createmds(Boolean hotstandby) throws JSONException { + return createRest(hotstandby); + } + + /** + * Create Ceph Metadata Server (MDS) + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/mds/" + _name + "", null); + } + + /** + * Create Ceph Metadata Server (MDS) + * + * @return Result + * @throws JSONException + */ + public Result createmds() throws JSONException { + return createRest(); + } + + } + + /** + * MDS directory index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/mds", null); + } + + /** + * MDS directory index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEMgr { + + private final PveClient _client; + private final Object _node; + + protected PVEMgr(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemId get(Object id) { + return new PVEItemId(_client, _node, id); + } + + public class PVEItemId { + + private final PveClient _client; + private final Object _node; + private final Object _id; + + protected PVEItemId(PveClient client, Object node, Object id) { + _client = client; + _node = node; + _id = id; + } + + /** + * Destroy Ceph Manager. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/ceph/mgr/" + _id + "", null); + } + + /** + * Destroy Ceph Manager. + * + * @return Result + * @throws JSONException + */ + public Result destroymgr() throws JSONException { + return deleteRest(); + } + + /** + * Create Ceph Manager + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/mgr/" + _id + "", null); + } + + /** + * Create Ceph Manager + * + * @return Result + * @throws JSONException + */ + public Result createmgr() throws JSONException { + return createRest(); + } + + } + + /** + * MGR directory index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/mgr", null); + } + + /** + * MGR directory index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEMon { + + private final PveClient _client; + private final Object _node; + + protected PVEMon(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemMonid get(Object monid) { + return new PVEItemMonid(_client, _node, monid); + } + + public class PVEItemMonid { + + private final PveClient _client; + private final Object _node; + private final Object _monid; + + protected PVEItemMonid(PveClient client, Object node, Object monid) { + _client = client; + _node = node; + _monid = monid; + } + + /** + * Destroy Ceph Monitor and Manager. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/ceph/mon/" + _monid + "", null); + } + + /** + * Destroy Ceph Monitor and Manager. + * + * @return Result + * @throws JSONException + */ + public Result destroymon() throws JSONException { + return deleteRest(); + } + + /** + * Create Ceph Monitor and Manager + * + * @param mon_address Overwrites autodetected monitor IP + * address. Must be in the public network of ceph. + * @return Result + * @throws JSONException + */ + + public Result createRest(String mon_address) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("mon-address", mon_address); + return _client.create("/nodes/" + _node + "/ceph/mon/" + _monid + "", parameters); + } + + /** + * Create Ceph Monitor and Manager + * + * @param mon_address Overwrites autodetected monitor IP + * address. Must be in the public network of ceph. + * @return Result + * @throws JSONException + */ + public Result createmon(String mon_address) throws JSONException { + return createRest(mon_address); + } + + /** + * Create Ceph Monitor and Manager + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/mon/" + _monid + "", null); + } + + /** + * Create Ceph Monitor and Manager + * + * @return Result + * @throws JSONException + */ + public Result createmon() throws JSONException { + return createRest(); + } + + } + + /** + * Get Ceph monitor list. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/mon", null); + } + + /** + * Get Ceph monitor list. + * + * @return Result + * @throws JSONException + */ + public Result listmon() throws JSONException { + return getRest(); + } + + } + + public class PVEFs { + + private final PveClient _client; + private final Object _node; + + protected PVEFs(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemName get(Object name) { + return new PVEItemName(_client, _node, name); + } + + public class PVEItemName { + + private final PveClient _client; + private final Object _node; + private final Object _name; + + protected PVEItemName(PveClient client, Object node, Object name) { + _client = client; + _node = node; + _name = name; + } + + /** + * Create a Ceph filesystem + * + * @param add_storage Configure the created CephFS as + * storage for this cluster. + * @param pg_num Number of placement groups for the + * backing data pool. The metadata pool will use a + * quarter of this. + * @return Result + * @throws JSONException + */ + public Result createRest(Boolean add_storage, Integer pg_num) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("add-storage", add_storage); + parameters.put("pg_num", pg_num); + return _client.create("/nodes/" + _node + "/ceph/fs/" + _name + "", parameters); + } + + /** + * Create a Ceph filesystem + * + * @param add_storage Configure the created CephFS as + * storage for this cluster. + * @param pg_num Number of placement groups for the + * backing data pool. The metadata pool will use a + * quarter of this. + * @return Result + * @throws JSONException + */ + public Result createfs(Boolean add_storage, Integer pg_num) throws JSONException { + return createRest(add_storage, pg_num); + } + + /** + * Create a Ceph filesystem + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/fs/" + _name + "", null); + } + + /** + * Create a Ceph filesystem + * + * @return Result + * @throws JSONException + */ + public Result createfs() throws JSONException { + return createRest(); + } + + } + + /** + * Directory index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/fs", null); + } + + /** + * Directory index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEDisks { + + private final PveClient _client; + private final Object _node; + + protected PVEDisks(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * List local disks. + * + * @param type Only list specific types of disks. Enum: + * unused,journal_disks + * @return Result + * @throws JSONException + */ + public Result getRest(String type) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("type", type); + return _client.get("/nodes/" + _node + "/ceph/disks", parameters); + } + + /** + * List local disks. + * + * @param type Only list specific types of disks. Enum: + * unused,journal_disks + * @return Result + * @throws JSONException + */ + public Result disks(String type) throws JSONException { + return getRest(type); + } + + /** + * List local disks. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/disks", null); + } + + /** + * List local disks. + * + * @return Result + * @throws JSONException + */ + public Result disks() throws JSONException { + return getRest(); + } + + } + + public class PVEConfig { + + private final PveClient _client; + private final Object _node; + + protected PVEConfig(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get Ceph configuration. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/config", null); + } + + /** + * Get Ceph configuration. + * + * @return Result + * @throws JSONException + */ + public Result config() throws JSONException { + return getRest(); + } + + } + + public class PVEConfigdb { + + private final PveClient _client; + private final Object _node; + + protected PVEConfigdb(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get Ceph configuration database. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/configdb", null); + } + + /** + * Get Ceph configuration database. + * + * @return Result + * @throws JSONException + */ + public Result configdb() throws JSONException { + return getRest(); + } + + } + + public class PVEInit { + + private final PveClient _client; + private final Object _node; + + protected PVEInit(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Create initial ceph default configuration and setup + * symlinks. + * + * @param cluster_network Declare a separate cluster + * network, OSDs will routeheartbeat, object replication and + * recovery traffic over it + * @param disable_cephx Disable cephx authentication. + * WARNING: cephx is a security feature protecting against + * man-in-the-middle attacks. Only consider disabling cephx + * if your network is private! + * @param min_size Minimum number of available replicas per + * object to allow I/O + * @param network Use specific network for all ceph related + * traffic + * @param pg_bits Placement group bits, used to specify the + * default number of placement groups. NOTE: 'osd pool + * default pg num' does not work for default pools. + * @param size Targeted number of replicas per object + * @return Result + * @throws JSONException + */ + public Result createRest(String cluster_network, Boolean disable_cephx, Integer min_size, String network, Integer pg_bits, Integer size) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("cluster-network", cluster_network); + parameters.put("disable_cephx", disable_cephx); + parameters.put("min_size", min_size); + parameters.put("network", network); + parameters.put("pg_bits", pg_bits); + parameters.put("size", size); + return _client.create("/nodes/" + _node + "/ceph/init", parameters); + } + + /** + * Create initial ceph default configuration and setup + * symlinks. + * + * @param cluster_network Declare a separate cluster + * network, OSDs will routeheartbeat, object replication and + * recovery traffic over it + * @param disable_cephx Disable cephx authentication. + * WARNING: cephx is a security feature protecting against + * man-in-the-middle attacks. Only consider disabling cephx + * if your network is private! + * @param min_size Minimum number of available replicas per + * object to allow I/O + * @param network Use specific network for all ceph related + * traffic + * @param pg_bits Placement group bits, used to specify the + * default number of placement groups. NOTE: 'osd pool + * default pg num' does not work for default pools. + * @param size Targeted number of replicas per object + * @return Result + * @throws JSONException + */ + public Result init(String cluster_network, Boolean disable_cephx, Integer min_size, String network, Integer pg_bits, Integer size) throws JSONException { + return createRest(cluster_network, disable_cephx, min_size, network, pg_bits, size); + } + + /** + * Create initial ceph default configuration and setup + * symlinks. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/init", null); + } + + /** + * Create initial ceph default configuration and setup + * symlinks. + * + * @return Result + * @throws JSONException + */ + public Result init() throws JSONException { + return createRest(); + } + + } + + public class PVEStop { + + private final PveClient _client; + private final Object _node; + + protected PVEStop(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Stop ceph services. + * + * @param service Ceph service name. + * @return Result + * @throws JSONException + */ + public Result createRest(String service) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("service", service); + return _client.create("/nodes/" + _node + "/ceph/stop", parameters); + } + + /** + * Stop ceph services. + * + * @param service Ceph service name. + * @return Result + * @throws JSONException + */ + public Result stop(String service) throws JSONException { + return createRest(service); + } + + /** + * Stop ceph services. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/stop", null); + } + + /** + * Stop ceph services. + * + * @return Result + * @throws JSONException + */ + public Result stop() throws JSONException { + return createRest(); + } + + } + + public class PVEStart { + + private final PveClient _client; + private final Object _node; + + protected PVEStart(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Start ceph services. + * + * @param service Ceph service name. + * @return Result + * @throws JSONException + */ + public Result createRest(String service) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("service", service); + return _client.create("/nodes/" + _node + "/ceph/start", parameters); + } + + /** + * Start ceph services. + * + * @param service Ceph service name. + * @return Result + * @throws JSONException + */ + public Result start(String service) throws JSONException { + return createRest(service); + } + + /** + * Start ceph services. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/start", null); + } + + /** + * Start ceph services. + * + * @return Result + * @throws JSONException + */ + public Result start() throws JSONException { + return createRest(); + } + + } + + public class PVERestart { + + private final PveClient _client; + private final Object _node; + + protected PVERestart(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Restart ceph services. + * + * @param service Ceph service name. + * @return Result + * @throws JSONException + */ + public Result createRest(String service) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("service", service); + return _client.create("/nodes/" + _node + "/ceph/restart", parameters); + } + + /** + * Restart ceph services. + * + * @param service Ceph service name. + * @return Result + * @throws JSONException + */ + public Result restart(String service) throws JSONException { + return createRest(service); + } + + /** + * Restart ceph services. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/restart", null); + } + + /** + * Restart ceph services. + * + * @return Result + * @throws JSONException + */ + public Result restart() throws JSONException { + return createRest(); + } + + } + + public class PVEStatus { + + private final PveClient _client; + private final Object _node; + + protected PVEStatus(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get ceph status. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/status", null); + } + + /** + * Get ceph status. + * + * @return Result + * @throws JSONException + */ + public Result status() throws JSONException { + return getRest(); + } + + } + + public class PVEPools { + + private final PveClient _client; + private final Object _node; + + protected PVEPools(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemName get(Object name) { + return new PVEItemName(_client, _node, name); + } + + public class PVEItemName { + + private final PveClient _client; + private final Object _node; + private final Object _name; + + protected PVEItemName(PveClient client, Object node, Object name) { + _client = client; + _node = node; + _name = name; + } + + /** + * Destroy pool + * + * @param force If true, destroys pool even if in use + * @param remove_storages Remove all pveceph-managed + * storages configured for this pool + * @return Result + * @throws JSONException + */ + public Result deleteRest(Boolean force, Boolean remove_storages) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("force", force); + parameters.put("remove_storages", remove_storages); + return _client.delete("/nodes/" + _node + "/ceph/pools/" + _name + "", parameters); + } + + /** + * Destroy pool + * + * @param force If true, destroys pool even if in use + * @param remove_storages Remove all pveceph-managed + * storages configured for this pool + * @return Result + * @throws JSONException + */ + public Result destroypool(Boolean force, Boolean remove_storages) throws JSONException { + return deleteRest(force, remove_storages); + } + + /** + * Destroy pool + * + * @return Result + * @throws JSONException + */ + + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/ceph/pools/" + _name + "", null); + } + + /** + * Destroy pool + * + * @return Result + * @throws JSONException + */ + public Result destroypool() throws JSONException { + return deleteRest(); + } + + } + + /** + * List all pools. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/pools", null); + } + + /** + * List all pools. + * + * @return Result + * @throws JSONException + */ + public Result lspools() throws JSONException { + return getRest(); + } + + /** + * Create POOL + * + * @param name The name of the pool. It must be unique. + * @param add_storages Configure VM and CT storage using the + * new pool. + * @param application The application of the pool, 'rbd' by + * default. Enum: rbd,cephfs,rgw + * @param crush_rule The rule to use for mapping object + * placement in the cluster. + * @param min_size Minimum number of replicas per object + * @param pg_num Number of placement groups. + * @param size Number of replicas per object + * @return Result + * @throws JSONException + */ + + public Result createRest(String name, Boolean add_storages, String application, String crush_rule, Integer min_size, Integer pg_num, Integer size) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("name", name); + parameters.put("add_storages", add_storages); + parameters.put("application", application); + parameters.put("crush_rule", crush_rule); + parameters.put("min_size", min_size); + parameters.put("pg_num", pg_num); + parameters.put("size", size); + return _client.create("/nodes/" + _node + "/ceph/pools", parameters); + } + + /** + * Create POOL + * + * @param name The name of the pool. It must be unique. + * @param add_storages Configure VM and CT storage using the + * new pool. + * @param application The application of the pool, 'rbd' by + * default. Enum: rbd,cephfs,rgw + * @param crush_rule The rule to use for mapping object + * placement in the cluster. + * @param min_size Minimum number of replicas per object + * @param pg_num Number of placement groups. + * @param size Number of replicas per object + * @return Result + * @throws JSONException + */ + public Result createpool(String name, Boolean add_storages, String application, String crush_rule, Integer min_size, Integer pg_num, Integer size) throws JSONException { + return createRest(name, add_storages, application, crush_rule, min_size, pg_num, size); + } + + /** + * Create POOL + * + * @param name The name of the pool. It must be unique. + * @return Result + * @throws JSONException + */ + + public Result createRest(String name) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("name", name); + return _client.create("/nodes/" + _node + "/ceph/pools", parameters); + } + + /** + * Create POOL + * + * @param name The name of the pool. It must be unique. + * @return Result + * @throws JSONException + */ + public Result createpool(String name) throws JSONException { + return createRest(name); + } + + } + + public class PVEFlags { + + private final PveClient _client; + private final Object _node; + + protected PVEFlags(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemFlag get(Object flag) { + return new PVEItemFlag(_client, _node, flag); + } + + public class PVEItemFlag { + + private final PveClient _client; + private final Object _node; + private final Object _flag; + + protected PVEItemFlag(PveClient client, Object node, Object flag) { + _client = client; + _node = node; + _flag = flag; + } + + /** + * Unset a ceph flag + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/ceph/flags/" + _flag + "", null); + } + + /** + * Unset a ceph flag + * + * @return Result + * @throws JSONException + */ + public Result unsetFlag() throws JSONException { + return deleteRest(); + } + + /** + * Set a specific ceph flag + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/ceph/flags/" + _flag + "", null); + } + + /** + * Set a specific ceph flag + * + * @return Result + * @throws JSONException + */ + public Result setFlag() throws JSONException { + return createRest(); + } + + } + + /** + * get all set ceph flags + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/flags", null); + } + + /** + * get all set ceph flags + * + * @return Result + * @throws JSONException + */ + public Result getFlags() throws JSONException { + return getRest(); + } + + } + + public class PVECrush { + + private final PveClient _client; + private final Object _node; + + protected PVECrush(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get OSD crush map + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/crush", null); + } + + /** + * Get OSD crush map + * + * @return Result + * @throws JSONException + */ + public Result crush() throws JSONException { + return getRest(); + } + + } + + public class PVELog { + + private final PveClient _client; + private final Object _node; + + protected PVELog(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Read ceph 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 + "/ceph/log", parameters); + } + + /** + * Read ceph log + * + * @param limit + * @param start + * @return Result + * @throws JSONException + */ + public Result log(Integer limit, Integer start) throws JSONException { + return getRest(limit, start); + } + + /** + * Read ceph log + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/log", null); + } + + /** + * Read ceph log + * + * @return Result + * @throws JSONException + */ + public Result log() throws JSONException { + return getRest(); + } + + } + + public class PVERules { + + private final PveClient _client; + private final Object _node; + + protected PVERules(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * List ceph rules. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph/rules", null); + } + + /** + * List ceph rules. + * + * @return Result + * @throws JSONException + */ + public Result rules() throws JSONException { + return getRest(); + } + + } + + /** + * Directory index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/ceph", null); + } + + /** + * Directory index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEVzdump { + + private final PveClient _client; + private final Object _node; + + protected PVEVzdump(PveClient client, Object node) { + _client = client; + _node = node; + } + + private PVEExtractconfig _extractconfig; + + public PVEExtractconfig getExtractconfig() { + if (_extractconfig == null) { + _extractconfig = new PVEExtractconfig(_client, _node); + } + + return _extractconfig; + } + + public class PVEExtractconfig { + + private final PveClient _client; + private final Object _node; + + protected PVEExtractconfig(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Extract configuration from vzdump backup archive. + * + * @param volume Volume identifier + * @return Result + * @throws JSONException + */ + public Result getRest(String volume) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("volume", volume); + return _client.get("/nodes/" + _node + "/vzdump/extractconfig", parameters); + } + + /** + * Extract configuration from vzdump backup archive. + * + * @param volume Volume identifier + * @return Result + * @throws JSONException + */ + public Result extractconfig(String volume) throws JSONException { + return getRest(volume); + } + + } + + /** + * Create backup. + * + * @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 dumpdir Store resulting files to specified directory. + * @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 pigz Use pigz instead of gzip when N&gt;0. N=1 + * uses half of cores, N&gt;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 stdout Write tar to stdout, not to a file. + * @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(Boolean all, Integer bwlimit, String compress, String dumpdir, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, Integer pigz, String pool, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stdout, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("all", all); + parameters.put("bwlimit", bwlimit); + parameters.put("compress", compress); + parameters.put("dumpdir", dumpdir); + 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("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("stdout", stdout); + parameters.put("stop", stop); + parameters.put("stopwait", stopwait); + parameters.put("storage", storage); + parameters.put("tmpdir", tmpdir); + parameters.put("vmid", vmid); + return _client.create("/nodes/" + _node + "/vzdump", parameters); + } + + /** + * Create backup. + * + * @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 dumpdir Store resulting files to specified directory. + * @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 pigz Use pigz instead of gzip when N&gt;0. N=1 + * uses half of cores, N&gt;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 stdout Write tar to stdout, not to a file. + * @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 vzdump(Boolean all, Integer bwlimit, String compress, String dumpdir, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, Integer pigz, String pool, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stdout, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) throws JSONException { + return createRest(all, bwlimit, compress, dumpdir, exclude, exclude_path, ionice, lockwait, mailnotification, mailto, maxfiles, mode, pigz, pool, quiet, remove, script, size, stdexcludes, stdout, stop, stopwait, storage, tmpdir, vmid); + } + + /** + * Create backup. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/vzdump", null); + } + + /** + * Create backup. + * + * @return Result + * @throws JSONException + */ + public Result vzdump() throws JSONException { + return createRest(); + } + + } + + public class PVEServices { + + private final PveClient _client; + private final Object _node; + + protected PVEServices(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemService get(Object service) { + return new PVEItemService(_client, _node, service); + } + + public class PVEItemService { + + private final PveClient _client; + private final Object _node; + private final Object _service; + + protected PVEItemService(PveClient client, Object node, Object service) { + _client = client; + _node = node; + _service = service; + } + + private PVEState _state; + + public PVEState getState() { + if (_state == null) { + _state = new PVEState(_client, _node, _service); + } + + return _state; + } + private PVEStart _start; + + public PVEStart getStart() { + if (_start == null) { + _start = new PVEStart(_client, _node, _service); + } + + return _start; + } + private PVEStop _stop; + + public PVEStop getStop() { + if (_stop == null) { + _stop = new PVEStop(_client, _node, _service); + } + + return _stop; + } + private PVERestart _restart; + + public PVERestart getRestart() { + if (_restart == null) { + _restart = new PVERestart(_client, _node, _service); + } + + return _restart; + } + private PVEReload _reload; + + public PVEReload getReload() { + if (_reload == null) { + _reload = new PVEReload(_client, _node, _service); + } + + return _reload; + } + + public class PVEState { + + private final PveClient _client; + private final Object _node; + private final Object _service; + + protected PVEState(PveClient client, Object node, Object service) { + _client = client; + _node = node; + _service = service; + } + + /** + * Read service properties + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/services/" + _service + "/state", null); + } + + /** + * Read service properties + * + * @return Result + * @throws JSONException + */ + public Result serviceState() throws JSONException { + return getRest(); + } + + } + + public class PVEStart { + + private final PveClient _client; + private final Object _node; + private final Object _service; + + protected PVEStart(PveClient client, Object node, Object service) { + _client = client; + _node = node; + _service = service; + } + + /** + * Start service. + * + * @return Result + * @throws JSONException + */ + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/services/" + _service + "/start", null); + } + + /** + * Start service. + * + * @return Result + * @throws JSONException + */ + public Result serviceStart() throws JSONException { + return createRest(); + } + + } + + public class PVEStop { + + private final PveClient _client; + private final Object _node; + private final Object _service; + + protected PVEStop(PveClient client, Object node, Object service) { + _client = client; + _node = node; + _service = service; + } + + /** + * Stop service. + * + * @return Result + * @throws JSONException + */ + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/services/" + _service + "/stop", null); + } + + /** + * Stop service. + * + * @return Result + * @throws JSONException + */ + public Result serviceStop() throws JSONException { + return createRest(); + } + + } + + public class PVERestart { + + private final PveClient _client; + private final Object _node; + private final Object _service; + + protected PVERestart(PveClient client, Object node, Object service) { + _client = client; + _node = node; + _service = service; + } + + /** + * Restart service. + * + * @return Result + * @throws JSONException + */ + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/services/" + _service + "/restart", null); + } + + /** + * Restart service. + * + * @return Result + * @throws JSONException + */ + public Result serviceRestart() throws JSONException { + return createRest(); + } + + } + + public class PVEReload { + + private final PveClient _client; + private final Object _node; + private final Object _service; + + protected PVEReload(PveClient client, Object node, Object service) { + _client = client; + _node = node; + _service = service; + } + + /** + * Reload service. + * + * @return Result + * @throws JSONException + */ + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/services/" + _service + "/reload", null); + } + + /** + * Reload service. + * + * @return Result + * @throws JSONException + */ + public Result serviceReload() throws JSONException { + return createRest(); + } + + } + + /** + * Directory index + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/services/" + _service + "", null); + } + + /** + * Directory index + * + * @return Result + * @throws JSONException + */ + public Result srvcmdidx() throws JSONException { + return getRest(); + } + + } + + /** + * Service list. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/services", null); + } + + /** + * Service list. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVESubscription { + + private final PveClient _client; + private final Object _node; + + protected PVESubscription(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Read subscription info. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/subscription", null); + } + + /** + * Read subscription info. + * + * @return Result + * @throws JSONException + */ + public Result get() throws JSONException { + return getRest(); + } + + /** + * Update subscription info. + * + * @param force Always connect to server, even if we have up to + * date info inside local cache. + * @return Result + * @throws JSONException + */ + + public Result createRest(Boolean force) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("force", force); + return _client.create("/nodes/" + _node + "/subscription", parameters); + } + + /** + * Update subscription info. + * + * @param force Always connect to server, even if we have up to + * date info inside local cache. + * @return Result + * @throws JSONException + */ + public Result update(Boolean force) throws JSONException { + return createRest(force); + } + + /** + * Update subscription info. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/subscription", null); + } + + /** + * Update subscription info. + * + * @return Result + * @throws JSONException + */ + public Result update() throws JSONException { + return createRest(); + } + + /** + * Set subscription key. + * + * @param key Proxmox VE subscription key + * @return Result + * @throws JSONException + */ + + public Result setRest(String key) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("key", key); + return _client.set("/nodes/" + _node + "/subscription", parameters); + } + + /** + * Set subscription key. + * + * @param key Proxmox VE subscription key + * @return Result + * @throws JSONException + */ + public Result set(String key) throws JSONException { + return setRest(key); + } + + } + + public class PVENetwork { + + private final PveClient _client; + private final Object _node; + + protected PVENetwork(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemIface get(Object iface) { + return new PVEItemIface(_client, _node, iface); + } + + public class PVEItemIface { + + private final PveClient _client; + private final Object _node; + private final Object _iface; + + protected PVEItemIface(PveClient client, Object node, Object iface) { + _client = client; + _node = node; + _iface = iface; + } + + /** + * Delete network device configuration + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/network/" + _iface + "", null); + } + + /** + * Delete network device configuration + * + * @return Result + * @throws JSONException + */ + public Result deleteNetwork() throws JSONException { + return deleteRest(); + } + + /** + * Read network device configuration + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/network/" + _iface + "", null); + } + + /** + * Read network device configuration + * + * @return Result + * @throws JSONException + */ + public Result networkConfig() throws JSONException { + return getRest(); + } + + /** + * Update network device configuration + * + * @param type Network interface type Enum: + * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown + * @param address IP address. + * @param address6 IP address. + * @param autostart Automatically start interface on boot. + * @param bond_mode Bonding mode. Enum: + * balance-rr,active-backup,balance-xor,broadcast,802.3ad,balance-tlb,balance-alb,balance-slb,lacp-balance-slb,lacp-balance-tcp + * @param bond_xmit_hash_policy Selects the transmit hash + * policy to use for slave selection in balance-xor and + * 802.3ad modes. Enum: layer2,layer2+3,layer3+4 + * @param bridge_ports Specify the interfaces you want to + * add to your bridge. + * @param bridge_vlan_aware Enable bridge vlan support. + * @param cidr IPv4 CIDR. + * @param cidr6 IPv6 CIDR. + * @param comments Comments + * @param comments6 Comments + * @param delete A list of settings you want to delete. + * @param gateway Default gateway address. + * @param gateway6 Default ipv6 gateway address. + * @param netmask Network mask. + * @param netmask6 Network mask. + * @param ovs_bonds Specify the interfaces used by the + * bonding device. + * @param ovs_bridge The OVS bridge associated with a OVS + * port. This is required when you create an OVS port. + * @param ovs_options OVS interface options. + * @param ovs_ports Specify the interfaces you want to add + * to your bridge. + * @param ovs_tag Specify a VLan tag (used by OVSPort, + * OVSIntPort, OVSBond) + * @param slaves Specify the interfaces used by the bonding + * device. + * @return Result + * @throws JSONException + */ + + public Result setRest(String type, String address, String address6, Boolean autostart, String bond_mode, String bond_xmit_hash_policy, String bridge_ports, Boolean bridge_vlan_aware, String cidr, String cidr6, String comments, String comments6, String delete, String gateway, String gateway6, String netmask, Integer netmask6, String ovs_bonds, String ovs_bridge, String ovs_options, String ovs_ports, Integer ovs_tag, String slaves) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("type", type); + parameters.put("address", address); + parameters.put("address6", address6); + parameters.put("autostart", autostart); + parameters.put("bond_mode", bond_mode); + parameters.put("bond_xmit_hash_policy", bond_xmit_hash_policy); + parameters.put("bridge_ports", bridge_ports); + parameters.put("bridge_vlan_aware", bridge_vlan_aware); + parameters.put("cidr", cidr); + parameters.put("cidr6", cidr6); + parameters.put("comments", comments); + parameters.put("comments6", comments6); + parameters.put("delete", delete); + parameters.put("gateway", gateway); + parameters.put("gateway6", gateway6); + parameters.put("netmask", netmask); + parameters.put("netmask6", netmask6); + parameters.put("ovs_bonds", ovs_bonds); + parameters.put("ovs_bridge", ovs_bridge); + parameters.put("ovs_options", ovs_options); + parameters.put("ovs_ports", ovs_ports); + parameters.put("ovs_tag", ovs_tag); + parameters.put("slaves", slaves); + return _client.set("/nodes/" + _node + "/network/" + _iface + "", parameters); + } + + /** + * Update network device configuration + * + * @param type Network interface type Enum: + * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown + * @param address IP address. + * @param address6 IP address. + * @param autostart Automatically start interface on boot. + * @param bond_mode Bonding mode. Enum: + * balance-rr,active-backup,balance-xor,broadcast,802.3ad,balance-tlb,balance-alb,balance-slb,lacp-balance-slb,lacp-balance-tcp + * @param bond_xmit_hash_policy Selects the transmit hash + * policy to use for slave selection in balance-xor and + * 802.3ad modes. Enum: layer2,layer2+3,layer3+4 + * @param bridge_ports Specify the interfaces you want to + * add to your bridge. + * @param bridge_vlan_aware Enable bridge vlan support. + * @param cidr IPv4 CIDR. + * @param cidr6 IPv6 CIDR. + * @param comments Comments + * @param comments6 Comments + * @param delete A list of settings you want to delete. + * @param gateway Default gateway address. + * @param gateway6 Default ipv6 gateway address. + * @param netmask Network mask. + * @param netmask6 Network mask. + * @param ovs_bonds Specify the interfaces used by the + * bonding device. + * @param ovs_bridge The OVS bridge associated with a OVS + * port. This is required when you create an OVS port. + * @param ovs_options OVS interface options. + * @param ovs_ports Specify the interfaces you want to add + * to your bridge. + * @param ovs_tag Specify a VLan tag (used by OVSPort, + * OVSIntPort, OVSBond) + * @param slaves Specify the interfaces used by the bonding + * device. + * @return Result + * @throws JSONException + */ + public Result updateNetwork(String type, String address, String address6, Boolean autostart, String bond_mode, String bond_xmit_hash_policy, String bridge_ports, Boolean bridge_vlan_aware, String cidr, String cidr6, String comments, String comments6, String delete, String gateway, String gateway6, String netmask, Integer netmask6, String ovs_bonds, String ovs_bridge, String ovs_options, String ovs_ports, Integer ovs_tag, String slaves) throws JSONException { + return setRest(type, address, address6, autostart, bond_mode, bond_xmit_hash_policy, bridge_ports, bridge_vlan_aware, cidr, cidr6, comments, comments6, delete, gateway, gateway6, netmask, netmask6, ovs_bonds, ovs_bridge, ovs_options, ovs_ports, ovs_tag, slaves); + } + + /** + * Update network device configuration + * + * @param type Network interface type Enum: + * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown + * @return Result + * @throws JSONException + */ + + public Result setRest(String type) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("type", type); + return _client.set("/nodes/" + _node + "/network/" + _iface + "", parameters); + } + + /** + * Update network device configuration + * + * @param type Network interface type Enum: + * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown + * @return Result + * @throws JSONException + */ + public Result updateNetwork(String type) throws JSONException { + return setRest(type); + } + + } + + /** + * Revert network configuration changes. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/network", null); + } + + /** + * Revert network configuration changes. + * + * @return Result + * @throws JSONException + */ + public Result revertNetworkChanges() throws JSONException { + return deleteRest(); + } + + /** + * List available networks + * + * @param type Only list specific interface types. Enum: + * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,any_bridge + * @return Result + * @throws JSONException + */ + + public Result getRest(String type) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("type", type); + return _client.get("/nodes/" + _node + "/network", parameters); + } + + /** + * List available networks + * + * @param type Only list specific interface types. Enum: + * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,any_bridge + * @return Result + * @throws JSONException + */ + public Result index(String type) throws JSONException { + return getRest(type); + } + + /** + * List available networks + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/network", null); + } + + /** + * List available networks + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create network device configuration + * + * @param iface Network interface name. + * @param type Network interface type Enum: + * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown + * @param address IP address. + * @param address6 IP address. + * @param autostart Automatically start interface on boot. + * @param bond_mode Bonding mode. Enum: + * balance-rr,active-backup,balance-xor,broadcast,802.3ad,balance-tlb,balance-alb,balance-slb,lacp-balance-slb,lacp-balance-tcp + * @param bond_xmit_hash_policy Selects the transmit hash policy + * to use for slave selection in balance-xor and 802.3ad modes. + * Enum: layer2,layer2+3,layer3+4 + * @param bridge_ports Specify the interfaces you want to add to + * your bridge. + * @param bridge_vlan_aware Enable bridge vlan support. + * @param cidr IPv4 CIDR. + * @param cidr6 IPv6 CIDR. + * @param comments Comments + * @param comments6 Comments + * @param gateway Default gateway address. + * @param gateway6 Default ipv6 gateway address. + * @param netmask Network mask. + * @param netmask6 Network mask. + * @param ovs_bonds Specify the interfaces used by the bonding + * device. + * @param ovs_bridge The OVS bridge associated with a OVS port. + * This is required when you create an OVS port. + * @param ovs_options OVS interface options. + * @param ovs_ports Specify the interfaces you want to add to + * your bridge. + * @param ovs_tag Specify a VLan tag (used by OVSPort, + * OVSIntPort, OVSBond) + * @param slaves Specify the interfaces used by the bonding + * device. + * @return Result + * @throws JSONException + */ + + public Result createRest(String iface, String type, String address, String address6, Boolean autostart, String bond_mode, String bond_xmit_hash_policy, String bridge_ports, Boolean bridge_vlan_aware, String cidr, String cidr6, String comments, String comments6, String gateway, String gateway6, String netmask, Integer netmask6, String ovs_bonds, String ovs_bridge, String ovs_options, String ovs_ports, Integer ovs_tag, String slaves) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("iface", iface); + parameters.put("type", type); + parameters.put("address", address); + parameters.put("address6", address6); + parameters.put("autostart", autostart); + parameters.put("bond_mode", bond_mode); + parameters.put("bond_xmit_hash_policy", bond_xmit_hash_policy); + parameters.put("bridge_ports", bridge_ports); + parameters.put("bridge_vlan_aware", bridge_vlan_aware); + parameters.put("cidr", cidr); + parameters.put("cidr6", cidr6); + parameters.put("comments", comments); + parameters.put("comments6", comments6); + parameters.put("gateway", gateway); + parameters.put("gateway6", gateway6); + parameters.put("netmask", netmask); + parameters.put("netmask6", netmask6); + parameters.put("ovs_bonds", ovs_bonds); + parameters.put("ovs_bridge", ovs_bridge); + parameters.put("ovs_options", ovs_options); + parameters.put("ovs_ports", ovs_ports); + parameters.put("ovs_tag", ovs_tag); + parameters.put("slaves", slaves); + return _client.create("/nodes/" + _node + "/network", parameters); + } + + /** + * Create network device configuration + * + * @param iface Network interface name. + * @param type Network interface type Enum: + * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown + * @param address IP address. + * @param address6 IP address. + * @param autostart Automatically start interface on boot. + * @param bond_mode Bonding mode. Enum: + * balance-rr,active-backup,balance-xor,broadcast,802.3ad,balance-tlb,balance-alb,balance-slb,lacp-balance-slb,lacp-balance-tcp + * @param bond_xmit_hash_policy Selects the transmit hash policy + * to use for slave selection in balance-xor and 802.3ad modes. + * Enum: layer2,layer2+3,layer3+4 + * @param bridge_ports Specify the interfaces you want to add to + * your bridge. + * @param bridge_vlan_aware Enable bridge vlan support. + * @param cidr IPv4 CIDR. + * @param cidr6 IPv6 CIDR. + * @param comments Comments + * @param comments6 Comments + * @param gateway Default gateway address. + * @param gateway6 Default ipv6 gateway address. + * @param netmask Network mask. + * @param netmask6 Network mask. + * @param ovs_bonds Specify the interfaces used by the bonding + * device. + * @param ovs_bridge The OVS bridge associated with a OVS port. + * This is required when you create an OVS port. + * @param ovs_options OVS interface options. + * @param ovs_ports Specify the interfaces you want to add to + * your bridge. + * @param ovs_tag Specify a VLan tag (used by OVSPort, + * OVSIntPort, OVSBond) + * @param slaves Specify the interfaces used by the bonding + * device. + * @return Result + * @throws JSONException + */ + public Result createNetwork(String iface, String type, String address, String address6, Boolean autostart, String bond_mode, String bond_xmit_hash_policy, String bridge_ports, Boolean bridge_vlan_aware, String cidr, String cidr6, String comments, String comments6, String gateway, String gateway6, String netmask, Integer netmask6, String ovs_bonds, String ovs_bridge, String ovs_options, String ovs_ports, Integer ovs_tag, String slaves) throws JSONException { + return createRest(iface, type, address, address6, autostart, bond_mode, bond_xmit_hash_policy, bridge_ports, bridge_vlan_aware, cidr, cidr6, comments, comments6, gateway, gateway6, netmask, netmask6, ovs_bonds, ovs_bridge, ovs_options, ovs_ports, ovs_tag, slaves); + } + + /** + * Create network device configuration + * + * @param iface Network interface name. + * @param type Network interface type Enum: + * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown + * @return Result + * @throws JSONException + */ + + public Result createRest(String iface, String type) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("iface", iface); + parameters.put("type", type); + return _client.create("/nodes/" + _node + "/network", parameters); + } + + /** + * Create network device configuration + * + * @param iface Network interface name. + * @param type Network interface type Enum: + * bridge,bond,eth,alias,vlan,OVSBridge,OVSBond,OVSPort,OVSIntPort,unknown + * @return Result + * @throws JSONException + */ + public Result createNetwork(String iface, String type) throws JSONException { + return createRest(iface, type); + } + + /** + * Reload network configuration + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/nodes/" + _node + "/network", null); + } + + /** + * Reload network configuration + * + * @return Result + * @throws JSONException + */ + public Result reloadNetworkConfig() throws JSONException { + return setRest(); + } + + } + + public class PVETasks { + + private final PveClient _client; + private final Object _node; + + protected PVETasks(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemUpid get(Object upid) { + return new PVEItemUpid(_client, _node, upid); + } + + public class PVEItemUpid { + + private final PveClient _client; + private final Object _node; + private final Object _upid; + + protected PVEItemUpid(PveClient client, Object node, Object upid) { + _client = client; + _node = node; + _upid = upid; + } + + private PVELog _log; + + public PVELog getLog() { + if (_log == null) { + _log = new PVELog(_client, _node, _upid); + } + + return _log; + } + private PVEStatus _status; + + public PVEStatus getStatus() { + if (_status == null) { + _status = new PVEStatus(_client, _node, _upid); + } + + return _status; + } + + public class PVELog { + + private final PveClient _client; + private final Object _node; + private final Object _upid; + + protected PVELog(PveClient client, Object node, Object upid) { + _client = client; + _node = node; + _upid = upid; + } + + /** + * Read task 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 + "/tasks/" + _upid + "/log", parameters); + } + + /** + * Read task log. + * + * @param limit + * @param start + * @return Result + * @throws JSONException + */ + public Result readTaskLog(Integer limit, Integer start) throws JSONException { + return getRest(limit, start); + } + + /** + * Read task log. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/tasks/" + _upid + "/log", null); + } + + /** + * Read task log. + * + * @return Result + * @throws JSONException + */ + public Result readTaskLog() throws JSONException { + return getRest(); + } + + } + + public class PVEStatus { + + private final PveClient _client; + private final Object _node; + private final Object _upid; + + protected PVEStatus(PveClient client, Object node, Object upid) { + _client = client; + _node = node; + _upid = upid; + } + + /** + * Read task status. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/tasks/" + _upid + "/status", null); + } + + /** + * Read task status. + * + * @return Result + * @throws JSONException + */ + public Result readTaskStatus() throws JSONException { + return getRest(); + } + + } + + /** + * Stop a task. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/tasks/" + _upid + "", null); + } + + /** + * Stop a task. + * + * @return Result + * @throws JSONException + */ + public Result stopTask() throws JSONException { + return deleteRest(); + } + + /** + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/tasks/" + _upid + "", null); + } + + /** + * + * @return Result + * @throws JSONException + */ + public Result upidIndex() throws JSONException { + return getRest(); + } + + } + + /** + * Read task list for one node (finished tasks). + * + * @param errors + * @param limit Only list this amount of tasks. + * @param source List archived, active or all tasks. Enum: + * archive,active,all + * @param start List tasks beginning from this offset. + * @param typefilter Only list tasks of this type (e.g., + * vzstart, vzdump). + * @param userfilter Only list tasks from this user. + * @param vmid Only list tasks for this VM. + * @return Result + * @throws JSONException + */ + public Result getRest(Boolean errors, Integer limit, String source, Integer start, String typefilter, String userfilter, Integer vmid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("errors", errors); + parameters.put("limit", limit); + parameters.put("source", source); + parameters.put("start", start); + parameters.put("typefilter", typefilter); + parameters.put("userfilter", userfilter); + parameters.put("vmid", vmid); + return _client.get("/nodes/" + _node + "/tasks", parameters); + } + + /** + * Read task list for one node (finished tasks). + * + * @param errors + * @param limit Only list this amount of tasks. + * @param source List archived, active or all tasks. Enum: + * archive,active,all + * @param start List tasks beginning from this offset. + * @param typefilter Only list tasks of this type (e.g., + * vzstart, vzdump). + * @param userfilter Only list tasks from this user. + * @param vmid Only list tasks for this VM. + * @return Result + * @throws JSONException + */ + public Result nodeTasks(Boolean errors, Integer limit, String source, Integer start, String typefilter, String userfilter, Integer vmid) throws JSONException { + return getRest(errors, limit, source, start, typefilter, userfilter, vmid); + } + + /** + * Read task list for one node (finished tasks). + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/tasks", null); + } + + /** + * Read task list for one node (finished tasks). + * + * @return Result + * @throws JSONException + */ + public Result nodeTasks() throws JSONException { + return getRest(); + } + + } + + public class PVEScan { + + private final PveClient _client; + private final Object _node; + + protected PVEScan(PveClient client, Object node) { + _client = client; + _node = node; + } + + private PVEZfs _zfs; + + public PVEZfs getZfs() { + if (_zfs == null) { + _zfs = new PVEZfs(_client, _node); + } + + return _zfs; + } + private PVENfs _nfs; + + public PVENfs getNfs() { + if (_nfs == null) { + _nfs = new PVENfs(_client, _node); + } + + return _nfs; + } + private PVECifs _cifs; + + public PVECifs getCifs() { + if (_cifs == null) { + _cifs = new PVECifs(_client, _node); + } + + return _cifs; + } + private PVEGlusterfs _glusterfs; + + public PVEGlusterfs getGlusterfs() { + if (_glusterfs == null) { + _glusterfs = new PVEGlusterfs(_client, _node); + } + + return _glusterfs; + } + private PVEIscsi _iscsi; + + public PVEIscsi getIscsi() { + if (_iscsi == null) { + _iscsi = new PVEIscsi(_client, _node); + } + + return _iscsi; + } + private PVELvm _lvm; + + public PVELvm getLvm() { + if (_lvm == null) { + _lvm = new PVELvm(_client, _node); + } + + return _lvm; + } + private PVELvmthin _lvmthin; + + public PVELvmthin getLvmthin() { + if (_lvmthin == null) { + _lvmthin = new PVELvmthin(_client, _node); + } + + return _lvmthin; + } + private PVEUsb _usb; + + public PVEUsb getUsb() { + if (_usb == null) { + _usb = new PVEUsb(_client, _node); + } + + return _usb; + } + + public class PVEZfs { + + private final PveClient _client; + private final Object _node; + + protected PVEZfs(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Scan zfs pool list on local node. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/scan/zfs", null); + } + + /** + * Scan zfs pool list on local node. + * + * @return Result + * @throws JSONException + */ + public Result zfsscan() throws JSONException { + return getRest(); + } + + } + + public class PVENfs { + + private final PveClient _client; + private final Object _node; + + protected PVENfs(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Scan remote NFS server. + * + * @param server The server address (name or IP). + * @return Result + * @throws JSONException + */ + public Result getRest(String server) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("server", server); + return _client.get("/nodes/" + _node + "/scan/nfs", parameters); + } + + /** + * Scan remote NFS server. + * + * @param server The server address (name or IP). + * @return Result + * @throws JSONException + */ + public Result nfsscan(String server) throws JSONException { + return getRest(server); + } + + } + + public class PVECifs { + + private final PveClient _client; + private final Object _node; + + protected PVECifs(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Scan remote CIFS server. + * + * @param server The server address (name or IP). + * @param domain SMB domain (Workgroup). + * @param password User password. + * @param username User name. + * @return Result + * @throws JSONException + */ + public Result getRest(String server, String domain, String password, String username) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("server", server); + parameters.put("domain", domain); + parameters.put("password", password); + parameters.put("username", username); + return _client.get("/nodes/" + _node + "/scan/cifs", parameters); + } + + /** + * Scan remote CIFS server. + * + * @param server The server address (name or IP). + * @param domain SMB domain (Workgroup). + * @param password User password. + * @param username User name. + * @return Result + * @throws JSONException + */ + public Result cifsscan(String server, String domain, String password, String username) throws JSONException { + return getRest(server, domain, password, username); + } + + /** + * Scan remote CIFS server. + * + * @param server The server address (name or IP). + * @return Result + * @throws JSONException + */ + + public Result getRest(String server) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("server", server); + return _client.get("/nodes/" + _node + "/scan/cifs", parameters); + } + + /** + * Scan remote CIFS server. + * + * @param server The server address (name or IP). + * @return Result + * @throws JSONException + */ + public Result cifsscan(String server) throws JSONException { + return getRest(server); + } + + } + + public class PVEGlusterfs { + + private final PveClient _client; + private final Object _node; + + protected PVEGlusterfs(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Scan remote GlusterFS server. + * + * @param server The server address (name or IP). + * @return Result + * @throws JSONException + */ + public Result getRest(String server) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("server", server); + return _client.get("/nodes/" + _node + "/scan/glusterfs", parameters); + } + + /** + * Scan remote GlusterFS server. + * + * @param server The server address (name or IP). + * @return Result + * @throws JSONException + */ + public Result glusterfsscan(String server) throws JSONException { + return getRest(server); + } + + } + + public class PVEIscsi { + + private final PveClient _client; + private final Object _node; + + protected PVEIscsi(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Scan remote iSCSI server. + * + * @param portal The iSCSI portal (IP or DNS name with + * optional port). + * @return Result + * @throws JSONException + */ + public Result getRest(String portal) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("portal", portal); + return _client.get("/nodes/" + _node + "/scan/iscsi", parameters); + } + + /** + * Scan remote iSCSI server. + * + * @param portal The iSCSI portal (IP or DNS name with + * optional port). + * @return Result + * @throws JSONException + */ + public Result iscsiscan(String portal) throws JSONException { + return getRest(portal); + } + + } + + public class PVELvm { + + private final PveClient _client; + private final Object _node; + + protected PVELvm(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * List local LVM volume groups. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/scan/lvm", null); + } + + /** + * List local LVM volume groups. + * + * @return Result + * @throws JSONException + */ + public Result lvmscan() throws JSONException { + return getRest(); + } + + } + + public class PVELvmthin { + + private final PveClient _client; + private final Object _node; + + protected PVELvmthin(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * List local LVM Thin Pools. + * + * @param vg + * @return Result + * @throws JSONException + */ + public Result getRest(String vg) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("vg", vg); + return _client.get("/nodes/" + _node + "/scan/lvmthin", parameters); + } + + /** + * List local LVM Thin Pools. + * + * @param vg + * @return Result + * @throws JSONException + */ + public Result lvmthinscan(String vg) throws JSONException { + return getRest(vg); + } + + } + + public class PVEUsb { + + private final PveClient _client; + private final Object _node; + + protected PVEUsb(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * List local USB devices. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/scan/usb", null); + } + + /** + * List local USB devices. + * + * @return Result + * @throws JSONException + */ + public Result usbscan() throws JSONException { + return getRest(); + } + + } + + /** + * Index of available scan methods + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/scan", null); + } + + /** + * Index of available scan methods + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEHardware { + + private final PveClient _client; + private final Object _node; + + protected PVEHardware(PveClient client, Object node) { + _client = client; + _node = node; + } + + private PVEPci _pci; + + public PVEPci getPci() { + if (_pci == null) { + _pci = new PVEPci(_client, _node); + } + + return _pci; + } + + public class PVEPci { + + private final PveClient _client; + private final Object _node; + + protected PVEPci(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemPciid get(Object pciid) { + return new PVEItemPciid(_client, _node, pciid); + } + + public class PVEItemPciid { + + private final PveClient _client; + private final Object _node; + private final Object _pciid; + + protected PVEItemPciid(PveClient client, Object node, Object pciid) { + _client = client; + _node = node; + _pciid = pciid; + } + + private PVEMdev _mdev; + + public PVEMdev getMdev() { + if (_mdev == null) { + _mdev = new PVEMdev(_client, _node, _pciid); + } + + return _mdev; + } + + public class PVEMdev { + + private final PveClient _client; + private final Object _node; + private final Object _pciid; + + protected PVEMdev(PveClient client, Object node, Object pciid) { + _client = client; + _node = node; + _pciid = pciid; + } + + /** + * List mediated device types for given PCI device. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/hardware/pci/" + _pciid + "/mdev", null); + } + + /** + * List mediated device types for given PCI device. + * + * @return Result + * @throws JSONException + */ + public Result mdevscan() throws JSONException { + return getRest(); + } + + } + + /** + * Index of available pci methods + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/hardware/pci/" + _pciid + "", null); + } + + /** + * Index of available pci methods + * + * @return Result + * @throws JSONException + */ + public Result pciindex() throws JSONException { + return getRest(); + } + + } + + /** + * List local PCI devices. + * + * @param pci_class_blacklist A list of blacklisted PCI + * classes, which will not be returned. Following are + * filtered by default: Memory Controller (05), Bridge (06), + * Generic System Peripheral (08) and Processor (0b). + * @param verbose If disabled, does only print the PCI IDs. + * Otherwise, additional information like vendor and device + * will be returned. + * @return Result + * @throws JSONException + */ + public Result getRest(String pci_class_blacklist, Boolean verbose) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("pci-class-blacklist", pci_class_blacklist); + parameters.put("verbose", verbose); + return _client.get("/nodes/" + _node + "/hardware/pci", parameters); + } + + /** + * List local PCI devices. + * + * @param pci_class_blacklist A list of blacklisted PCI + * classes, which will not be returned. Following are + * filtered by default: Memory Controller (05), Bridge (06), + * Generic System Peripheral (08) and Processor (0b). + * @param verbose If disabled, does only print the PCI IDs. + * Otherwise, additional information like vendor and device + * will be returned. + * @return Result + * @throws JSONException + */ + public Result pciscan(String pci_class_blacklist, Boolean verbose) throws JSONException { + return getRest(pci_class_blacklist, verbose); + } + + /** + * List local PCI devices. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/hardware/pci", null); + } + + /** + * List local PCI devices. + * + * @return Result + * @throws JSONException + */ + public Result pciscan() throws JSONException { + return getRest(); + } + + } + + /** + * Index of hardware types + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/hardware", null); + } + + /** + * Index of hardware types + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEStorage { + + private final PveClient _client; + private final Object _node; + + protected PVEStorage(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemStorage get(Object storage) { + return new PVEItemStorage(_client, _node, storage); + } + + public class PVEItemStorage { + + private final PveClient _client; + private final Object _node; + private final Object _storage; + + protected PVEItemStorage(PveClient client, Object node, Object storage) { + _client = client; + _node = node; + _storage = storage; + } + + private PVEContent _content; + + public PVEContent getContent() { + if (_content == null) { + _content = new PVEContent(_client, _node, _storage); + } + + return _content; + } + private PVEStatus _status; + + public PVEStatus getStatus() { + if (_status == null) { + _status = new PVEStatus(_client, _node, _storage); + } + + return _status; + } + private PVERrd _rrd; + + public PVERrd getRrd() { + if (_rrd == null) { + _rrd = new PVERrd(_client, _node, _storage); + } + + return _rrd; + } + private PVERrddata _rrddata; + + public PVERrddata getRrddata() { + if (_rrddata == null) { + _rrddata = new PVERrddata(_client, _node, _storage); + } + + return _rrddata; + } + private PVEUpload _upload; + + public PVEUpload getUpload() { + if (_upload == null) { + _upload = new PVEUpload(_client, _node, _storage); + } + + return _upload; + } + + public class PVEContent { + + private final PveClient _client; + private final Object _node; + private final Object _storage; + + protected PVEContent(PveClient client, Object node, Object storage) { + _client = client; + _node = node; + _storage = storage; + } + + public PVEItemVolume get(Object volume) { + return new PVEItemVolume(_client, _node, _storage, volume); + } + + public class PVEItemVolume { + + private final PveClient _client; + private final Object _node; + private final Object _storage; + private final Object _volume; + + protected PVEItemVolume(PveClient client, Object node, Object storage, Object volume) { + _client = client; + _node = node; + _storage = storage; + _volume = volume; + } + + /** + * Delete volume + * + * @param delay Time to wait for the task to finish. + * We return 'null' if the task finish within that + * time. + * @return Result + * @throws JSONException + */ + public Result deleteRest(Integer delay) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("delay", delay); + return _client.delete("/nodes/" + _node + "/storage/" + _storage + "/content/" + _volume + "", parameters); + } + + /** + * Delete volume + * + * @param delay Time to wait for the task to finish. + * We return 'null' if the task finish within that + * time. + * @return Result + * @throws JSONException + */ + public Result delete(Integer delay) throws JSONException { + return deleteRest(delay); + } + + /** + * Delete volume + * + * @return Result + * @throws JSONException + */ + + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/storage/" + _storage + "/content/" + _volume + "", null); + } + + /** + * Delete volume + * + * @return Result + * @throws JSONException + */ + public Result delete() throws JSONException { + return deleteRest(); + } + + /** + * Get volume attributes + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/storage/" + _storage + "/content/" + _volume + "", null); + } + + /** + * Get volume attributes + * + * @return Result + * @throws JSONException + */ + public Result info() throws JSONException { + return getRest(); + } + + /** + * Copy a volume. This is experimental code - do not + * use. + * + * @param target Target volume identifier + * @param target_node Target node. Default is local + * node. + * @return Result + * @throws JSONException + */ + + public Result createRest(String target, String target_node) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("target", target); + parameters.put("target_node", target_node); + return _client.create("/nodes/" + _node + "/storage/" + _storage + "/content/" + _volume + "", parameters); + } + + /** + * Copy a volume. This is experimental code - do not + * use. + * + * @param target Target volume identifier + * @param target_node Target node. Default is local + * node. + * @return Result + * @throws JSONException + */ + public Result copy(String target, String target_node) throws JSONException { + return createRest(target, target_node); + } + + /** + * Copy a volume. This is experimental code - do not + * use. + * + * @param target Target volume identifier + * @return Result + * @throws JSONException + */ + + public Result createRest(String target) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("target", target); + return _client.create("/nodes/" + _node + "/storage/" + _storage + "/content/" + _volume + "", parameters); + } + + /** + * Copy a volume. This is experimental code - do not + * use. + * + * @param target Target volume identifier + * @return Result + * @throws JSONException + */ + public Result copy(String target) throws JSONException { + return createRest(target); + } + + } + + /** + * List storage content. + * + * @param content Only list content of this type. + * @param vmid Only list images for this VM + * @return Result + * @throws JSONException + */ + public Result getRest(String content, Integer vmid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("content", content); + parameters.put("vmid", vmid); + return _client.get("/nodes/" + _node + "/storage/" + _storage + "/content", parameters); + } + + /** + * List storage content. + * + * @param content Only list content of this type. + * @param vmid Only list images for this VM + * @return Result + * @throws JSONException + */ + public Result index(String content, Integer vmid) throws JSONException { + return getRest(content, vmid); + } + + /** + * List storage content. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/storage/" + _storage + "/content", null); + } + + /** + * List storage content. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Allocate disk images. + * + * @param filename The name of the file to create. + * @param size Size in kilobyte (1024 bytes). Optional + * suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, + * 1024M) + * @param vmid Specify owner VM + * @param format Enum: raw,qcow2,subvol + * @return Result + * @throws JSONException + */ + + public Result createRest(String filename, String size, int vmid, String format) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("filename", filename); + parameters.put("size", size); + parameters.put("vmid", vmid); + parameters.put("format", format); + return _client.create("/nodes/" + _node + "/storage/" + _storage + "/content", parameters); + } + + /** + * Allocate disk images. + * + * @param filename The name of the file to create. + * @param size Size in kilobyte (1024 bytes). Optional + * suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, + * 1024M) + * @param vmid Specify owner VM + * @param format Enum: raw,qcow2,subvol + * @return Result + * @throws JSONException + */ + public Result create(String filename, String size, int vmid, String format) throws JSONException { + return createRest(filename, size, vmid, format); + } + + /** + * Allocate disk images. + * + * @param filename The name of the file to create. + * @param size Size in kilobyte (1024 bytes). Optional + * suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, + * 1024M) + * @param vmid Specify owner VM + * @return Result + * @throws JSONException + */ + + public Result createRest(String filename, String size, int vmid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("filename", filename); + parameters.put("size", size); + parameters.put("vmid", vmid); + return _client.create("/nodes/" + _node + "/storage/" + _storage + "/content", parameters); + } + + /** + * Allocate disk images. + * + * @param filename The name of the file to create. + * @param size Size in kilobyte (1024 bytes). Optional + * suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, + * 1024M) + * @param vmid Specify owner VM + * @return Result + * @throws JSONException + */ + public Result create(String filename, String size, int vmid) throws JSONException { + return createRest(filename, size, vmid); + } + + } + + public class PVEStatus { + + private final PveClient _client; + private final Object _node; + private final Object _storage; + + protected PVEStatus(PveClient client, Object node, Object storage) { + _client = client; + _node = node; + _storage = storage; + } + + /** + * Read storage status. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/storage/" + _storage + "/status", null); + } + + /** + * Read storage status. + * + * @return Result + * @throws JSONException + */ + public Result readStatus() throws JSONException { + return getRest(); + } + + } + + public class PVERrd { + + private final PveClient _client; + private final Object _node; + private final Object _storage; + + protected PVERrd(PveClient client, Object node, Object storage) { + _client = client; + _node = node; + _storage = storage; + } + + /** + * Read storage 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 + "/storage/" + _storage + "/rrd", parameters); + } + + /** + * Read storage 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 storage 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 + "/storage/" + _storage + "/rrd", parameters); + } + + /** + * Read storage 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 _storage; + + protected PVERrddata(PveClient client, Object node, Object storage) { + _client = client; + _node = node; + _storage = storage; + } + + /** + * Read storage 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 + "/storage/" + _storage + "/rrddata", parameters); + } + + /** + * Read storage 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 storage 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 + "/storage/" + _storage + "/rrddata", parameters); + } + + /** + * Read storage 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 PVEUpload { + + private final PveClient _client; + private final Object _node; + private final Object _storage; + + protected PVEUpload(PveClient client, Object node, Object storage) { + _client = client; + _node = node; + _storage = storage; + } + + /** + * Upload templates and ISO images. + * + * @param content Content type. + * @param filename The name of the file to create. + * @param tmpfilename The source file name. This + * parameter is usually set by the REST handler. You can + * only overwrite it when connecting to the trusted port + * on localhost. + * @return Result + * @throws JSONException + */ + public Result createRest(String content, String filename, String tmpfilename) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("content", content); + parameters.put("filename", filename); + parameters.put("tmpfilename", tmpfilename); + return _client.create("/nodes/" + _node + "/storage/" + _storage + "/upload", parameters); + } + + /** + * Upload templates and ISO images. + * + * @param content Content type. + * @param filename The name of the file to create. + * @param tmpfilename The source file name. This + * parameter is usually set by the REST handler. You can + * only overwrite it when connecting to the trusted port + * on localhost. + * @return Result + * @throws JSONException + */ + public Result upload(String content, String filename, String tmpfilename) throws JSONException { + return createRest(content, filename, tmpfilename); + } + + /** + * Upload templates and ISO images. + * + * @param content Content type. + * @param filename The name of the file to create. + * @return Result + * @throws JSONException + */ + + public Result createRest(String content, String filename) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("content", content); + parameters.put("filename", filename); + return _client.create("/nodes/" + _node + "/storage/" + _storage + "/upload", parameters); + } + + /** + * Upload templates and ISO images. + * + * @param content Content type. + * @param filename The name of the file to create. + * @return Result + * @throws JSONException + */ + public Result upload(String content, String filename) throws JSONException { + return createRest(content, filename); + } + + } + + /** + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/storage/" + _storage + "", null); + } + + /** + * + * @return Result + * @throws JSONException + */ + public Result diridx() throws JSONException { + return getRest(); + } + + } + + /** + * Get status for all datastores. + * + * @param content Only list stores which support this content + * type. + * @param enabled Only list stores which are enabled (not + * disabled in config). + * @param format Include information about formats + * @param storage Only list status for specified storage + * @param target If target is different to 'node', we only lists + * shared storages which content is accessible on this 'node' + * and the specified 'target' node. + * @return Result + * @throws JSONException + */ + public Result getRest(String content, Boolean enabled, Boolean format, String storage, String target) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("content", content); + parameters.put("enabled", enabled); + parameters.put("format", format); + parameters.put("storage", storage); + parameters.put("target", target); + return _client.get("/nodes/" + _node + "/storage", parameters); + } + + /** + * Get status for all datastores. + * + * @param content Only list stores which support this content + * type. + * @param enabled Only list stores which are enabled (not + * disabled in config). + * @param format Include information about formats + * @param storage Only list status for specified storage + * @param target If target is different to 'node', we only lists + * shared storages which content is accessible on this 'node' + * and the specified 'target' node. + * @return Result + * @throws JSONException + */ + public Result index(String content, Boolean enabled, Boolean format, String storage, String target) throws JSONException { + return getRest(content, enabled, format, storage, target); + } + + /** + * Get status for all datastores. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/storage", null); + } + + /** + * Get status for all datastores. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEDisks { + + private final PveClient _client; + private final Object _node; + + protected PVEDisks(PveClient client, Object node) { + _client = client; + _node = node; + } + + private PVELvm _lvm; + + public PVELvm getLvm() { + if (_lvm == null) { + _lvm = new PVELvm(_client, _node); + } + + return _lvm; + } + private PVELvmthin _lvmthin; + + public PVELvmthin getLvmthin() { + if (_lvmthin == null) { + _lvmthin = new PVELvmthin(_client, _node); + } + + return _lvmthin; + } + private PVEDirectory _directory; + + public PVEDirectory getDirectory() { + if (_directory == null) { + _directory = new PVEDirectory(_client, _node); + } + + return _directory; + } + private PVEZfs _zfs; + + public PVEZfs getZfs() { + if (_zfs == null) { + _zfs = new PVEZfs(_client, _node); + } + + return _zfs; + } + private PVEList _list; + + public PVEList getList() { + if (_list == null) { + _list = new PVEList(_client, _node); + } + + return _list; + } + private PVESmart _smart; + + public PVESmart getSmart() { + if (_smart == null) { + _smart = new PVESmart(_client, _node); + } + + return _smart; + } + private PVEInitgpt _initgpt; + + public PVEInitgpt getInitgpt() { + if (_initgpt == null) { + _initgpt = new PVEInitgpt(_client, _node); + } + + return _initgpt; + } + + public class PVELvm { + + private final PveClient _client; + private final Object _node; + + protected PVELvm(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * List LVM Volume Groups + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/disks/lvm", null); + } + + /** + * List LVM Volume Groups + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create an LVM Volume Group + * + * @param device The block device you want to create the + * volume group on + * @param name The storage identifier. + * @param add_storage Configure storage using the Volume + * Group + * @return Result + * @throws JSONException + */ + + public Result createRest(String device, String name, Boolean add_storage) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("device", device); + parameters.put("name", name); + parameters.put("add_storage", add_storage); + return _client.create("/nodes/" + _node + "/disks/lvm", parameters); + } + + /** + * Create an LVM Volume Group + * + * @param device The block device you want to create the + * volume group on + * @param name The storage identifier. + * @param add_storage Configure storage using the Volume + * Group + * @return Result + * @throws JSONException + */ + public Result create(String device, String name, Boolean add_storage) throws JSONException { + return createRest(device, name, add_storage); + } + + /** + * Create an LVM Volume Group + * + * @param device The block device you want to create the + * volume group on + * @param name The storage identifier. + * @return Result + * @throws JSONException + */ + + public Result createRest(String device, String name) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("device", device); + parameters.put("name", name); + return _client.create("/nodes/" + _node + "/disks/lvm", parameters); + } + + /** + * Create an LVM Volume Group + * + * @param device The block device you want to create the + * volume group on + * @param name The storage identifier. + * @return Result + * @throws JSONException + */ + public Result create(String device, String name) throws JSONException { + return createRest(device, name); + } + + } + + public class PVELvmthin { + + private final PveClient _client; + private final Object _node; + + protected PVELvmthin(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * List LVM thinpools + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/disks/lvmthin", null); + } + + /** + * List LVM thinpools + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create an LVM thinpool + * + * @param device The block device you want to create the + * thinpool on. + * @param name The storage identifier. + * @param add_storage Configure storage using the thinpool. + * @return Result + * @throws JSONException + */ + + public Result createRest(String device, String name, Boolean add_storage) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("device", device); + parameters.put("name", name); + parameters.put("add_storage", add_storage); + return _client.create("/nodes/" + _node + "/disks/lvmthin", parameters); + } + + /** + * Create an LVM thinpool + * + * @param device The block device you want to create the + * thinpool on. + * @param name The storage identifier. + * @param add_storage Configure storage using the thinpool. + * @return Result + * @throws JSONException + */ + public Result create(String device, String name, Boolean add_storage) throws JSONException { + return createRest(device, name, add_storage); + } + + /** + * Create an LVM thinpool + * + * @param device The block device you want to create the + * thinpool on. + * @param name The storage identifier. + * @return Result + * @throws JSONException + */ + + public Result createRest(String device, String name) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("device", device); + parameters.put("name", name); + return _client.create("/nodes/" + _node + "/disks/lvmthin", parameters); + } + + /** + * Create an LVM thinpool + * + * @param device The block device you want to create the + * thinpool on. + * @param name The storage identifier. + * @return Result + * @throws JSONException + */ + public Result create(String device, String name) throws JSONException { + return createRest(device, name); + } + + } + + public class PVEDirectory { + + private final PveClient _client; + private final Object _node; + + protected PVEDirectory(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * PVE Managed Directory storages. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/disks/directory", null); + } + + /** + * PVE Managed Directory storages. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create a Filesystem on an unused disk. Will be mounted + * under '/mnt/pve/NAME'. + * + * @param device The block device you want to create the + * filesystem on. + * @param name The storage identifier. + * @param add_storage Configure storage using the directory. + * @param filesystem The desired filesystem. Enum: ext4,xfs + * @return Result + * @throws JSONException + */ + + public Result createRest(String device, String name, Boolean add_storage, String filesystem) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("device", device); + parameters.put("name", name); + parameters.put("add_storage", add_storage); + parameters.put("filesystem", filesystem); + return _client.create("/nodes/" + _node + "/disks/directory", parameters); + } + + /** + * Create a Filesystem on an unused disk. Will be mounted + * under '/mnt/pve/NAME'. + * + * @param device The block device you want to create the + * filesystem on. + * @param name The storage identifier. + * @param add_storage Configure storage using the directory. + * @param filesystem The desired filesystem. Enum: ext4,xfs + * @return Result + * @throws JSONException + */ + public Result create(String device, String name, Boolean add_storage, String filesystem) throws JSONException { + return createRest(device, name, add_storage, filesystem); + } + + /** + * Create a Filesystem on an unused disk. Will be mounted + * under '/mnt/pve/NAME'. + * + * @param device The block device you want to create the + * filesystem on. + * @param name The storage identifier. + * @return Result + * @throws JSONException + */ + + public Result createRest(String device, String name) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("device", device); + parameters.put("name", name); + return _client.create("/nodes/" + _node + "/disks/directory", parameters); + } + + /** + * Create a Filesystem on an unused disk. Will be mounted + * under '/mnt/pve/NAME'. + * + * @param device The block device you want to create the + * filesystem on. + * @param name The storage identifier. + * @return Result + * @throws JSONException + */ + public Result create(String device, String name) throws JSONException { + return createRest(device, name); + } + + } + + public class PVEZfs { + + private final PveClient _client; + private final Object _node; + + protected PVEZfs(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemName get(Object name) { + return new PVEItemName(_client, _node, name); + } + + public class PVEItemName { + + private final PveClient _client; + private final Object _node; + private final Object _name; + + protected PVEItemName(PveClient client, Object node, Object name) { + _client = client; + _node = node; + _name = name; + } + + /** + * Get details about a zpool. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/disks/zfs/" + _name + "", null); + } + + /** + * Get details about a zpool. + * + * @return Result + * @throws JSONException + */ + public Result detail() throws JSONException { + return getRest(); + } + + } + + /** + * List Zpools. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/disks/zfs", null); + } + + /** + * List Zpools. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create a ZFS pool. + * + * @param devices The block devices you want to create the + * zpool on. + * @param name The storage identifier. + * @param raidlevel The RAID level to use. Enum: + * single,mirror,raid10,raidz,raidz2,raidz3 + * @param add_storage Configure storage using the zpool. + * @param ashift Pool sector size exponent. + * @param compression The compression algorithm to use. + * Enum: on,off,gzip,lz4,lzjb,zle + * @return Result + * @throws JSONException + */ + + public Result createRest(String devices, String name, String raidlevel, Boolean add_storage, Integer ashift, String compression) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("devices", devices); + parameters.put("name", name); + parameters.put("raidlevel", raidlevel); + parameters.put("add_storage", add_storage); + parameters.put("ashift", ashift); + parameters.put("compression", compression); + return _client.create("/nodes/" + _node + "/disks/zfs", parameters); + } + + /** + * Create a ZFS pool. + * + * @param devices The block devices you want to create the + * zpool on. + * @param name The storage identifier. + * @param raidlevel The RAID level to use. Enum: + * single,mirror,raid10,raidz,raidz2,raidz3 + * @param add_storage Configure storage using the zpool. + * @param ashift Pool sector size exponent. + * @param compression The compression algorithm to use. + * Enum: on,off,gzip,lz4,lzjb,zle + * @return Result + * @throws JSONException + */ + public Result create(String devices, String name, String raidlevel, Boolean add_storage, Integer ashift, String compression) throws JSONException { + return createRest(devices, name, raidlevel, add_storage, ashift, compression); + } + + /** + * Create a ZFS pool. + * + * @param devices The block devices you want to create the + * zpool on. + * @param name The storage identifier. + * @param raidlevel The RAID level to use. Enum: + * single,mirror,raid10,raidz,raidz2,raidz3 + * @return Result + * @throws JSONException + */ + + public Result createRest(String devices, String name, String raidlevel) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("devices", devices); + parameters.put("name", name); + parameters.put("raidlevel", raidlevel); + return _client.create("/nodes/" + _node + "/disks/zfs", parameters); + } + + /** + * Create a ZFS pool. + * + * @param devices The block devices you want to create the + * zpool on. + * @param name The storage identifier. + * @param raidlevel The RAID level to use. Enum: + * single,mirror,raid10,raidz,raidz2,raidz3 + * @return Result + * @throws JSONException + */ + public Result create(String devices, String name, String raidlevel) throws JSONException { + return createRest(devices, name, raidlevel); + } + + } + + public class PVEList { + + private final PveClient _client; + private final Object _node; + + protected PVEList(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * List local disks. + * + * @param skipsmart Skip smart checks. + * @param type Only list specific types of disks. Enum: + * unused,journal_disks + * @return Result + * @throws JSONException + */ + public Result getRest(Boolean skipsmart, String type) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("skipsmart", skipsmart); + parameters.put("type", type); + return _client.get("/nodes/" + _node + "/disks/list", parameters); + } + + /** + * List local disks. + * + * @param skipsmart Skip smart checks. + * @param type Only list specific types of disks. Enum: + * unused,journal_disks + * @return Result + * @throws JSONException + */ + public Result list(Boolean skipsmart, String type) throws JSONException { + return getRest(skipsmart, type); + } + + /** + * List local disks. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/disks/list", null); + } + + /** + * List local disks. + * + * @return Result + * @throws JSONException + */ + public Result list() throws JSONException { + return getRest(); + } + + } + + public class PVESmart { + + private final PveClient _client; + private final Object _node; + + protected PVESmart(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get SMART Health of a disk. + * + * @param disk Block device name + * @param healthonly If true returns only the health status + * @return Result + * @throws JSONException + */ + public Result getRest(String disk, Boolean healthonly) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("disk", disk); + parameters.put("healthonly", healthonly); + return _client.get("/nodes/" + _node + "/disks/smart", parameters); + } + + /** + * Get SMART Health of a disk. + * + * @param disk Block device name + * @param healthonly If true returns only the health status + * @return Result + * @throws JSONException + */ + public Result smart(String disk, Boolean healthonly) throws JSONException { + return getRest(disk, healthonly); + } + + /** + * Get SMART Health of a disk. + * + * @param disk Block device name + * @return Result + * @throws JSONException + */ + + public Result getRest(String disk) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("disk", disk); + return _client.get("/nodes/" + _node + "/disks/smart", parameters); + } + + /** + * Get SMART Health of a disk. + * + * @param disk Block device name + * @return Result + * @throws JSONException + */ + public Result smart(String disk) throws JSONException { + return getRest(disk); + } + + } + + public class PVEInitgpt { + + private final PveClient _client; + private final Object _node; + + protected PVEInitgpt(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Initialize Disk with GPT + * + * @param disk Block device name + * @param uuid UUID for the GPT table + * @return Result + * @throws JSONException + */ + public Result createRest(String disk, String uuid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("disk", disk); + parameters.put("uuid", uuid); + return _client.create("/nodes/" + _node + "/disks/initgpt", parameters); + } + + /** + * Initialize Disk with GPT + * + * @param disk Block device name + * @param uuid UUID for the GPT table + * @return Result + * @throws JSONException + */ + public Result initgpt(String disk, String uuid) throws JSONException { + return createRest(disk, uuid); + } + + /** + * Initialize Disk with GPT + * + * @param disk Block device name + * @return Result + * @throws JSONException + */ + + public Result createRest(String disk) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("disk", disk); + return _client.create("/nodes/" + _node + "/disks/initgpt", parameters); + } + + /** + * Initialize Disk with GPT + * + * @param disk Block device name + * @return Result + * @throws JSONException + */ + public Result initgpt(String disk) throws JSONException { + return createRest(disk); + } + + } + + /** + * Node index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/disks", null); + } + + /** + * Node index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEApt { + + private final PveClient _client; + private final Object _node; + + protected PVEApt(PveClient client, Object node) { + _client = client; + _node = node; + } + + private PVEUpdate _update; + + public PVEUpdate getUpdate() { + if (_update == null) { + _update = new PVEUpdate(_client, _node); + } + + return _update; + } + private PVEChangelog _changelog; + + public PVEChangelog getChangelog() { + if (_changelog == null) { + _changelog = new PVEChangelog(_client, _node); + } + + return _changelog; + } + private PVEVersions _versions; + + public PVEVersions getVersions() { + if (_versions == null) { + _versions = new PVEVersions(_client, _node); + } + + return _versions; + } + + public class PVEUpdate { + + private final PveClient _client; + private final Object _node; + + protected PVEUpdate(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * List available updates. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/apt/update", null); + } + + /** + * List available updates. + * + * @return Result + * @throws JSONException + */ + public Result listUpdates() throws JSONException { + return getRest(); + } + + /** + * This is used to resynchronize the package index files + * from their sources (apt-get update). + * + * @param notify Send notification mail about new packages + * (to email address specified for user 'root@pam'). + * @param quiet Only produces output suitable for logging, + * omitting progress indicators. + * @return Result + * @throws JSONException + */ + + public Result createRest(Boolean notify, Boolean quiet) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("notify", notify); + parameters.put("quiet", quiet); + return _client.create("/nodes/" + _node + "/apt/update", parameters); + } + + /** + * This is used to resynchronize the package index files + * from their sources (apt-get update). + * + * @param notify Send notification mail about new packages + * (to email address specified for user 'root@pam'). + * @param quiet Only produces output suitable for logging, + * omitting progress indicators. + * @return Result + * @throws JSONException + */ + public Result updateDatabase(Boolean notify, Boolean quiet) throws JSONException { + return createRest(notify, quiet); + } + + /** + * This is used to resynchronize the package index files + * from their sources (apt-get update). + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/apt/update", null); + } + + /** + * This is used to resynchronize the package index files + * from their sources (apt-get update). + * + * @return Result + * @throws JSONException + */ + public Result updateDatabase() throws JSONException { + return createRest(); + } + + } + + public class PVEChangelog { + + private final PveClient _client; + private final Object _node; + + protected PVEChangelog(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get package changelogs. + * + * @param name Package name. + * @param version Package version. + * @return Result + * @throws JSONException + */ + public Result getRest(String name, String version) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("name", name); + parameters.put("version", version); + return _client.get("/nodes/" + _node + "/apt/changelog", parameters); + } + + /** + * Get package changelogs. + * + * @param name Package name. + * @param version Package version. + * @return Result + * @throws JSONException + */ + public Result changelog(String name, String version) throws JSONException { + return getRest(name, version); + } + + /** + * Get package changelogs. + * + * @param name Package name. + * @return Result + * @throws JSONException + */ + + public Result getRest(String name) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("name", name); + return _client.get("/nodes/" + _node + "/apt/changelog", parameters); + } + + /** + * Get package changelogs. + * + * @param name Package name. + * @return Result + * @throws JSONException + */ + public Result changelog(String name) throws JSONException { + return getRest(name); + } + + } + + public class PVEVersions { + + private final PveClient _client; + private final Object _node; + + protected PVEVersions(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get package information for important Proxmox packages. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/apt/versions", null); + } + + /** + * Get package information for important Proxmox packages. + * + * @return Result + * @throws JSONException + */ + public Result versions() throws JSONException { + return getRest(); + } + + } + + /** + * Directory index for apt (Advanced Package Tool). + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/apt", null); + } + + /** + * Directory index for apt (Advanced Package Tool). + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEFirewall { + + private final PveClient _client; + private final Object _node; + + protected PVEFirewall(PveClient client, Object node) { + _client = client; + _node = node; + } + + private PVERules _rules; + + public PVERules getRules() { + if (_rules == null) { + _rules = new PVERules(_client, _node); + } + + return _rules; + } + private PVEOptions _options; + + public PVEOptions getOptions() { + if (_options == null) { + _options = new PVEOptions(_client, _node); + } + + return _options; + } + private PVELog _log; + + public PVELog getLog() { + if (_log == null) { + _log = new PVELog(_client, _node); + } + + return _log; + } + + public class PVERules { + + private final PveClient _client; + private final Object _node; + + protected PVERules(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemPos get(Object pos) { + return new PVEItemPos(_client, _node, pos); + } + + public class PVEItemPos { + + private final PveClient _client; + private final Object _node; + private final Object _pos; + + protected PVEItemPos(PveClient client, Object node, Object pos) { + _client = client; + _node = node; + _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 + "/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 + "/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 + "/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 + * &lt;moveto&gt;. 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 + "/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 + * &lt;moveto&gt;. 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 + "/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 + "/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 &lt;pos&gt;. + * @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 + "/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 &lt;pos&gt;. + * @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 + "/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 PVEOptions { + + private final PveClient _client; + private final Object _node; + + protected PVEOptions(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get host firewall options. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/firewall/options", null); + } + + /** + * Get host 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 enable Enable host firewall rules. + * @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 log_nf_conntrack Enable logging of conntrack + * information. + * @param ndp Enable NDP (Neighbor Discovery Protocol). + * @param nf_conntrack_allow_invalid Allow invalid packets + * on connection tracking. + * @param nf_conntrack_max Maximum number of tracked + * connections. + * @param nf_conntrack_tcp_timeout_established Conntrack + * established timeout. + * @param nf_conntrack_tcp_timeout_syn_recv Conntrack syn + * recv timeout. + * @param nosmurfs Enable SMURFS filter. + * @param protection_synflood Enable synflood protection + * @param protection_synflood_burst Synflood protection rate + * burst by ip src. + * @param protection_synflood_rate Synflood protection rate + * syn/sec by ip src. + * @param smurf_log_level Log level for SMURFS filter. Enum: + * emerg,alert,crit,err,warning,notice,info,debug,nolog + * @param tcp_flags_log_level Log level for illegal tcp + * flags filter. Enum: + * emerg,alert,crit,err,warning,notice,info,debug,nolog + * @param tcpflags Filter illegal combinations of TCP flags. + * @return Result + * @throws JSONException + */ + + public Result setRest(String delete, String digest, Boolean enable, String log_level_in, String log_level_out, Boolean log_nf_conntrack, Boolean ndp, Boolean nf_conntrack_allow_invalid, Integer nf_conntrack_max, Integer nf_conntrack_tcp_timeout_established, Integer nf_conntrack_tcp_timeout_syn_recv, Boolean nosmurfs, Boolean protection_synflood, Integer protection_synflood_burst, Integer protection_synflood_rate, String smurf_log_level, String tcp_flags_log_level, Boolean tcpflags) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("delete", delete); + parameters.put("digest", digest); + parameters.put("enable", enable); + parameters.put("log_level_in", log_level_in); + parameters.put("log_level_out", log_level_out); + parameters.put("log_nf_conntrack", log_nf_conntrack); + parameters.put("ndp", ndp); + parameters.put("nf_conntrack_allow_invalid", nf_conntrack_allow_invalid); + parameters.put("nf_conntrack_max", nf_conntrack_max); + parameters.put("nf_conntrack_tcp_timeout_established", nf_conntrack_tcp_timeout_established); + parameters.put("nf_conntrack_tcp_timeout_syn_recv", nf_conntrack_tcp_timeout_syn_recv); + parameters.put("nosmurfs", nosmurfs); + parameters.put("protection_synflood", protection_synflood); + parameters.put("protection_synflood_burst", protection_synflood_burst); + parameters.put("protection_synflood_rate", protection_synflood_rate); + parameters.put("smurf_log_level", smurf_log_level); + parameters.put("tcp_flags_log_level", tcp_flags_log_level); + parameters.put("tcpflags", tcpflags); + return _client.set("/nodes/" + _node + "/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 enable Enable host firewall rules. + * @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 log_nf_conntrack Enable logging of conntrack + * information. + * @param ndp Enable NDP (Neighbor Discovery Protocol). + * @param nf_conntrack_allow_invalid Allow invalid packets + * on connection tracking. + * @param nf_conntrack_max Maximum number of tracked + * connections. + * @param nf_conntrack_tcp_timeout_established Conntrack + * established timeout. + * @param nf_conntrack_tcp_timeout_syn_recv Conntrack syn + * recv timeout. + * @param nosmurfs Enable SMURFS filter. + * @param protection_synflood Enable synflood protection + * @param protection_synflood_burst Synflood protection rate + * burst by ip src. + * @param protection_synflood_rate Synflood protection rate + * syn/sec by ip src. + * @param smurf_log_level Log level for SMURFS filter. Enum: + * emerg,alert,crit,err,warning,notice,info,debug,nolog + * @param tcp_flags_log_level Log level for illegal tcp + * flags filter. Enum: + * emerg,alert,crit,err,warning,notice,info,debug,nolog + * @param tcpflags Filter illegal combinations of TCP flags. + * @return Result + * @throws JSONException + */ + public Result setOptions(String delete, String digest, Boolean enable, String log_level_in, String log_level_out, Boolean log_nf_conntrack, Boolean ndp, Boolean nf_conntrack_allow_invalid, Integer nf_conntrack_max, Integer nf_conntrack_tcp_timeout_established, Integer nf_conntrack_tcp_timeout_syn_recv, Boolean nosmurfs, Boolean protection_synflood, Integer protection_synflood_burst, Integer protection_synflood_rate, String smurf_log_level, String tcp_flags_log_level, Boolean tcpflags) throws JSONException { + return setRest(delete, digest, enable, log_level_in, log_level_out, log_nf_conntrack, ndp, nf_conntrack_allow_invalid, nf_conntrack_max, nf_conntrack_tcp_timeout_established, nf_conntrack_tcp_timeout_syn_recv, nosmurfs, protection_synflood, protection_synflood_burst, protection_synflood_rate, smurf_log_level, tcp_flags_log_level, tcpflags); + } + + /** + * Set Firewall options. + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/nodes/" + _node + "/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; + + protected PVELog(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * 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 + "/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 + "/firewall/log", null); + } + + /** + * Read firewall log + * + * @return Result + * @throws JSONException + */ + public Result log() throws JSONException { + return getRest(); + } + + } + + /** + * Directory index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/firewall", null); + } + + /** + * Directory index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEReplication { + + private final PveClient _client; + private final Object _node; + + protected PVEReplication(PveClient client, Object node) { + _client = client; + _node = node; + } + + public PVEItemId get(Object id) { + return new PVEItemId(_client, _node, id); + } + + public class PVEItemId { + + private final PveClient _client; + private final Object _node; + private final Object _id; + + protected PVEItemId(PveClient client, Object node, Object id) { + _client = client; + _node = node; + _id = id; + } + + private PVEStatus _status; + + public PVEStatus getStatus() { + if (_status == null) { + _status = new PVEStatus(_client, _node, _id); + } + + return _status; + } + private PVELog _log; + + public PVELog getLog() { + if (_log == null) { + _log = new PVELog(_client, _node, _id); + } + + return _log; + } + private PVEScheduleNow _scheduleNow; + + public PVEScheduleNow getScheduleNow() { + if (_scheduleNow == null) { + _scheduleNow = new PVEScheduleNow(_client, _node, _id); + } + + return _scheduleNow; + } + + public class PVEStatus { + + private final PveClient _client; + private final Object _node; + private final Object _id; + + protected PVEStatus(PveClient client, Object node, Object id) { + _client = client; + _node = node; + _id = id; + } + + /** + * Get replication job status. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/replication/" + _id + "/status", null); + } + + /** + * Get replication job status. + * + * @return Result + * @throws JSONException + */ + public Result jobStatus() throws JSONException { + return getRest(); + } + + } + + public class PVELog { + + private final PveClient _client; + private final Object _node; + private final Object _id; + + protected PVELog(PveClient client, Object node, Object id) { + _client = client; + _node = node; + _id = id; + } + + /** + * Read replication job 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 + "/replication/" + _id + "/log", parameters); + } + + /** + * Read replication job log. + * + * @param limit + * @param start + * @return Result + * @throws JSONException + */ + public Result readJobLog(Integer limit, Integer start) throws JSONException { + return getRest(limit, start); + } + + /** + * Read replication job log. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/replication/" + _id + "/log", null); + } + + /** + * Read replication job log. + * + * @return Result + * @throws JSONException + */ + public Result readJobLog() throws JSONException { + return getRest(); + } + + } + + public class PVEScheduleNow { + + private final PveClient _client; + private final Object _node; + private final Object _id; + + protected PVEScheduleNow(PveClient client, Object node, Object id) { + _client = client; + _node = node; + _id = id; + } + + /** + * Schedule replication job to start as soon as + * possible. + * + * @return Result + * @throws JSONException + */ + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/replication/" + _id + "/schedule_now", null); + } + + /** + * Schedule replication job to start as soon as + * possible. + * + * @return Result + * @throws JSONException + */ + public Result scheduleNow() throws JSONException { + return createRest(); + } + + } + + /** + * Directory index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/replication/" + _id + "", null); + } + + /** + * Directory index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + /** + * List status of all replication jobs on this node. + * + * @param guest Only list replication jobs for this guest. + * @return Result + * @throws JSONException + */ + public Result getRest(Integer guest) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("guest", guest); + return _client.get("/nodes/" + _node + "/replication", parameters); + } + + /** + * List status of all replication jobs on this node. + * + * @param guest Only list replication jobs for this guest. + * @return Result + * @throws JSONException + */ + public Result status(Integer guest) throws JSONException { + return getRest(guest); + } + + /** + * List status of all replication jobs on this node. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/replication", null); + } + + /** + * List status of all replication jobs on this node. + * + * @return Result + * @throws JSONException + */ + public Result status() throws JSONException { + return getRest(); + } + + } + + public class PVECertificates { + + private final PveClient _client; + private final Object _node; + + protected PVECertificates(PveClient client, Object node) { + _client = client; + _node = node; + } + + private PVEAcme _acme; + + public PVEAcme getAcme() { + if (_acme == null) { + _acme = new PVEAcme(_client, _node); + } + + return _acme; + } + private PVEInfo _info; + + public PVEInfo getInfo() { + if (_info == null) { + _info = new PVEInfo(_client, _node); + } + + return _info; + } + private PVECustom _custom; + + public PVECustom getCustom() { + if (_custom == null) { + _custom = new PVECustom(_client, _node); + } + + return _custom; + } + + public class PVEAcme { + + private final PveClient _client; + private final Object _node; + + protected PVEAcme(PveClient client, Object node) { + _client = client; + _node = node; + } + + private PVECertificate _certificate; + + public PVECertificate getCertificate() { + if (_certificate == null) { + _certificate = new PVECertificate(_client, _node); + } + + return _certificate; + } + + public class PVECertificate { + + private final PveClient _client; + private final Object _node; + + protected PVECertificate(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Revoke existing certificate from CA. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/certificates/acme/certificate", null); + } + + /** + * Revoke existing certificate from CA. + * + * @return Result + * @throws JSONException + */ + public Result revokeCertificate() throws JSONException { + return deleteRest(); + } + + /** + * Order a new certificate from ACME-compatible CA. + * + * @param force Overwrite existing custom certificate. + * @return Result + * @throws JSONException + */ + + public Result createRest(Boolean force) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("force", force); + return _client.create("/nodes/" + _node + "/certificates/acme/certificate", parameters); + } + + /** + * Order a new certificate from ACME-compatible CA. + * + * @param force Overwrite existing custom certificate. + * @return Result + * @throws JSONException + */ + public Result newCertificate(Boolean force) throws JSONException { + return createRest(force); + } + + /** + * Order a new certificate from ACME-compatible CA. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/certificates/acme/certificate", null); + } + + /** + * Order a new certificate from ACME-compatible CA. + * + * @return Result + * @throws JSONException + */ + public Result newCertificate() throws JSONException { + return createRest(); + } + + /** + * Renew existing certificate from CA. + * + * @param force Force renewal even if expiry is more + * than 30 days away. + * @return Result + * @throws JSONException + */ + + public Result setRest(Boolean force) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("force", force); + return _client.set("/nodes/" + _node + "/certificates/acme/certificate", parameters); + } + + /** + * Renew existing certificate from CA. + * + * @param force Force renewal even if expiry is more + * than 30 days away. + * @return Result + * @throws JSONException + */ + public Result renewCertificate(Boolean force) throws JSONException { + return setRest(force); + } + + /** + * Renew existing certificate from CA. + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/nodes/" + _node + "/certificates/acme/certificate", null); + } + + /** + * Renew existing certificate from CA. + * + * @return Result + * @throws JSONException + */ + public Result renewCertificate() throws JSONException { + return setRest(); + } + + } + + /** + * ACME index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/certificates/acme", null); + } + + /** + * ACME index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEInfo { + + private final PveClient _client; + private final Object _node; + + protected PVEInfo(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get information about node's certificates. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/certificates/info", null); + } + + /** + * Get information about node's certificates. + * + * @return Result + * @throws JSONException + */ + public Result info() throws JSONException { + return getRest(); + } + + } + + public class PVECustom { + + private final PveClient _client; + private final Object _node; + + protected PVECustom(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * DELETE custom certificate chain and key. + * + * @param restart Restart pveproxy. + * @return Result + * @throws JSONException + */ + public Result deleteRest(Boolean restart) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("restart", restart); + return _client.delete("/nodes/" + _node + "/certificates/custom", parameters); + } + + /** + * DELETE custom certificate chain and key. + * + * @param restart Restart pveproxy. + * @return Result + * @throws JSONException + */ + public Result removeCustomCert(Boolean restart) throws JSONException { + return deleteRest(restart); + } + + /** + * DELETE custom certificate chain and key. + * + * @return Result + * @throws JSONException + */ + + public Result deleteRest() throws JSONException { + return _client.delete("/nodes/" + _node + "/certificates/custom", null); + } + + /** + * DELETE custom certificate chain and key. + * + * @return Result + * @throws JSONException + */ + public Result removeCustomCert() throws JSONException { + return deleteRest(); + } + + /** + * Upload or update custom certificate chain and key. + * + * @param certificates PEM encoded certificate (chain). + * @param force Overwrite existing custom or ACME + * certificate files. + * @param key PEM encoded private key. + * @param restart Restart pveproxy. + * @return Result + * @throws JSONException + */ + + public Result createRest(String certificates, Boolean force, String key, Boolean restart) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("certificates", certificates); + parameters.put("force", force); + parameters.put("key", key); + parameters.put("restart", restart); + return _client.create("/nodes/" + _node + "/certificates/custom", parameters); + } + + /** + * Upload or update custom certificate chain and key. + * + * @param certificates PEM encoded certificate (chain). + * @param force Overwrite existing custom or ACME + * certificate files. + * @param key PEM encoded private key. + * @param restart Restart pveproxy. + * @return Result + * @throws JSONException + */ + public Result uploadCustomCert(String certificates, Boolean force, String key, Boolean restart) throws JSONException { + return createRest(certificates, force, key, restart); + } + + /** + * Upload or update custom certificate chain and key. + * + * @param certificates PEM encoded certificate (chain). + * @return Result + * @throws JSONException + */ + + public Result createRest(String certificates) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("certificates", certificates); + return _client.create("/nodes/" + _node + "/certificates/custom", parameters); + } + + /** + * Upload or update custom certificate chain and key. + * + * @param certificates PEM encoded certificate (chain). + * @return Result + * @throws JSONException + */ + public Result uploadCustomCert(String certificates) throws JSONException { + return createRest(certificates); + } + + } + + /** + * Node index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/certificates", null); + } + + /** + * Node index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEConfig { + + private final PveClient _client; + private final Object _node; + + protected PVEConfig(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get node configuration options. + * + * @param property Return only a specific property from the node + * configuration. Enum: + * acme,description,startall-onboot-delay,wakeonlan + * @return Result + * @throws JSONException + */ + public Result getRest(String property) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("property", property); + return _client.get("/nodes/" + _node + "/config", parameters); + } + + /** + * Get node configuration options. + * + * @param property Return only a specific property from the node + * configuration. Enum: + * acme,description,startall-onboot-delay,wakeonlan + * @return Result + * @throws JSONException + */ + public Result getConfig(String property) throws JSONException { + return getRest(property); + } + + /** + * Get node configuration options. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/config", null); + } + + /** + * Get node configuration options. + * + * @return Result + * @throws JSONException + */ + public Result getConfig() throws JSONException { + return getRest(); + } + + /** + * Set node configuration options. + * + * @param acme Node specific ACME settings. + * @param delete A list of settings you want to delete. + * @param description Node description/comment. + * @param digest Prevent changes if current configuration file + * has different SHA1 digest. This can be used to prevent + * concurrent modifications. + * @param startall_onboot_delay Initial delay in seconds, before + * starting all the Virtual Guests with on-boot enabled. + * @param wakeonlan MAC address for wake on LAN + * @return Result + * @throws JSONException + */ + + public Result setRest(String acme, String delete, String description, String digest, Integer startall_onboot_delay, String wakeonlan) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("acme", acme); + parameters.put("delete", delete); + parameters.put("description", description); + parameters.put("digest", digest); + parameters.put("startall-onboot-delay", startall_onboot_delay); + parameters.put("wakeonlan", wakeonlan); + return _client.set("/nodes/" + _node + "/config", parameters); + } + + /** + * Set node configuration options. + * + * @param acme Node specific ACME settings. + * @param delete A list of settings you want to delete. + * @param description Node description/comment. + * @param digest Prevent changes if current configuration file + * has different SHA1 digest. This can be used to prevent + * concurrent modifications. + * @param startall_onboot_delay Initial delay in seconds, before + * starting all the Virtual Guests with on-boot enabled. + * @param wakeonlan MAC address for wake on LAN + * @return Result + * @throws JSONException + */ + public Result setOptions(String acme, String delete, String description, String digest, Integer startall_onboot_delay, String wakeonlan) throws JSONException { + return setRest(acme, delete, description, digest, startall_onboot_delay, wakeonlan); + } + + /** + * Set node configuration options. + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/nodes/" + _node + "/config", null); + } + + /** + * Set node configuration options. + * + * @return Result + * @throws JSONException + */ + public Result setOptions() throws JSONException { + return setRest(); + } + + } + + public class PVEVersion { + + private final PveClient _client; + private final Object _node; + + protected PVEVersion(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * API version details + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/version", null); + } + + /** + * API version details + * + * @return Result + * @throws JSONException + */ + public Result version() throws JSONException { + return getRest(); + } + + } + + public class PVEStatus { + + private final PveClient _client; + private final Object _node; + + protected PVEStatus(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Read node status + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/status", null); + } + + /** + * Read node status + * + * @return Result + * @throws JSONException + */ + public Result status() throws JSONException { + return getRest(); + } + + /** + * Reboot or shutdown a node. + * + * @param command Specify the command. Enum: reboot,shutdown + * @return Result + * @throws JSONException + */ + + public Result createRest(String command) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("command", command); + return _client.create("/nodes/" + _node + "/status", parameters); + } + + /** + * Reboot or shutdown a node. + * + * @param command Specify the command. Enum: reboot,shutdown + * @return Result + * @throws JSONException + */ + public Result nodeCmd(String command) throws JSONException { + return createRest(command); + } + + } + + public class PVENetstat { + + private final PveClient _client; + private final Object _node; + + protected PVENetstat(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Read tap/vm network device interface counters + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/netstat", null); + } + + /** + * Read tap/vm network device interface counters + * + * @return Result + * @throws JSONException + */ + public Result netstat() throws JSONException { + return getRest(); + } + + } + + public class PVEExecute { + + private final PveClient _client; + private final Object _node; + + protected PVEExecute(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Execute multiple commands in order. + * + * @param commands JSON encoded array of commands. + * @return Result + * @throws JSONException + */ + public Result createRest(String commands) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("commands", commands); + return _client.create("/nodes/" + _node + "/execute", parameters); + } + + /** + * Execute multiple commands in order. + * + * @param commands JSON encoded array of commands. + * @return Result + * @throws JSONException + */ + public Result execute(String commands) throws JSONException { + return createRest(commands); + } + + } + + public class PVEWakeonlan { + + private final PveClient _client; + private final Object _node; + + protected PVEWakeonlan(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Try to wake a node via 'wake on LAN' network packet. + * + * @return Result + * @throws JSONException + */ + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/wakeonlan", null); + } + + /** + * Try to wake a node via 'wake on LAN' network packet. + * + * @return Result + * @throws JSONException + */ + public Result wakeonlan() throws JSONException { + return createRest(); + } + + } + + public class PVERrd { + + private final PveClient _client; + private final Object _node; + + protected PVERrd(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Read node 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 + "/rrd", parameters); + } + + /** + * Read node 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 node 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 + "/rrd", parameters); + } + + /** + * Read node 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; + + protected PVERrddata(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Read node 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 + "/rrddata", parameters); + } + + /** + * Read node 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 node 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 + "/rrddata", parameters); + } + + /** + * Read node 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 PVESyslog { + + private final PveClient _client; + private final Object _node; + + protected PVESyslog(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Read system log + * + * @param limit + * @param service Service ID + * @param since Display all log since this date-time string. + * @param start + * @param until Display all log until this date-time string. + * @return Result + * @throws JSONException + */ + public Result getRest(Integer limit, String service, String since, Integer start, String until) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("limit", limit); + parameters.put("service", service); + parameters.put("since", since); + parameters.put("start", start); + parameters.put("until", until); + return _client.get("/nodes/" + _node + "/syslog", parameters); + } + + /** + * Read system log + * + * @param limit + * @param service Service ID + * @param since Display all log since this date-time string. + * @param start + * @param until Display all log until this date-time string. + * @return Result + * @throws JSONException + */ + public Result syslog(Integer limit, String service, String since, Integer start, String until) throws JSONException { + return getRest(limit, service, since, start, until); + } + + /** + * Read system log + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/syslog", null); + } + + /** + * Read system log + * + * @return Result + * @throws JSONException + */ + public Result syslog() throws JSONException { + return getRest(); + } + + } + + public class PVEJournal { + + private final PveClient _client; + private final Object _node; + + protected PVEJournal(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Read Journal + * + * @param endcursor End before the given Cursor. Conflicts with + * 'until' + * @param lastentries Limit to the last X lines. Conflicts with + * a range. + * @param since Display all log since this UNIX epoch. Conflicts + * with 'startcursor'. + * @param startcursor Start after the given Cursor. Conflicts + * with 'since' + * @param until Display all log until this UNIX epoch. Conflicts + * with 'endcursor'. + * @return Result + * @throws JSONException + */ + public Result getRest(String endcursor, Integer lastentries, Integer since, String startcursor, Integer until) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("endcursor", endcursor); + parameters.put("lastentries", lastentries); + parameters.put("since", since); + parameters.put("startcursor", startcursor); + parameters.put("until", until); + return _client.get("/nodes/" + _node + "/journal", parameters); + } + + /** + * Read Journal + * + * @param endcursor End before the given Cursor. Conflicts with + * 'until' + * @param lastentries Limit to the last X lines. Conflicts with + * a range. + * @param since Display all log since this UNIX epoch. Conflicts + * with 'startcursor'. + * @param startcursor Start after the given Cursor. Conflicts + * with 'since' + * @param until Display all log until this UNIX epoch. Conflicts + * with 'endcursor'. + * @return Result + * @throws JSONException + */ + public Result journal(String endcursor, Integer lastentries, Integer since, String startcursor, Integer until) throws JSONException { + return getRest(endcursor, lastentries, since, startcursor, until); + } + + /** + * Read Journal + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/journal", null); + } + + /** + * Read Journal + * + * @return Result + * @throws JSONException + */ + public Result journal() throws JSONException { + return getRest(); + } + + } + + public class PVEVncshell { + + private final PveClient _client; + private final Object _node; + + protected PVEVncshell(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Creates a VNC Shell proxy. + * + * @param cmd Run specific command or default to login. Enum: + * login,ceph_install,upgrade + * @param height sets the height of the console in pixels. + * @param upgrade Deprecated, use the 'cmd' property instead! + * Run 'apt-get dist-upgrade' instead of normal shell. + * @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(String cmd, Integer height, Boolean upgrade, Boolean websocket, Integer width) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("cmd", cmd); + parameters.put("height", height); + parameters.put("upgrade", upgrade); + parameters.put("websocket", websocket); + parameters.put("width", width); + return _client.create("/nodes/" + _node + "/vncshell", parameters); + } + + /** + * Creates a VNC Shell proxy. + * + * @param cmd Run specific command or default to login. Enum: + * login,ceph_install,upgrade + * @param height sets the height of the console in pixels. + * @param upgrade Deprecated, use the 'cmd' property instead! + * Run 'apt-get dist-upgrade' instead of normal shell. + * @param websocket use websocket instead of standard vnc. + * @param width sets the width of the console in pixels. + * @return Result + * @throws JSONException + */ + public Result vncshell(String cmd, Integer height, Boolean upgrade, Boolean websocket, Integer width) throws JSONException { + return createRest(cmd, height, upgrade, websocket, width); + } + + /** + * Creates a VNC Shell proxy. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/vncshell", null); + } + + /** + * Creates a VNC Shell proxy. + * + * @return Result + * @throws JSONException + */ + public Result vncshell() throws JSONException { + return createRest(); + } + + } + + public class PVETermproxy { + + private final PveClient _client; + private final Object _node; + + protected PVETermproxy(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Creates a VNC Shell proxy. + * + * @param cmd Run specific command or default to login. Enum: + * login,ceph_install,upgrade + * @param upgrade Deprecated, use the 'cmd' property instead! + * Run 'apt-get dist-upgrade' instead of normal shell. + * @return Result + * @throws JSONException + */ + public Result createRest(String cmd, Boolean upgrade) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("cmd", cmd); + parameters.put("upgrade", upgrade); + return _client.create("/nodes/" + _node + "/termproxy", parameters); + } + + /** + * Creates a VNC Shell proxy. + * + * @param cmd Run specific command or default to login. Enum: + * login,ceph_install,upgrade + * @param upgrade Deprecated, use the 'cmd' property instead! + * Run 'apt-get dist-upgrade' instead of normal shell. + * @return Result + * @throws JSONException + */ + public Result termproxy(String cmd, Boolean upgrade) throws JSONException { + return createRest(cmd, upgrade); + } + + /** + * Creates a VNC Shell proxy. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/termproxy", null); + } + + /** + * Creates a VNC Shell proxy. + * + * @return Result + * @throws JSONException + */ + public Result termproxy() throws JSONException { + return createRest(); + } + + } + + public class PVEVncwebsocket { + + private final PveClient _client; + private final Object _node; + + protected PVEVncwebsocket(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * 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 + "/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 PVESpiceshell { + + private final PveClient _client; + private final Object _node; + + protected PVESpiceshell(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Creates a SPICE shell. + * + * @param cmd Run specific command or default to login. Enum: + * login,ceph_install,upgrade + * @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). + * @param upgrade Deprecated, use the 'cmd' property instead! + * Run 'apt-get dist-upgrade' instead of normal shell. + * @return Result + * @throws JSONException + */ + public Result createRest(String cmd, String proxy, Boolean upgrade) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("cmd", cmd); + parameters.put("proxy", proxy); + parameters.put("upgrade", upgrade); + return _client.create("/nodes/" + _node + "/spiceshell", parameters); + } + + /** + * Creates a SPICE shell. + * + * @param cmd Run specific command or default to login. Enum: + * login,ceph_install,upgrade + * @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). + * @param upgrade Deprecated, use the 'cmd' property instead! + * Run 'apt-get dist-upgrade' instead of normal shell. + * @return Result + * @throws JSONException + */ + public Result spiceshell(String cmd, String proxy, Boolean upgrade) throws JSONException { + return createRest(cmd, proxy, upgrade); + } + + /** + * Creates a SPICE shell. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/spiceshell", null); + } + + /** + * Creates a SPICE shell. + * + * @return Result + * @throws JSONException + */ + public Result spiceshell() throws JSONException { + return createRest(); + } + + } + + public class PVEDns { + + private final PveClient _client; + private final Object _node; + + protected PVEDns(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Read DNS settings. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/dns", null); + } + + /** + * Read DNS settings. + * + * @return Result + * @throws JSONException + */ + public Result dns() throws JSONException { + return getRest(); + } + + /** + * Write DNS settings. + * + * @param search Search domain for host-name lookup. + * @param dns1 First name server IP address. + * @param dns2 Second name server IP address. + * @param dns3 Third name server IP address. + * @return Result + * @throws JSONException + */ + + public Result setRest(String search, String dns1, String dns2, String dns3) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("search", search); + parameters.put("dns1", dns1); + parameters.put("dns2", dns2); + parameters.put("dns3", dns3); + return _client.set("/nodes/" + _node + "/dns", parameters); + } + + /** + * Write DNS settings. + * + * @param search Search domain for host-name lookup. + * @param dns1 First name server IP address. + * @param dns2 Second name server IP address. + * @param dns3 Third name server IP address. + * @return Result + * @throws JSONException + */ + public Result updateDns(String search, String dns1, String dns2, String dns3) throws JSONException { + return setRest(search, dns1, dns2, dns3); + } + + /** + * Write DNS settings. + * + * @param search Search domain for host-name lookup. + * @return Result + * @throws JSONException + */ + + public Result setRest(String search) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("search", search); + return _client.set("/nodes/" + _node + "/dns", parameters); + } + + /** + * Write DNS settings. + * + * @param search Search domain for host-name lookup. + * @return Result + * @throws JSONException + */ + public Result updateDns(String search) throws JSONException { + return setRest(search); + } + + } + + public class PVETime { + + private final PveClient _client; + private final Object _node; + + protected PVETime(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Read server time and time zone settings. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/time", null); + } + + /** + * Read server time and time zone settings. + * + * @return Result + * @throws JSONException + */ + public Result time() throws JSONException { + return getRest(); + } + + /** + * Set time zone. + * + * @param timezone Time zone. The file + * '/usr/share/zoneinfo/zone.tab' contains the list of valid + * names. + * @return Result + * @throws JSONException + */ + + public Result setRest(String timezone) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("timezone", timezone); + return _client.set("/nodes/" + _node + "/time", parameters); + } + + /** + * Set time zone. + * + * @param timezone Time zone. The file + * '/usr/share/zoneinfo/zone.tab' contains the list of valid + * names. + * @return Result + * @throws JSONException + */ + public Result setTimezone(String timezone) throws JSONException { + return setRest(timezone); + } + + } + + public class PVEAplinfo { + + private final PveClient _client; + private final Object _node; + + protected PVEAplinfo(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get list of appliances. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/aplinfo", null); + } + + /** + * Get list of appliances. + * + * @return Result + * @throws JSONException + */ + public Result aplinfo() throws JSONException { + return getRest(); + } + + /** + * Download appliance templates. + * + * @param storage The storage where the template will be stored + * @param template The template which will downloaded + * @return Result + * @throws JSONException + */ + + public Result createRest(String storage, String template) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("storage", storage); + parameters.put("template", template); + return _client.create("/nodes/" + _node + "/aplinfo", parameters); + } + + /** + * Download appliance templates. + * + * @param storage The storage where the template will be stored + * @param template The template which will downloaded + * @return Result + * @throws JSONException + */ + public Result aplDownload(String storage, String template) throws JSONException { + return createRest(storage, template); + } + + } + + public class PVEReport { + + private final PveClient _client; + private final Object _node; + + protected PVEReport(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Gather various systems information about a node + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/report", null); + } + + /** + * Gather various systems information about a node + * + * @return Result + * @throws JSONException + */ + public Result report() throws JSONException { + return getRest(); + } + + } + + public class PVEStartall { + + private final PveClient _client; + private final Object _node; + + protected PVEStartall(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Start all VMs and containers located on this node (by default + * only those with onboot=1). + * + * @param force Issue start command even if virtual guest have + * 'onboot' not set or set to off. + * @param vms Only consider guests from this comma separated + * list of VMIDs. + * @return Result + * @throws JSONException + */ + public Result createRest(Boolean force, String vms) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("force", force); + parameters.put("vms", vms); + return _client.create("/nodes/" + _node + "/startall", parameters); + } + + /** + * Start all VMs and containers located on this node (by default + * only those with onboot=1). + * + * @param force Issue start command even if virtual guest have + * 'onboot' not set or set to off. + * @param vms Only consider guests from this comma separated + * list of VMIDs. + * @return Result + * @throws JSONException + */ + public Result startall(Boolean force, String vms) throws JSONException { + return createRest(force, vms); + } + + /** + * Start all VMs and containers located on this node (by default + * only those with onboot=1). + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/startall", null); + } + + /** + * Start all VMs and containers located on this node (by default + * only those with onboot=1). + * + * @return Result + * @throws JSONException + */ + public Result startall() throws JSONException { + return createRest(); + } + + } + + public class PVEStopall { + + private final PveClient _client; + private final Object _node; + + protected PVEStopall(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Stop all VMs and Containers. + * + * @param vms Only consider Guests with these IDs. + * @return Result + * @throws JSONException + */ + public Result createRest(String vms) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("vms", vms); + return _client.create("/nodes/" + _node + "/stopall", parameters); + } + + /** + * Stop all VMs and Containers. + * + * @param vms Only consider Guests with these IDs. + * @return Result + * @throws JSONException + */ + public Result stopall(String vms) throws JSONException { + return createRest(vms); + } + + /** + * Stop all VMs and Containers. + * + * @return Result + * @throws JSONException + */ + + public Result createRest() throws JSONException { + return _client.create("/nodes/" + _node + "/stopall", null); + } + + /** + * Stop all VMs and Containers. + * + * @return Result + * @throws JSONException + */ + public Result stopall() throws JSONException { + return createRest(); + } + + } + + public class PVEMigrateall { + + private final PveClient _client; + private final Object _node; + + protected PVEMigrateall(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Migrate all VMs and Containers. + * + * @param target Target node. + * @param maxworkers Maximal number of parallel migration job. + * If not set use 'max_workers' from datacenter.cfg, one of both + * must be set! + * @param vms Only consider Guests with these IDs. + * @return Result + * @throws JSONException + */ + public Result createRest(String target, Integer maxworkers, String vms) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("target", target); + parameters.put("maxworkers", maxworkers); + parameters.put("vms", vms); + return _client.create("/nodes/" + _node + "/migrateall", parameters); + } + + /** + * Migrate all VMs and Containers. + * + * @param target Target node. + * @param maxworkers Maximal number of parallel migration job. + * If not set use 'max_workers' from datacenter.cfg, one of both + * must be set! + * @param vms Only consider Guests with these IDs. + * @return Result + * @throws JSONException + */ + public Result migrateall(String target, Integer maxworkers, String vms) throws JSONException { + return createRest(target, maxworkers, vms); + } + + /** + * Migrate all VMs and Containers. + * + * @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 + "/migrateall", parameters); + } + + /** + * Migrate all VMs and Containers. + * + * @param target Target node. + * @return Result + * @throws JSONException + */ + public Result migrateall(String target) throws JSONException { + return createRest(target); + } + + } + + public class PVEHosts { + + private final PveClient _client; + private final Object _node; + + protected PVEHosts(PveClient client, Object node) { + _client = client; + _node = node; + } + + /** + * Get the content of /etc/hosts. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "/hosts", null); + } + + /** + * Get the content of /etc/hosts. + * + * @return Result + * @throws JSONException + */ + public Result getEtcHosts() throws JSONException { + return getRest(); + } + + /** + * Write /etc/hosts. + * + * @param data The target content of /etc/hosts. + * @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 data, String digest) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("data", data); + parameters.put("digest", digest); + return _client.create("/nodes/" + _node + "/hosts", parameters); + } + + /** + * Write /etc/hosts. + * + * @param data The target content of /etc/hosts. + * @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 writeEtcHosts(String data, String digest) throws JSONException { + return createRest(data, digest); + } + + /** + * Write /etc/hosts. + * + * @param data The target content of /etc/hosts. + * @return Result + * @throws JSONException + */ + + public Result createRest(String data) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("data", data); + return _client.create("/nodes/" + _node + "/hosts", parameters); + } + + /** + * Write /etc/hosts. + * + * @param data The target content of /etc/hosts. + * @return Result + * @throws JSONException + */ + public Result writeEtcHosts(String data) throws JSONException { + return createRest(data); + } + + } + + /** + * Node index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes/" + _node + "", null); + } + + /** + * Node index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + /** + * Cluster node index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/nodes", null); + } + + /** + * Cluster node index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEStorage { + + private final PveClient _client; + + protected PVEStorage(PveClient client) { + _client = client; + + } + + public PVEItemStorage get(Object storage) { + return new PVEItemStorage(_client, storage); + } + + public class PVEItemStorage { + + private final PveClient _client; + private final Object _storage; + + protected PVEItemStorage(PveClient client, Object storage) { + _client = client; + _storage = storage; + } + + /** + * Delete storage configuration. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/storage/" + _storage + "", null); + } + + /** + * Delete storage configuration. + * + * @return Result + * @throws JSONException + */ + public Result delete() throws JSONException { + return deleteRest(); + } + + /** + * Read storage configuration. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/storage/" + _storage + "", null); + } + + /** + * Read storage configuration. + * + * @return Result + * @throws JSONException + */ + public Result read() throws JSONException { + return getRest(); + } + + /** + * Update storage configuration. + * + * @param blocksize block size + * @param bwlimit Set bandwidth/io limits various operations. + * @param comstar_hg host group for comstar views + * @param comstar_tg target group for comstar views + * @param content Allowed content types. NOTE: the value 'rootdir' + * is used for Containers, and value 'images' for VMs. + * @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 the storage. + * @param domain CIFS domain. + * @param format Default image format. + * @param fuse Mount CephFS through FUSE. + * @param is_mountpoint Assume the given path is an externally + * managed mountpoint and consider the storage offline if it is not + * mounted. Using a boolean (yes/no) value serves as a shortcut to + * using the target path in this field. + * @param krbd Always access rbd through krbd kernel module. + * @param lio_tpg target portal group for Linux LIO targets + * @param maxfiles Maximal number of backup files per VM. Use '0' + * for unlimted. + * @param mkdir Create the directory if it doesn't exist. + * @param monhost IP addresses of monitors (for external clusters). + * @param mountpoint mount point + * @param nodes List of cluster node names. + * @param nowritecache disable write caching on the target + * @param options NFS mount options (see 'man nfs') + * @param password Password for CIFS share. + * @param pool Pool. + * @param redundancy The redundancy count specifies the number of + * nodes to which the resource should be deployed. It must be at + * least 1 and at most the number of nodes in the cluster. + * @param saferemove Zero-out data when removing LVs. + * @param saferemove_throughput Wipe throughput (cstream -t + * parameter value). + * @param server Server IP or DNS name. + * @param server2 Backup volfile server IP or DNS name. + * @param shared Mark storage as shared. + * @param smbversion SMB protocol version Enum: 2.0,2.1,3.0 + * @param sparse use sparse volumes + * @param subdir Subdir to mount. + * @param tagged_only Only use logical volumes tagged with + * 'pve-vm-ID'. + * @param transport Gluster transport: tcp or rdma Enum: + * tcp,rdma,unix + * @param username RBD Id. + * @return Result + * @throws JSONException + */ + + public Result setRest(String blocksize, String bwlimit, String comstar_hg, String comstar_tg, String content, String delete, String digest, Boolean disable, String domain, String format, Boolean fuse, String is_mountpoint, Boolean krbd, String lio_tpg, Integer maxfiles, Boolean mkdir, String monhost, String mountpoint, String nodes, Boolean nowritecache, String options, String password, String pool, Integer redundancy, Boolean saferemove, String saferemove_throughput, String server, String server2, Boolean shared, String smbversion, Boolean sparse, String subdir, Boolean tagged_only, String transport, String username) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("blocksize", blocksize); + parameters.put("bwlimit", bwlimit); + parameters.put("comstar_hg", comstar_hg); + parameters.put("comstar_tg", comstar_tg); + parameters.put("content", content); + parameters.put("delete", delete); + parameters.put("digest", digest); + parameters.put("disable", disable); + parameters.put("domain", domain); + parameters.put("format", format); + parameters.put("fuse", fuse); + parameters.put("is_mountpoint", is_mountpoint); + parameters.put("krbd", krbd); + parameters.put("lio_tpg", lio_tpg); + parameters.put("maxfiles", maxfiles); + parameters.put("mkdir", mkdir); + parameters.put("monhost", monhost); + parameters.put("mountpoint", mountpoint); + parameters.put("nodes", nodes); + parameters.put("nowritecache", nowritecache); + parameters.put("options", options); + parameters.put("password", password); + parameters.put("pool", pool); + parameters.put("redundancy", redundancy); + parameters.put("saferemove", saferemove); + parameters.put("saferemove_throughput", saferemove_throughput); + parameters.put("server", server); + parameters.put("server2", server2); + parameters.put("shared", shared); + parameters.put("smbversion", smbversion); + parameters.put("sparse", sparse); + parameters.put("subdir", subdir); + parameters.put("tagged_only", tagged_only); + parameters.put("transport", transport); + parameters.put("username", username); + return _client.set("/storage/" + _storage + "", parameters); + } + + /** + * Update storage configuration. + * + * @param blocksize block size + * @param bwlimit Set bandwidth/io limits various operations. + * @param comstar_hg host group for comstar views + * @param comstar_tg target group for comstar views + * @param content Allowed content types. NOTE: the value 'rootdir' + * is used for Containers, and value 'images' for VMs. + * @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 the storage. + * @param domain CIFS domain. + * @param format Default image format. + * @param fuse Mount CephFS through FUSE. + * @param is_mountpoint Assume the given path is an externally + * managed mountpoint and consider the storage offline if it is not + * mounted. Using a boolean (yes/no) value serves as a shortcut to + * using the target path in this field. + * @param krbd Always access rbd through krbd kernel module. + * @param lio_tpg target portal group for Linux LIO targets + * @param maxfiles Maximal number of backup files per VM. Use '0' + * for unlimted. + * @param mkdir Create the directory if it doesn't exist. + * @param monhost IP addresses of monitors (for external clusters). + * @param mountpoint mount point + * @param nodes List of cluster node names. + * @param nowritecache disable write caching on the target + * @param options NFS mount options (see 'man nfs') + * @param password Password for CIFS share. + * @param pool Pool. + * @param redundancy The redundancy count specifies the number of + * nodes to which the resource should be deployed. It must be at + * least 1 and at most the number of nodes in the cluster. + * @param saferemove Zero-out data when removing LVs. + * @param saferemove_throughput Wipe throughput (cstream -t + * parameter value). + * @param server Server IP or DNS name. + * @param server2 Backup volfile server IP or DNS name. + * @param shared Mark storage as shared. + * @param smbversion SMB protocol version Enum: 2.0,2.1,3.0 + * @param sparse use sparse volumes + * @param subdir Subdir to mount. + * @param tagged_only Only use logical volumes tagged with + * 'pve-vm-ID'. + * @param transport Gluster transport: tcp or rdma Enum: + * tcp,rdma,unix + * @param username RBD Id. + * @return Result + * @throws JSONException + */ + public Result update(String blocksize, String bwlimit, String comstar_hg, String comstar_tg, String content, String delete, String digest, Boolean disable, String domain, String format, Boolean fuse, String is_mountpoint, Boolean krbd, String lio_tpg, Integer maxfiles, Boolean mkdir, String monhost, String mountpoint, String nodes, Boolean nowritecache, String options, String password, String pool, Integer redundancy, Boolean saferemove, String saferemove_throughput, String server, String server2, Boolean shared, String smbversion, Boolean sparse, String subdir, Boolean tagged_only, String transport, String username) throws JSONException { + return setRest(blocksize, bwlimit, comstar_hg, comstar_tg, content, delete, digest, disable, domain, format, fuse, is_mountpoint, krbd, lio_tpg, maxfiles, mkdir, monhost, mountpoint, nodes, nowritecache, options, password, pool, redundancy, saferemove, saferemove_throughput, server, server2, shared, smbversion, sparse, subdir, tagged_only, transport, username); + } + + /** + * Update storage configuration. + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/storage/" + _storage + "", null); + } + + /** + * Update storage configuration. + * + * @return Result + * @throws JSONException + */ + public Result update() throws JSONException { + return setRest(); + } + + } + + /** + * Storage index. + * + * @param type Only list storage of specific type Enum: + * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool + * @return Result + * @throws JSONException + */ + public Result getRest(String type) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("type", type); + return _client.get("/storage", parameters); + } + + /** + * Storage index. + * + * @param type Only list storage of specific type Enum: + * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool + * @return Result + * @throws JSONException + */ + public Result index(String type) throws JSONException { + return getRest(type); + } + + /** + * Storage index. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/storage", null); + } + + /** + * Storage index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create a new storage. + * + * @param storage The storage identifier. + * @param type Storage type. Enum: + * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool + * @param authsupported Authsupported. + * @param base_ Base volume. This volume is automatically activated. + * @param blocksize block size + * @param bwlimit Set bandwidth/io limits various operations. + * @param comstar_hg host group for comstar views + * @param comstar_tg target group for comstar views + * @param content Allowed content types. NOTE: the value 'rootdir' is + * used for Containers, and value 'images' for VMs. + * @param disable Flag to disable the storage. + * @param domain CIFS domain. + * @param export NFS export path. + * @param format Default image format. + * @param fuse Mount CephFS through FUSE. + * @param is_mountpoint Assume the given path is an externally managed + * mountpoint and consider the storage offline if it is not mounted. + * Using a boolean (yes/no) value serves as a shortcut to using the + * target path in this field. + * @param iscsiprovider iscsi provider + * @param krbd Always access rbd through krbd kernel module. + * @param lio_tpg target portal group for Linux LIO targets + * @param maxfiles Maximal number of backup files per VM. Use '0' for + * unlimted. + * @param mkdir Create the directory if it doesn't exist. + * @param monhost IP addresses of monitors (for external clusters). + * @param mountpoint mount point + * @param nodes List of cluster node names. + * @param nowritecache disable write caching on the target + * @param options NFS mount options (see 'man nfs') + * @param password Password for CIFS share. + * @param path File system path. + * @param pool Pool. + * @param portal iSCSI portal (IP or DNS name with optional port). + * @param redundancy The redundancy count specifies the number of nodes + * to which the resource should be deployed. It must be at least 1 and + * at most the number of nodes in the cluster. + * @param saferemove Zero-out data when removing LVs. + * @param saferemove_throughput Wipe throughput (cstream -t parameter + * value). + * @param server Server IP or DNS name. + * @param server2 Backup volfile server IP or DNS name. + * @param share CIFS share. + * @param shared Mark storage as shared. + * @param smbversion SMB protocol version Enum: 2.0,2.1,3.0 + * @param sparse use sparse volumes + * @param subdir Subdir to mount. + * @param tagged_only Only use logical volumes tagged with 'pve-vm-ID'. + * @param target iSCSI target. + * @param thinpool LVM thin pool LV name. + * @param transport Gluster transport: tcp or rdma Enum: tcp,rdma,unix + * @param username RBD Id. + * @param vgname Volume group name. + * @param volume Glusterfs Volume. + * @return Result + * @throws JSONException + */ + + public Result createRest(String storage, String type, String authsupported, String base_, String blocksize, String bwlimit, String comstar_hg, String comstar_tg, String content, Boolean disable, String domain, String export, String format, Boolean fuse, String is_mountpoint, String iscsiprovider, Boolean krbd, String lio_tpg, Integer maxfiles, Boolean mkdir, String monhost, String mountpoint, String nodes, Boolean nowritecache, String options, String password, String path, String pool, String portal, Integer redundancy, Boolean saferemove, String saferemove_throughput, String server, String server2, String share, Boolean shared, String smbversion, Boolean sparse, String subdir, Boolean tagged_only, String target, String thinpool, String transport, String username, String vgname, String volume) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("storage", storage); + parameters.put("type", type); + parameters.put("authsupported", authsupported); + parameters.put("base", base_); + parameters.put("blocksize", blocksize); + parameters.put("bwlimit", bwlimit); + parameters.put("comstar_hg", comstar_hg); + parameters.put("comstar_tg", comstar_tg); + parameters.put("content", content); + parameters.put("disable", disable); + parameters.put("domain", domain); + parameters.put("export", export); + parameters.put("format", format); + parameters.put("fuse", fuse); + parameters.put("is_mountpoint", is_mountpoint); + parameters.put("iscsiprovider", iscsiprovider); + parameters.put("krbd", krbd); + parameters.put("lio_tpg", lio_tpg); + parameters.put("maxfiles", maxfiles); + parameters.put("mkdir", mkdir); + parameters.put("monhost", monhost); + parameters.put("mountpoint", mountpoint); + parameters.put("nodes", nodes); + parameters.put("nowritecache", nowritecache); + parameters.put("options", options); + parameters.put("password", password); + parameters.put("path", path); + parameters.put("pool", pool); + parameters.put("portal", portal); + parameters.put("redundancy", redundancy); + parameters.put("saferemove", saferemove); + parameters.put("saferemove_throughput", saferemove_throughput); + parameters.put("server", server); + parameters.put("server2", server2); + parameters.put("share", share); + parameters.put("shared", shared); + parameters.put("smbversion", smbversion); + parameters.put("sparse", sparse); + parameters.put("subdir", subdir); + parameters.put("tagged_only", tagged_only); + parameters.put("target", target); + parameters.put("thinpool", thinpool); + parameters.put("transport", transport); + parameters.put("username", username); + parameters.put("vgname", vgname); + parameters.put("volume", volume); + return _client.create("/storage", parameters); + } + + /** + * Create a new storage. + * + * @param storage The storage identifier. + * @param type Storage type. Enum: + * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool + * @param authsupported Authsupported. + * @param base_ Base volume. This volume is automatically activated. + * @param blocksize block size + * @param bwlimit Set bandwidth/io limits various operations. + * @param comstar_hg host group for comstar views + * @param comstar_tg target group for comstar views + * @param content Allowed content types. NOTE: the value 'rootdir' is + * used for Containers, and value 'images' for VMs. + * @param disable Flag to disable the storage. + * @param domain CIFS domain. + * @param export NFS export path. + * @param format Default image format. + * @param fuse Mount CephFS through FUSE. + * @param is_mountpoint Assume the given path is an externally managed + * mountpoint and consider the storage offline if it is not mounted. + * Using a boolean (yes/no) value serves as a shortcut to using the + * target path in this field. + * @param iscsiprovider iscsi provider + * @param krbd Always access rbd through krbd kernel module. + * @param lio_tpg target portal group for Linux LIO targets + * @param maxfiles Maximal number of backup files per VM. Use '0' for + * unlimted. + * @param mkdir Create the directory if it doesn't exist. + * @param monhost IP addresses of monitors (for external clusters). + * @param mountpoint mount point + * @param nodes List of cluster node names. + * @param nowritecache disable write caching on the target + * @param options NFS mount options (see 'man nfs') + * @param password Password for CIFS share. + * @param path File system path. + * @param pool Pool. + * @param portal iSCSI portal (IP or DNS name with optional port). + * @param redundancy The redundancy count specifies the number of nodes + * to which the resource should be deployed. It must be at least 1 and + * at most the number of nodes in the cluster. + * @param saferemove Zero-out data when removing LVs. + * @param saferemove_throughput Wipe throughput (cstream -t parameter + * value). + * @param server Server IP or DNS name. + * @param server2 Backup volfile server IP or DNS name. + * @param share CIFS share. + * @param shared Mark storage as shared. + * @param smbversion SMB protocol version Enum: 2.0,2.1,3.0 + * @param sparse use sparse volumes + * @param subdir Subdir to mount. + * @param tagged_only Only use logical volumes tagged with 'pve-vm-ID'. + * @param target iSCSI target. + * @param thinpool LVM thin pool LV name. + * @param transport Gluster transport: tcp or rdma Enum: tcp,rdma,unix + * @param username RBD Id. + * @param vgname Volume group name. + * @param volume Glusterfs Volume. + * @return Result + * @throws JSONException + */ + public Result create(String storage, String type, String authsupported, String base_, String blocksize, String bwlimit, String comstar_hg, String comstar_tg, String content, Boolean disable, String domain, String export, String format, Boolean fuse, String is_mountpoint, String iscsiprovider, Boolean krbd, String lio_tpg, Integer maxfiles, Boolean mkdir, String monhost, String mountpoint, String nodes, Boolean nowritecache, String options, String password, String path, String pool, String portal, Integer redundancy, Boolean saferemove, String saferemove_throughput, String server, String server2, String share, Boolean shared, String smbversion, Boolean sparse, String subdir, Boolean tagged_only, String target, String thinpool, String transport, String username, String vgname, String volume) throws JSONException { + return createRest(storage, type, authsupported, base_, blocksize, bwlimit, comstar_hg, comstar_tg, content, disable, domain, export, format, fuse, is_mountpoint, iscsiprovider, krbd, lio_tpg, maxfiles, mkdir, monhost, mountpoint, nodes, nowritecache, options, password, path, pool, portal, redundancy, saferemove, saferemove_throughput, server, server2, share, shared, smbversion, sparse, subdir, tagged_only, target, thinpool, transport, username, vgname, volume); + } + + /** + * Create a new storage. + * + * @param storage The storage identifier. + * @param type Storage type. Enum: + * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool + * @return Result + * @throws JSONException + */ + + public Result createRest(String storage, String type) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("storage", storage); + parameters.put("type", type); + return _client.create("/storage", parameters); + } + + /** + * Create a new storage. + * + * @param storage The storage identifier. + * @param type Storage type. Enum: + * cephfs,cifs,dir,drbd,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,rbd,zfs,zfspool + * @return Result + * @throws JSONException + */ + public Result create(String storage, String type) throws JSONException { + return createRest(storage, type); + } + + } + + public class PVEAccess { + + private final PveClient _client; + + protected PVEAccess(PveClient client) { + _client = client; + + } + + private PVEUsers _users; + + public PVEUsers getUsers() { + if (_users == null) { + _users = new PVEUsers(_client); + } + + return _users; + } + private PVEGroups _groups; + + public PVEGroups getGroups() { + if (_groups == null) { + _groups = new PVEGroups(_client); + } + + return _groups; + } + private PVERoles _roles; + + public PVERoles getRoles() { + if (_roles == null) { + _roles = new PVERoles(_client); + } + + return _roles; + } + private PVEAcl _acl; + + public PVEAcl getAcl() { + if (_acl == null) { + _acl = new PVEAcl(_client); + } + + return _acl; + } + private PVEDomains _domains; + + public PVEDomains getDomains() { + if (_domains == null) { + _domains = new PVEDomains(_client); + } + + return _domains; + } + private PVETicket _ticket; + + public PVETicket getTicket() { + if (_ticket == null) { + _ticket = new PVETicket(_client); + } + + return _ticket; + } + private PVEPassword _password; + + public PVEPassword getPassword() { + if (_password == null) { + _password = new PVEPassword(_client); + } + + return _password; + } + private PVETfa _tfa; + + public PVETfa getTfa() { + if (_tfa == null) { + _tfa = new PVETfa(_client); + } + + return _tfa; + } + + public class PVEUsers { + + private final PveClient _client; + + protected PVEUsers(PveClient client) { + _client = client; + + } + + public PVEItemUserid get(Object userid) { + return new PVEItemUserid(_client, userid); + } + + public class PVEItemUserid { + + private final PveClient _client; + private final Object _userid; + + protected PVEItemUserid(PveClient client, Object userid) { + _client = client; + _userid = userid; + } + + private PVETfa _tfa; + + public PVETfa getTfa() { + if (_tfa == null) { + _tfa = new PVETfa(_client, _userid); + } + + return _tfa; + } + + public class PVETfa { + + private final PveClient _client; + private final Object _userid; + + protected PVETfa(PveClient client, Object userid) { + _client = client; + _userid = userid; + } + + /** + * Get user TFA types (Personal and Realm). + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/access/users/" + _userid + "/tfa", null); + } + + /** + * Get user TFA types (Personal and Realm). + * + * @return Result + * @throws JSONException + */ + public Result readUserTfaType() throws JSONException { + return getRest(); + } + + } + + /** + * Delete user. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/access/users/" + _userid + "", null); + } + + /** + * Delete user. + * + * @return Result + * @throws JSONException + */ + public Result deleteUser() throws JSONException { + return deleteRest(); + } + + /** + * Get user configuration. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/access/users/" + _userid + "", null); + } + + /** + * Get user configuration. + * + * @return Result + * @throws JSONException + */ + public Result readUser() throws JSONException { + return getRest(); + } + + /** + * Update user configuration. + * + * @param append + * @param comment + * @param email + * @param enable Enable the account (default). You can set this + * to '0' to disable the account + * @param expire Account expiration date (seconds since epoch). + * '0' means no expiration date. + * @param firstname + * @param groups + * @param keys Keys for two factor auth (yubico). + * @param lastname + * @return Result + * @throws JSONException + */ + + public Result setRest(Boolean append, String comment, String email, Boolean enable, Integer expire, String firstname, String groups, String keys, String lastname) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("append", append); + parameters.put("comment", comment); + parameters.put("email", email); + parameters.put("enable", enable); + parameters.put("expire", expire); + parameters.put("firstname", firstname); + parameters.put("groups", groups); + parameters.put("keys", keys); + parameters.put("lastname", lastname); + return _client.set("/access/users/" + _userid + "", parameters); + } + + /** + * Update user configuration. + * + * @param append + * @param comment + * @param email + * @param enable Enable the account (default). You can set this + * to '0' to disable the account + * @param expire Account expiration date (seconds since epoch). + * '0' means no expiration date. + * @param firstname + * @param groups + * @param keys Keys for two factor auth (yubico). + * @param lastname + * @return Result + * @throws JSONException + */ + public Result updateUser(Boolean append, String comment, String email, Boolean enable, Integer expire, String firstname, String groups, String keys, String lastname) throws JSONException { + return setRest(append, comment, email, enable, expire, firstname, groups, keys, lastname); + } + + /** + * Update user configuration. + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/access/users/" + _userid + "", null); + } + + /** + * Update user configuration. + * + * @return Result + * @throws JSONException + */ + public Result updateUser() throws JSONException { + return setRest(); + } + + } + + /** + * User index. + * + * @param enabled Optional filter for enable property. + * @return Result + * @throws JSONException + */ + public Result getRest(Boolean enabled) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("enabled", enabled); + return _client.get("/access/users", parameters); + } + + /** + * User index. + * + * @param enabled Optional filter for enable property. + * @return Result + * @throws JSONException + */ + public Result index(Boolean enabled) throws JSONException { + return getRest(enabled); + } + + /** + * User index. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/access/users", null); + } + + /** + * User index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create new user. + * + * @param userid User ID + * @param comment + * @param email + * @param enable Enable the account (default). You can set this to + * '0' to disable the account + * @param expire Account expiration date (seconds since epoch). '0' + * means no expiration date. + * @param firstname + * @param groups + * @param keys Keys for two factor auth (yubico). + * @param lastname + * @param password Initial password. + * @return Result + * @throws JSONException + */ + + public Result createRest(String userid, String comment, String email, Boolean enable, Integer expire, String firstname, String groups, String keys, String lastname, String password) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("userid", userid); + parameters.put("comment", comment); + parameters.put("email", email); + parameters.put("enable", enable); + parameters.put("expire", expire); + parameters.put("firstname", firstname); + parameters.put("groups", groups); + parameters.put("keys", keys); + parameters.put("lastname", lastname); + parameters.put("password", password); + return _client.create("/access/users", parameters); + } + + /** + * Create new user. + * + * @param userid User ID + * @param comment + * @param email + * @param enable Enable the account (default). You can set this to + * '0' to disable the account + * @param expire Account expiration date (seconds since epoch). '0' + * means no expiration date. + * @param firstname + * @param groups + * @param keys Keys for two factor auth (yubico). + * @param lastname + * @param password Initial password. + * @return Result + * @throws JSONException + */ + public Result createUser(String userid, String comment, String email, Boolean enable, Integer expire, String firstname, String groups, String keys, String lastname, String password) throws JSONException { + return createRest(userid, comment, email, enable, expire, firstname, groups, keys, lastname, password); + } + + /** + * Create new user. + * + * @param userid User ID + * @return Result + * @throws JSONException + */ + + public Result createRest(String userid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("userid", userid); + return _client.create("/access/users", parameters); + } + + /** + * Create new user. + * + * @param userid User ID + * @return Result + * @throws JSONException + */ + public Result createUser(String userid) throws JSONException { + return createRest(userid); + } + + } + + public class PVEGroups { + + private final PveClient _client; + + protected PVEGroups(PveClient client) { + _client = client; + + } + + public PVEItemGroupid get(Object groupid) { + return new PVEItemGroupid(_client, groupid); + } + + public class PVEItemGroupid { + + private final PveClient _client; + private final Object _groupid; + + protected PVEItemGroupid(PveClient client, Object groupid) { + _client = client; + _groupid = groupid; + } + + /** + * Delete group. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/access/groups/" + _groupid + "", null); + } + + /** + * Delete group. + * + * @return Result + * @throws JSONException + */ + public Result deleteGroup() throws JSONException { + return deleteRest(); + } + + /** + * Get group configuration. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/access/groups/" + _groupid + "", null); + } + + /** + * Get group configuration. + * + * @return Result + * @throws JSONException + */ + public Result readGroup() throws JSONException { + return getRest(); + } + + /** + * Update group data. + * + * @param comment + * @return Result + * @throws JSONException + */ + + public Result setRest(String comment) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("comment", comment); + return _client.set("/access/groups/" + _groupid + "", parameters); + } + + /** + * Update group data. + * + * @param comment + * @return Result + * @throws JSONException + */ + public Result updateGroup(String comment) throws JSONException { + return setRest(comment); + } + + /** + * Update group data. + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/access/groups/" + _groupid + "", null); + } + + /** + * Update group data. + * + * @return Result + * @throws JSONException + */ + public Result updateGroup() throws JSONException { + return setRest(); + } + + } + + /** + * Group index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/access/groups", null); + } + + /** + * Group index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create new group. + * + * @param groupid + * @param comment + * @return Result + * @throws JSONException + */ + + public Result createRest(String groupid, String comment) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("groupid", groupid); + parameters.put("comment", comment); + return _client.create("/access/groups", parameters); + } + + /** + * Create new group. + * + * @param groupid + * @param comment + * @return Result + * @throws JSONException + */ + public Result createGroup(String groupid, String comment) throws JSONException { + return createRest(groupid, comment); + } + + /** + * Create new group. + * + * @param groupid + * @return Result + * @throws JSONException + */ + + public Result createRest(String groupid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("groupid", groupid); + return _client.create("/access/groups", parameters); + } + + /** + * Create new group. + * + * @param groupid + * @return Result + * @throws JSONException + */ + public Result createGroup(String groupid) throws JSONException { + return createRest(groupid); + } + + } + + public class PVERoles { + + private final PveClient _client; + + protected PVERoles(PveClient client) { + _client = client; + + } + + public PVEItemRoleid get(Object roleid) { + return new PVEItemRoleid(_client, roleid); + } + + public class PVEItemRoleid { + + private final PveClient _client; + private final Object _roleid; + + protected PVEItemRoleid(PveClient client, Object roleid) { + _client = client; + _roleid = roleid; + } + + /** + * Delete role. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/access/roles/" + _roleid + "", null); + } + + /** + * Delete role. + * + * @return Result + * @throws JSONException + */ + public Result deleteRole() throws JSONException { + return deleteRest(); + } + + /** + * Get role configuration. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/access/roles/" + _roleid + "", null); + } + + /** + * Get role configuration. + * + * @return Result + * @throws JSONException + */ + public Result readRole() throws JSONException { + return getRest(); + } + + /** + * Update an existing role. + * + * @param append + * @param privs + * @return Result + * @throws JSONException + */ + + public Result setRest(Boolean append, String privs) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("append", append); + parameters.put("privs", privs); + return _client.set("/access/roles/" + _roleid + "", parameters); + } + + /** + * Update an existing role. + * + * @param append + * @param privs + * @return Result + * @throws JSONException + */ + public Result updateRole(Boolean append, String privs) throws JSONException { + return setRest(append, privs); + } + + /** + * Update an existing role. + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/access/roles/" + _roleid + "", null); + } + + /** + * Update an existing role. + * + * @return Result + * @throws JSONException + */ + public Result updateRole() throws JSONException { + return setRest(); + } + + } + + /** + * Role index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/access/roles", null); + } + + /** + * Role index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create new role. + * + * @param roleid + * @param privs + * @return Result + * @throws JSONException + */ + + public Result createRest(String roleid, String privs) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("roleid", roleid); + parameters.put("privs", privs); + return _client.create("/access/roles", parameters); + } + + /** + * Create new role. + * + * @param roleid + * @param privs + * @return Result + * @throws JSONException + */ + public Result createRole(String roleid, String privs) throws JSONException { + return createRest(roleid, privs); + } + + /** + * Create new role. + * + * @param roleid + * @return Result + * @throws JSONException + */ + + public Result createRest(String roleid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("roleid", roleid); + return _client.create("/access/roles", parameters); + } + + /** + * Create new role. + * + * @param roleid + * @return Result + * @throws JSONException + */ + public Result createRole(String roleid) throws JSONException { + return createRest(roleid); + } + + } + + public class PVEAcl { + + private final PveClient _client; + + protected PVEAcl(PveClient client) { + _client = client; + + } + + /** + * Get Access Control List (ACLs). + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/access/acl", null); + } + + /** + * Get Access Control List (ACLs). + * + * @return Result + * @throws JSONException + */ + public Result readAcl() throws JSONException { + return getRest(); + } + + /** + * Update Access Control List (add or remove permissions). + * + * @param path Access control path + * @param roles List of roles. + * @param delete Remove permissions (instead of adding it). + * @param groups List of groups. + * @param propagate Allow to propagate (inherit) permissions. + * @param users List of users. + * @return Result + * @throws JSONException + */ + + public Result setRest(String path, String roles, Boolean delete, String groups, Boolean propagate, String users) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("path", path); + parameters.put("roles", roles); + parameters.put("delete", delete); + parameters.put("groups", groups); + parameters.put("propagate", propagate); + parameters.put("users", users); + return _client.set("/access/acl", parameters); + } + + /** + * Update Access Control List (add or remove permissions). + * + * @param path Access control path + * @param roles List of roles. + * @param delete Remove permissions (instead of adding it). + * @param groups List of groups. + * @param propagate Allow to propagate (inherit) permissions. + * @param users List of users. + * @return Result + * @throws JSONException + */ + public Result updateAcl(String path, String roles, Boolean delete, String groups, Boolean propagate, String users) throws JSONException { + return setRest(path, roles, delete, groups, propagate, users); + } + + /** + * Update Access Control List (add or remove permissions). + * + * @param path Access control path + * @param roles List of roles. + * @return Result + * @throws JSONException + */ + + public Result setRest(String path, String roles) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("path", path); + parameters.put("roles", roles); + return _client.set("/access/acl", parameters); + } + + /** + * Update Access Control List (add or remove permissions). + * + * @param path Access control path + * @param roles List of roles. + * @return Result + * @throws JSONException + */ + public Result updateAcl(String path, String roles) throws JSONException { + return setRest(path, roles); + } + + } + + public class PVEDomains { + + private final PveClient _client; + + protected PVEDomains(PveClient client) { + _client = client; + + } + + public PVEItemRealm get(Object realm) { + return new PVEItemRealm(_client, realm); + } + + public class PVEItemRealm { + + private final PveClient _client; + private final Object _realm; + + protected PVEItemRealm(PveClient client, Object realm) { + _client = client; + _realm = realm; + } + + /** + * Delete an authentication server. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/access/domains/" + _realm + "", null); + } + + /** + * Delete an authentication server. + * + * @return Result + * @throws JSONException + */ + public Result delete() throws JSONException { + return deleteRest(); + } + + /** + * Get auth server configuration. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/access/domains/" + _realm + "", null); + } + + /** + * Get auth server configuration. + * + * @return Result + * @throws JSONException + */ + public Result read() throws JSONException { + return getRest(); + } + + /** + * Update authentication server settings. + * + * @param base_dn LDAP base domain name + * @param bind_dn LDAP bind domain name + * @param capath Path to the CA certificate store + * @param cert Path to the client certificate + * @param certkey Path to the client certificate key + * @param comment Description. + * @param default_ Use this as default realm + * @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 domain AD domain name + * @param port Server port. + * @param secure Use secure LDAPS protocol. + * @param server1 Server IP address (or DNS name) + * @param server2 Fallback Server IP address (or DNS name) + * @param sslversion LDAPS TLS/SSL version. It's not recommended + * to use version older than 1.2! Enum: + * tlsv1,tlsv1_1,tlsv1_2,tlsv1_3 + * @param tfa Use Two-factor authentication. + * @param user_attr LDAP user attribute name + * @param verify Verify the server's SSL certificate + * @return Result + * @throws JSONException + */ + + public Result setRest(String base_dn, String bind_dn, String capath, String cert, String certkey, String comment, Boolean default_, String delete, String digest, String domain, Integer port, Boolean secure, String server1, String server2, String sslversion, String tfa, String user_attr, Boolean verify) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("base_dn", base_dn); + parameters.put("bind_dn", bind_dn); + parameters.put("capath", capath); + parameters.put("cert", cert); + parameters.put("certkey", certkey); + parameters.put("comment", comment); + parameters.put("default", default_); + parameters.put("delete", delete); + parameters.put("digest", digest); + parameters.put("domain", domain); + parameters.put("port", port); + parameters.put("secure", secure); + parameters.put("server1", server1); + parameters.put("server2", server2); + parameters.put("sslversion", sslversion); + parameters.put("tfa", tfa); + parameters.put("user_attr", user_attr); + parameters.put("verify", verify); + return _client.set("/access/domains/" + _realm + "", parameters); + } + + /** + * Update authentication server settings. + * + * @param base_dn LDAP base domain name + * @param bind_dn LDAP bind domain name + * @param capath Path to the CA certificate store + * @param cert Path to the client certificate + * @param certkey Path to the client certificate key + * @param comment Description. + * @param default_ Use this as default realm + * @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 domain AD domain name + * @param port Server port. + * @param secure Use secure LDAPS protocol. + * @param server1 Server IP address (or DNS name) + * @param server2 Fallback Server IP address (or DNS name) + * @param sslversion LDAPS TLS/SSL version. It's not recommended + * to use version older than 1.2! Enum: + * tlsv1,tlsv1_1,tlsv1_2,tlsv1_3 + * @param tfa Use Two-factor authentication. + * @param user_attr LDAP user attribute name + * @param verify Verify the server's SSL certificate + * @return Result + * @throws JSONException + */ + public Result update(String base_dn, String bind_dn, String capath, String cert, String certkey, String comment, Boolean default_, String delete, String digest, String domain, Integer port, Boolean secure, String server1, String server2, String sslversion, String tfa, String user_attr, Boolean verify) throws JSONException { + return setRest(base_dn, bind_dn, capath, cert, certkey, comment, default_, delete, digest, domain, port, secure, server1, server2, sslversion, tfa, user_attr, verify); + } + + /** + * Update authentication server settings. + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/access/domains/" + _realm + "", null); + } + + /** + * Update authentication server settings. + * + * @return Result + * @throws JSONException + */ + public Result update() throws JSONException { + return setRest(); + } + + } + + /** + * Authentication domain index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/access/domains", null); + } + + /** + * Authentication domain index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Add an authentication server. + * + * @param realm Authentication domain ID + * @param type Realm type. Enum: ad,ldap,pam,pve + * @param base_dn LDAP base domain name + * @param bind_dn LDAP bind domain name + * @param capath Path to the CA certificate store + * @param cert Path to the client certificate + * @param certkey Path to the client certificate key + * @param comment Description. + * @param default_ Use this as default realm + * @param domain AD domain name + * @param port Server port. + * @param secure Use secure LDAPS protocol. + * @param server1 Server IP address (or DNS name) + * @param server2 Fallback Server IP address (or DNS name) + * @param sslversion LDAPS TLS/SSL version. It's not recommended to + * use version older than 1.2! Enum: tlsv1,tlsv1_1,tlsv1_2,tlsv1_3 + * @param tfa Use Two-factor authentication. + * @param user_attr LDAP user attribute name + * @param verify Verify the server's SSL certificate + * @return Result + * @throws JSONException + */ + + public Result createRest(String realm, String type, String base_dn, String bind_dn, String capath, String cert, String certkey, String comment, Boolean default_, String domain, Integer port, Boolean secure, String server1, String server2, String sslversion, String tfa, String user_attr, Boolean verify) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("realm", realm); + parameters.put("type", type); + parameters.put("base_dn", base_dn); + parameters.put("bind_dn", bind_dn); + parameters.put("capath", capath); + parameters.put("cert", cert); + parameters.put("certkey", certkey); + parameters.put("comment", comment); + parameters.put("default", default_); + parameters.put("domain", domain); + parameters.put("port", port); + parameters.put("secure", secure); + parameters.put("server1", server1); + parameters.put("server2", server2); + parameters.put("sslversion", sslversion); + parameters.put("tfa", tfa); + parameters.put("user_attr", user_attr); + parameters.put("verify", verify); + return _client.create("/access/domains", parameters); + } + + /** + * Add an authentication server. + * + * @param realm Authentication domain ID + * @param type Realm type. Enum: ad,ldap,pam,pve + * @param base_dn LDAP base domain name + * @param bind_dn LDAP bind domain name + * @param capath Path to the CA certificate store + * @param cert Path to the client certificate + * @param certkey Path to the client certificate key + * @param comment Description. + * @param default_ Use this as default realm + * @param domain AD domain name + * @param port Server port. + * @param secure Use secure LDAPS protocol. + * @param server1 Server IP address (or DNS name) + * @param server2 Fallback Server IP address (or DNS name) + * @param sslversion LDAPS TLS/SSL version. It's not recommended to + * use version older than 1.2! Enum: tlsv1,tlsv1_1,tlsv1_2,tlsv1_3 + * @param tfa Use Two-factor authentication. + * @param user_attr LDAP user attribute name + * @param verify Verify the server's SSL certificate + * @return Result + * @throws JSONException + */ + public Result create(String realm, String type, String base_dn, String bind_dn, String capath, String cert, String certkey, String comment, Boolean default_, String domain, Integer port, Boolean secure, String server1, String server2, String sslversion, String tfa, String user_attr, Boolean verify) throws JSONException { + return createRest(realm, type, base_dn, bind_dn, capath, cert, certkey, comment, default_, domain, port, secure, server1, server2, sslversion, tfa, user_attr, verify); + } + + /** + * Add an authentication server. + * + * @param realm Authentication domain ID + * @param type Realm type. Enum: ad,ldap,pam,pve + * @return Result + * @throws JSONException + */ + + public Result createRest(String realm, String type) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("realm", realm); + parameters.put("type", type); + return _client.create("/access/domains", parameters); + } + + /** + * Add an authentication server. + * + * @param realm Authentication domain ID + * @param type Realm type. Enum: ad,ldap,pam,pve + * @return Result + * @throws JSONException + */ + public Result create(String realm, String type) throws JSONException { + return createRest(realm, type); + } + + } + + public class PVETicket { + + private final PveClient _client; + + protected PVETicket(PveClient client) { + _client = client; + + } + + /** + * Dummy. Useful for formatters which want to provide a login page. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/access/ticket", null); + } + + /** + * Dummy. Useful for formatters which want to provide a login page. + * + * @return Result + * @throws JSONException + */ + public Result getTicket() throws JSONException { + return getRest(); + } + + /** + * Create or verify authentication ticket. + * + * @param password The secret password. This can also be a valid + * ticket. + * @param username User name + * @param otp One-time password for Two-factor authentication. + * @param path Verify ticket, and check if user have access 'privs' + * on 'path' + * @param privs Verify ticket, and check if user have access 'privs' + * on 'path' + * @param realm You can optionally pass the realm using this + * parameter. Normally the realm is simply added to the username + * &lt;username&gt;@&lt;relam&gt;. + * @return Result + * @throws JSONException + */ + + public Result createRest(String password, String username, String otp, String path, String privs, String realm) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("password", password); + parameters.put("username", username); + parameters.put("otp", otp); + parameters.put("path", path); + parameters.put("privs", privs); + parameters.put("realm", realm); + return _client.create("/access/ticket", parameters); + } + + /** + * Create or verify authentication ticket. + * + * @param password The secret password. This can also be a valid + * ticket. + * @param username User name + * @param otp One-time password for Two-factor authentication. + * @param path Verify ticket, and check if user have access 'privs' + * on 'path' + * @param privs Verify ticket, and check if user have access 'privs' + * on 'path' + * @param realm You can optionally pass the realm using this + * parameter. Normally the realm is simply added to the username + * &lt;username&gt;@&lt;relam&gt;. + * @return Result + * @throws JSONException + */ + public Result createTicket(String password, String username, String otp, String path, String privs, String realm) throws JSONException { + return createRest(password, username, otp, path, privs, realm); + } + + /** + * Create or verify authentication ticket. + * + * @param password The secret password. This can also be a valid + * ticket. + * @param username User name + * @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("/access/ticket", parameters); + } + + /** + * Create or verify authentication ticket. + * + * @param password The secret password. This can also be a valid + * ticket. + * @param username User name + * @return Result + * @throws JSONException + */ + public Result createTicket(String password, String username) throws JSONException { + return createRest(password, username); + } + + } + + public class PVEPassword { + + private final PveClient _client; + + protected PVEPassword(PveClient client) { + _client = client; + + } + + /** + * Change user password. + * + * @param password The new password. + * @param userid User ID + * @return Result + * @throws JSONException + */ + public Result setRest(String password, String userid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("password", password); + parameters.put("userid", userid); + return _client.set("/access/password", parameters); + } + + /** + * Change user password. + * + * @param password The new password. + * @param userid User ID + * @return Result + * @throws JSONException + */ + public Result changePassword(String password, String userid) throws JSONException { + return setRest(password, userid); + } + + } + + public class PVETfa { + + private final PveClient _client; + + protected PVETfa(PveClient client) { + _client = client; + + } + + /** + * Finish a u2f challenge. + * + * @param response The response to the current authentication + * challenge. + * @return Result + * @throws JSONException + */ + public Result createRest(String response) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("response", response); + return _client.create("/access/tfa", parameters); + } + + /** + * Finish a u2f challenge. + * + * @param response The response to the current authentication + * challenge. + * @return Result + * @throws JSONException + */ + public Result verifyTfa(String response) throws JSONException { + return createRest(response); + } + + /** + * Change user u2f authentication. + * + * @param action The action to perform Enum: delete,new,confirm + * @param userid User ID + * @param config A TFA configuration. This must currently be of type + * TOTP of not set at all. + * @param key When adding TOTP, the shared secret value. + * @param password The current password. + * @param response Either the the response to the current u2f + * registration challenge, or, when adding TOTP, the currently valid + * TOTP value. + * @return Result + * @throws JSONException + */ + + public Result setRest(String action, String userid, String config, String key, String password, String response) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("action", action); + parameters.put("userid", userid); + parameters.put("config", config); + parameters.put("key", key); + parameters.put("password", password); + parameters.put("response", response); + return _client.set("/access/tfa", parameters); + } + + /** + * Change user u2f authentication. + * + * @param action The action to perform Enum: delete,new,confirm + * @param userid User ID + * @param config A TFA configuration. This must currently be of type + * TOTP of not set at all. + * @param key When adding TOTP, the shared secret value. + * @param password The current password. + * @param response Either the the response to the current u2f + * registration challenge, or, when adding TOTP, the currently valid + * TOTP value. + * @return Result + * @throws JSONException + */ + public Result changeTfa(String action, String userid, String config, String key, String password, String response) throws JSONException { + return setRest(action, userid, config, key, password, response); + } + + /** + * Change user u2f authentication. + * + * @param action The action to perform Enum: delete,new,confirm + * @param userid User ID + * @return Result + * @throws JSONException + */ + + public Result setRest(String action, String userid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("action", action); + parameters.put("userid", userid); + return _client.set("/access/tfa", parameters); + } + + /** + * Change user u2f authentication. + * + * @param action The action to perform Enum: delete,new,confirm + * @param userid User ID + * @return Result + * @throws JSONException + */ + public Result changeTfa(String action, String userid) throws JSONException { + return setRest(action, userid); + } + + } + + /** + * Directory index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/access", null); + } + + /** + * Directory index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + } + + public class PVEPools { + + private final PveClient _client; + + protected PVEPools(PveClient client) { + _client = client; + + } + + public PVEItemPoolid get(Object poolid) { + return new PVEItemPoolid(_client, poolid); + } + + public class PVEItemPoolid { + + private final PveClient _client; + private final Object _poolid; + + protected PVEItemPoolid(PveClient client, Object poolid) { + _client = client; + _poolid = poolid; + } + + /** + * Delete pool. + * + * @return Result + * @throws JSONException + */ + public Result deleteRest() throws JSONException { + return _client.delete("/pools/" + _poolid + "", null); + } + + /** + * Delete pool. + * + * @return Result + * @throws JSONException + */ + public Result deletePool() throws JSONException { + return deleteRest(); + } + + /** + * Get pool configuration. + * + * @return Result + * @throws JSONException + */ + + public Result getRest() throws JSONException { + return _client.get("/pools/" + _poolid + "", null); + } + + /** + * Get pool configuration. + * + * @return Result + * @throws JSONException + */ + public Result readPool() throws JSONException { + return getRest(); + } + + /** + * Update pool data. + * + * @param comment + * @param delete Remove vms/storage (instead of adding it). + * @param storage List of storage IDs. + * @param vms List of virtual machines. + * @return Result + * @throws JSONException + */ + + public Result setRest(String comment, Boolean delete, String storage, String vms) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("comment", comment); + parameters.put("delete", delete); + parameters.put("storage", storage); + parameters.put("vms", vms); + return _client.set("/pools/" + _poolid + "", parameters); + } + + /** + * Update pool data. + * + * @param comment + * @param delete Remove vms/storage (instead of adding it). + * @param storage List of storage IDs. + * @param vms List of virtual machines. + * @return Result + * @throws JSONException + */ + public Result updatePool(String comment, Boolean delete, String storage, String vms) throws JSONException { + return setRest(comment, delete, storage, vms); + } + + /** + * Update pool data. + * + * @return Result + * @throws JSONException + */ + + public Result setRest() throws JSONException { + return _client.set("/pools/" + _poolid + "", null); + } + + /** + * Update pool data. + * + * @return Result + * @throws JSONException + */ + public Result updatePool() throws JSONException { + return setRest(); + } + + } + + /** + * Pool index. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/pools", null); + } + + /** + * Pool index. + * + * @return Result + * @throws JSONException + */ + public Result index() throws JSONException { + return getRest(); + } + + /** + * Create new pool. + * + * @param poolid + * @param comment + * @return Result + * @throws JSONException + */ + + public Result createRest(String poolid, String comment) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("poolid", poolid); + parameters.put("comment", comment); + return _client.create("/pools", parameters); + } + + /** + * Create new pool. + * + * @param poolid + * @param comment + * @return Result + * @throws JSONException + */ + public Result createPool(String poolid, String comment) throws JSONException { + return createRest(poolid, comment); + } + + /** + * Create new pool. + * + * @param poolid + * @return Result + * @throws JSONException + */ + + public Result createRest(String poolid) throws JSONException { + Map parameters = new HashMap<>(); + parameters.put("poolid", poolid); + return _client.create("/pools", parameters); + } + + /** + * Create new pool. + * + * @param poolid + * @return Result + * @throws JSONException + */ + public Result createPool(String poolid) throws JSONException { + return createRest(poolid); + } + + } + + public class PVEVersion { + + private final PveClient _client; + + protected PVEVersion(PveClient client) { + _client = client; + + } + + /** + * API version details. The result also includes the global datacenter + * confguration. + * + * @return Result + * @throws JSONException + */ + public Result getRest() throws JSONException { + return _client.get("/version", null); + } + + /** + * API version details. The result also includes the global datacenter + * confguration. + * + * @return Result + * @throws JSONException + */ + public Result version() throws JSONException { + return getRest(); + } + + } + +}